修复:认领车辆
This commit is contained in:
@@ -54,6 +54,7 @@ export interface User {
|
||||
city?: string;
|
||||
region?: string;
|
||||
// 机构名称
|
||||
organization?: string;
|
||||
organizationName?: string;
|
||||
// 角色列表
|
||||
roles?: Role[];
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface Market {
|
||||
}
|
||||
|
||||
function Home() {
|
||||
const [loading, setLoading] = useState<boolean>(false)
|
||||
const [IsLogin, setIsLogin] = useState<boolean>(true)
|
||||
const [isAdmin, setIsAdmin] = useState<boolean>(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() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{markers.length > 0 && (
|
||||
{!loading && (
|
||||
<Map
|
||||
id="map"
|
||||
longitude={longitude}
|
||||
|
||||
Reference in New Issue
Block a user