修复:认领车辆
This commit is contained in:
@@ -54,6 +54,7 @@ export interface User {
|
|||||||
city?: string;
|
city?: string;
|
||||||
region?: string;
|
region?: string;
|
||||||
// 机构名称
|
// 机构名称
|
||||||
|
organization?: string;
|
||||||
organizationName?: string;
|
organizationName?: string;
|
||||||
// 角色列表
|
// 角色列表
|
||||||
roles?: Role[];
|
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({
|
updateHjmCar({
|
||||||
...FormData,
|
...FormData,
|
||||||
claim: 1,
|
claim: 1,
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ const Header = (props: any) => {
|
|||||||
})
|
})
|
||||||
getUserInfo().then((data) => {
|
getUserInfo().then((data) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
|
console.log(data.organizationName,'0000')
|
||||||
setIsLogin(true);
|
setIsLogin(true);
|
||||||
Taro.setStorageSync('UserId', data.userId)
|
Taro.setStorageSync('UserId', data.userId)
|
||||||
Taro.setStorageSync('Phone',data.phone)
|
Taro.setStorageSync('Phone',data.phone)
|
||||||
@@ -40,6 +41,10 @@ const Header = (props: any) => {
|
|||||||
getOrganization(Number(data.organizationId)).then(res => {
|
getOrganization(Number(data.organizationId)).then(res => {
|
||||||
Taro.setStorageSync('OrganizationParentId',res.parentId)
|
Taro.setStorageSync('OrganizationParentId',res.parentId)
|
||||||
})
|
})
|
||||||
|
// 所属站点名称
|
||||||
|
if(data.organizationName){
|
||||||
|
Taro.setStorageSync('OrganizationName',data.organizationName)
|
||||||
|
}
|
||||||
// 是否已认证
|
// 是否已认证
|
||||||
if(data.certification){
|
if(data.certification){
|
||||||
Taro.setStorageSync('Certification','1')
|
Taro.setStorageSync('Certification','1')
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export interface Market {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Home() {
|
function Home() {
|
||||||
|
const [loading, setLoading] = useState<boolean>(false)
|
||||||
const [IsLogin, setIsLogin] = useState<boolean>(true)
|
const [IsLogin, setIsLogin] = useState<boolean>(true)
|
||||||
const [isAdmin, setIsAdmin] = useState<boolean>(false)
|
const [isAdmin, setIsAdmin] = useState<boolean>(false)
|
||||||
const [search, setSearch] = useState(false)
|
const [search, setSearch] = useState(false)
|
||||||
@@ -120,22 +121,12 @@ function Home() {
|
|||||||
if (Taro.getStorageSync('certification')) {
|
if (Taro.getStorageSync('certification')) {
|
||||||
setIsAdmin(true)
|
setIsAdmin(true)
|
||||||
setScale(11)
|
setScale(11)
|
||||||
pageHjmCarByMap(res.latitude, res.longitude)
|
// pageHjmCarByMap(res.latitude, res.longitude)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 游客
|
// 游客
|
||||||
if (!Taro.getStorageSync('access_token') || Taro.getStorageSync('RoleName') == '注册用户') {
|
if (!Taro.getStorageSync('access_token') || Taro.getStorageSync('RoleName') == '注册用户') {
|
||||||
setScale(15)
|
setScale(15)
|
||||||
const arr = []
|
|
||||||
// @ts-ignore
|
|
||||||
arr.push({
|
|
||||||
id: 10001,
|
|
||||||
latitude: res.latitude,
|
|
||||||
longitude: res.longitude,
|
|
||||||
title: '当前位置',
|
|
||||||
name: '当前位置'
|
|
||||||
})
|
|
||||||
setMarkers(arr)
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -183,19 +174,6 @@ function Home() {
|
|||||||
|
|
||||||
pageByQQMap(where).then(res => {
|
pageByQQMap(where).then(res => {
|
||||||
console.log(res, 'pageByQQMap')
|
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) {
|
if (res?.list && res?.list.length > 0) {
|
||||||
const data = res?.list;
|
const data = res?.list;
|
||||||
const arr = []
|
const arr = []
|
||||||
@@ -224,7 +202,8 @@ function Home() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const reload = () => {
|
const reload = async () => {
|
||||||
|
setLoading(true)
|
||||||
if (!Taro.getStorageSync('access_token')) {
|
if (!Taro.getStorageSync('access_token')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -288,7 +267,9 @@ function Home() {
|
|||||||
if (res.authSetting['scope.userInfo']) {
|
if (res.authSetting['scope.userInfo']) {
|
||||||
// 用户已经授权过,可以直接获取用户信息
|
// 用户已经授权过,可以直接获取用户信息
|
||||||
console.log('用户已经授权过,可以直接获取用户信息')
|
console.log('用户已经授权过,可以直接获取用户信息')
|
||||||
reload();
|
reload().then(() => {
|
||||||
|
setLoading(false)
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// 用户未授权,需要弹出授权窗口
|
// 用户未授权,需要弹出授权窗口
|
||||||
console.log('用户未授权,需要弹出授权窗口')
|
console.log('用户未授权,需要弹出授权窗口')
|
||||||
@@ -381,7 +362,7 @@ function Home() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{markers.length > 0 && (
|
{!loading && (
|
||||||
<Map
|
<Map
|
||||||
id="map"
|
id="map"
|
||||||
longitude={longitude}
|
longitude={longitude}
|
||||||
|
|||||||
Reference in New Issue
Block a user