From bd676b3147e3e9a467cbd5497c7eed66f11755e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Tue, 24 Jun 2025 17:33:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=AE=A4=E9=A2=86?= =?UTF-8?q?=E8=BD=A6=E8=BE=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/user/model/index.ts | 1 + src/hjm/query.tsx | 13 ++++++++++- src/pages/index/Header.tsx | 5 +++++ src/pages/index/index.tsx | 35 +++++++----------------------- 4 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/api/system/user/model/index.ts b/src/api/system/user/model/index.ts index 33c8feb..bc1915c 100644 --- a/src/api/system/user/model/index.ts +++ b/src/api/system/user/model/index.ts @@ -54,6 +54,7 @@ export interface User { city?: string; region?: string; // 机构名称 + organization?: string; organizationName?: string; // 角色列表 roles?: Role[]; diff --git a/src/hjm/query.tsx b/src/hjm/query.tsx index 5fff995..c94bbb4 100644 --- a/src/hjm/query.tsx +++ b/src/hjm/query.tsx @@ -309,7 +309,18 @@ const Query = () => { } // 认领车辆 - const onClaimVehicle = () => { + const onClaimVehicle = async () => { + const myVerify = await myUserVerify({status: 1}) + if(myVerify){ + if(myVerify.organizationId != FormData.organizationId){ + Taro.showToast({ + title: '只能认领【' + myVerify.organizationName + '】的车辆', + icon: 'none' + }); + return false; + } + } + updateHjmCar({ ...FormData, claim: 1, diff --git a/src/pages/index/Header.tsx b/src/pages/index/Header.tsx index 4a56e37..e890f0d 100644 --- a/src/pages/index/Header.tsx +++ b/src/pages/index/Header.tsx @@ -31,6 +31,7 @@ const Header = (props: any) => { }) getUserInfo().then((data) => { if (data) { + console.log(data.organizationName,'0000') setIsLogin(true); Taro.setStorageSync('UserId', data.userId) Taro.setStorageSync('Phone',data.phone) @@ -40,6 +41,10 @@ const Header = (props: any) => { getOrganization(Number(data.organizationId)).then(res => { Taro.setStorageSync('OrganizationParentId',res.parentId) }) + // 所属站点名称 + if(data.organizationName){ + Taro.setStorageSync('OrganizationName',data.organizationName) + } // 是否已认证 if(data.certification){ Taro.setStorageSync('Certification','1') diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 0c0798c..0da47f5 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -23,6 +23,7 @@ export interface Market { } function Home() { + const [loading, setLoading] = useState(false) const [IsLogin, setIsLogin] = useState(true) const [isAdmin, setIsAdmin] = useState(false) const [search, setSearch] = useState(false) @@ -120,22 +121,12 @@ function Home() { if (Taro.getStorageSync('certification')) { setIsAdmin(true) setScale(11) - pageHjmCarByMap(res.latitude, res.longitude) + // pageHjmCarByMap(res.latitude, res.longitude) } // 游客 if (!Taro.getStorageSync('access_token') || Taro.getStorageSync('RoleName') == '注册用户') { setScale(15) - const arr = [] - // @ts-ignore - arr.push({ - id: 10001, - latitude: res.latitude, - longitude: res.longitude, - title: '当前位置', - name: '当前位置' - }) - setMarkers(arr) } return res; } catch (err) { @@ -183,19 +174,6 @@ function Home() { pageByQQMap(where).then(res => { console.log(res, 'pageByQQMap') - if (res?.count == 0) { - const arr = [] - // @ts-ignore - arr.push({ - id: 10001, - latitude: 22.813371, - longitude: 108.323885, - title: '当前位置', - name: '当前位置' - }) - setMarkers(arr) - return false - } if (res?.list && res?.list.length > 0) { const data = res?.list; const arr = [] @@ -224,7 +202,8 @@ function Home() { }) } - const reload = () => { + const reload = async () => { + setLoading(true) if (!Taro.getStorageSync('access_token')) { return false; } @@ -288,7 +267,9 @@ function Home() { if (res.authSetting['scope.userInfo']) { // 用户已经授权过,可以直接获取用户信息 console.log('用户已经授权过,可以直接获取用户信息') - reload(); + reload().then(() => { + setLoading(false) + }); } else { // 用户未授权,需要弹出授权窗口 console.log('用户未授权,需要弹出授权窗口') @@ -381,7 +362,7 @@ function Home() { - {markers.length > 0 && ( + {!loading && (