From ed80e2db40aae5f18ac1fa8bce6af2097f143460 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Thu, 26 Jun 2025 17:01:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=B7=B2=E7=9F=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/AugmentWebviewStateStore.xml | 2 +- src/api/hjm/hjmViolation/model/index.ts | 1 + src/app.config.ts | 1 + src/hjm/violation/detail.config.ts | 3 + src/hjm/violation/detail.tsx | 78 +++++++++++++++++++++++++ src/hjm/violation/list.tsx | 34 +++++++---- src/pages/index/ExpirationTime.tsx | 4 +- src/pages/index/Header.tsx | 4 +- src/pages/index/index.tsx | 9 ++- src/pages/user/components/UserCell.tsx | 21 +++++++ 10 files changed, 138 insertions(+), 19 deletions(-) create mode 100644 src/hjm/violation/detail.config.ts create mode 100644 src/hjm/violation/detail.tsx diff --git a/.idea/AugmentWebviewStateStore.xml b/.idea/AugmentWebviewStateStore.xml index 66245e6..e261587 100644 --- a/.idea/AugmentWebviewStateStore.xml +++ b/.idea/AugmentWebviewStateStore.xml @@ -3,7 +3,7 @@ diff --git a/src/api/hjm/hjmViolation/model/index.ts b/src/api/hjm/hjmViolation/model/index.ts index 8c5cd60..d4d3f3c 100644 --- a/src/api/hjm/hjmViolation/model/index.ts +++ b/src/api/hjm/hjmViolation/model/index.ts @@ -39,5 +39,6 @@ export interface HjmViolation { */ export interface HjmViolationParam extends PageParam { id?: number; + code?: string; keywords?: string; } diff --git a/src/app.config.ts b/src/app.config.ts index cd517af..50f6d30 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -52,6 +52,7 @@ export default defineAppConfig({ "bx/bx-add", "violation/add", "violation/list", + "violation/detail", "trajectory/trajectory", "gps-log/gps-log" // "bx/bx-list", diff --git a/src/hjm/violation/detail.config.ts b/src/hjm/violation/detail.config.ts new file mode 100644 index 0000000..473a3a6 --- /dev/null +++ b/src/hjm/violation/detail.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '违章记录' +}) diff --git a/src/hjm/violation/detail.tsx b/src/hjm/violation/detail.tsx new file mode 100644 index 0000000..dd34a7e --- /dev/null +++ b/src/hjm/violation/detail.tsx @@ -0,0 +1,78 @@ +import {useEffect, useState} from "react"; +import Taro from '@tarojs/taro' +import {useRouter} from '@tarojs/taro' +import { + Cell +} from '@nutui/nutui-react-taro' +import {listHjmViolation} from "@/api/hjm/hjmViolation"; +import {HjmViolation} from "@/api/hjm/hjmViolation/model"; + +/** + * 添加违章记录页面 + */ +function Detail() { + const {params} = useRouter(); + const [violation, setViolation] = useState({}) + + // 初始化页面数据 + const initPageData = async () => { + try { + listHjmViolation({ + code: params.id + }).then(data => { + console.log(data[0],'00[]000') + data.length > 0 && setViolation(data[0]) + }) + } catch (error) { + console.error('初始化失败:', error) + Taro.showToast({ + title: '初始化失败', + icon: 'none' + }) + } + } + + useEffect(() => { + initPageData().then(r => { + console.log(r, 'rr') + }) + }, []) + + return ( +
+ + {/* 违章信息表单 */} +
+ + + 车辆编号:{violation.code} + + + 车辆编号:{violation.title} + + + 违章描述:{violation.comments} + + + 违章金额:{violation.money} + + + 扣分情况:{violation.score} + + +
+ +
+ ) +} + +export default Detail diff --git a/src/hjm/violation/list.tsx b/src/hjm/violation/list.tsx index 17404ed..7ab3e1d 100644 --- a/src/hjm/violation/list.tsx +++ b/src/hjm/violation/list.tsx @@ -157,6 +157,11 @@ const List: React.FC = () => { boxShadow: '0 2px 8px rgba(0,0,0,0.06)', border: '1px solid #f0f0f0' }} + onClick={() => { + Taro.navigateTo({ + url: `/hjm/violation/detail?id=${item.code}` + }) + }} >
{ )}
-
- -
+ { + Taro.getStorageSync('RoleCode') == 'jiaojing' && ( +
+ +
+ ) + } ) } diff --git a/src/pages/index/ExpirationTime.tsx b/src/pages/index/ExpirationTime.tsx index 4c632bb..55e1398 100644 --- a/src/pages/index/ExpirationTime.tsx +++ b/src/pages/index/ExpirationTime.tsx @@ -40,10 +40,10 @@ const ExpirationTime = () => { if(data.certification){ setIsAdmin( true) } - if(Taro.getStorageSync('certification') == 'jj'){ + if(Taro.getStorageSync('Certification') == 'jj'){ setIsAdmin(true) } - if(Taro.getStorageSync('certification') == 'yz'){ + if(Taro.getStorageSync('Certification') == 'yz'){ setIsAdmin(true) } if(Taro.getStorageSync('RoleCode') == 'Installer'){ diff --git a/src/pages/index/Header.tsx b/src/pages/index/Header.tsx index e890f0d..5d59507 100644 --- a/src/pages/index/Header.tsx +++ b/src/pages/index/Header.tsx @@ -71,7 +71,7 @@ const Header = (props: any) => { setRoleName('交警') Taro.setStorageSync('RoleName', '交警') Taro.setStorageSync('RoleCode', 'jiaojing') - Taro.setStorageSync('certification', 'jj') + Taro.setStorageSync('Certification', 'jj') return false; } // 邮政协会/管局 @@ -80,7 +80,7 @@ const Header = (props: any) => { setRoleName('邮政协会/管局') Taro.setStorageSync('RoleName', '邮政协会/管局') Taro.setStorageSync('RoleCode', 'youzheng') - Taro.setStorageSync('certification', 'yz') + Taro.setStorageSync('Certification', 'yz') return false; } // 快递公司 diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 0da47f5..1ba108a 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -118,7 +118,7 @@ function Home() { } // 已认证用户 - if (Taro.getStorageSync('certification')) { + if (Taro.getStorageSync('Certification')) { setIsAdmin(true) setScale(11) // pageHjmCarByMap(res.latitude, res.longitude) @@ -149,6 +149,10 @@ function Home() { // 搜索条件 const where = {} + // 交警和邮管不能在小程序主界面地图上看到任何一个车辆的定位 + if(Taro.getStorageSync('RoleCode') == 'jiaojing' || Taro.getStorageSync('RoleCode') == 'youzheng'){ + return false + } if (latitude) { // @ts-ignore where.latitude = latitude @@ -207,6 +211,7 @@ function Home() { if (!Taro.getStorageSync('access_token')) { return false; } + pageHjmCarByMap(latitude, longitude) if (!isAdmin) { return false; @@ -293,7 +298,7 @@ function Home() { setIsAdmin(true) } // 是否交警 - if (Taro.getStorageSync('certification') == 'jj') { + if (Taro.getStorageSync('Certification') == 'jj') { console.log('交警', '12312') setIsAdmin(true) } diff --git a/src/pages/user/components/UserCell.tsx b/src/pages/user/components/UserCell.tsx index 4ae325b..f0147c8 100644 --- a/src/pages/user/components/UserCell.tsx +++ b/src/pages/user/components/UserCell.tsx @@ -135,6 +135,27 @@ const UserCell = () => { ) } + { + roleName === 'youzheng' && ( + + + + 违章记录 + + } + align="center" + extra={} + onClick={() => { + navTo('/hjm/violation/list', true) + }} + /> + + ) + } + {/**/} {/* 管理*/}