完成:黄家明项目的开发并存档
This commit is contained in:
@@ -116,16 +116,15 @@ function Home() {
|
||||
setLongitude(res.longitude)
|
||||
}
|
||||
|
||||
console.log(Taro.getStorageSync('RoleName'))
|
||||
// 已认证用户
|
||||
if(Taro.getStorageSync('Certification')){
|
||||
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') == '注册用户'){
|
||||
if (!Taro.getStorageSync('access_token') || Taro.getStorageSync('RoleName') == '注册用户') {
|
||||
setScale(15)
|
||||
const arr = []
|
||||
// @ts-ignore
|
||||
@@ -145,7 +144,7 @@ function Home() {
|
||||
}
|
||||
|
||||
const onQuery = () => {
|
||||
if(!keywords){
|
||||
if (!keywords) {
|
||||
Taro.showToast({
|
||||
title: '请输入关键字',
|
||||
icon: 'none'
|
||||
@@ -155,36 +154,36 @@ function Home() {
|
||||
reload();
|
||||
}
|
||||
|
||||
const pageHjmCarByMap = (latitude?: any,longitude?: any) => {
|
||||
const pageHjmCarByMap = (latitude?: any, longitude?: any) => {
|
||||
// 搜索条件
|
||||
const where = {}
|
||||
|
||||
if(latitude){
|
||||
if (latitude) {
|
||||
// @ts-ignore
|
||||
where.latitude = latitude
|
||||
}
|
||||
if(longitude){
|
||||
if (longitude) {
|
||||
// @ts-ignore
|
||||
where.longitude = longitude
|
||||
}
|
||||
// 判断身份
|
||||
const roleCode = Taro.getStorageSync('RoleCode');
|
||||
if(roleCode == 'kuaidiyuan'){
|
||||
if (roleCode == 'kuaidiyuan') {
|
||||
// @ts-ignore
|
||||
where.driverId = Taro.getStorageSync('UserId')
|
||||
}
|
||||
if(roleCode == 'zhandian'){
|
||||
if (roleCode == 'zhandian') {
|
||||
// @ts-ignore
|
||||
where.organizationId = Taro.getStorageSync('OrganizationId');
|
||||
}
|
||||
if(roleCode == 'kuaidi'){
|
||||
if (roleCode == 'kuaidi') {
|
||||
// @ts-ignore
|
||||
where.organizationParentId = Taro.getStorageSync('OrganizationParentId');
|
||||
}
|
||||
|
||||
pageByQQMap(where).then(res => {
|
||||
console.log(res,'pageByQQMap')
|
||||
if(res?.count == 0){
|
||||
console.log(res, 'pageByQQMap')
|
||||
if (res?.count == 0) {
|
||||
const arr = []
|
||||
// @ts-ignore
|
||||
arr.push({
|
||||
@@ -226,16 +225,16 @@ function Home() {
|
||||
}
|
||||
|
||||
const reload = () => {
|
||||
if(!Taro.getStorageSync('access_token')){
|
||||
if (!Taro.getStorageSync('access_token')) {
|
||||
return false;
|
||||
}
|
||||
if(!isAdmin){
|
||||
if (!isAdmin) {
|
||||
return false;
|
||||
}
|
||||
setMarkers([])
|
||||
setScale(12)
|
||||
pageHjmCar({keywords,deleted: 0}).then(res => {
|
||||
if(res?.count == 0){
|
||||
pageHjmCar({keywords, deleted: 0}).then(res => {
|
||||
if (res?.count == 0) {
|
||||
Taro.showToast({
|
||||
title: '没有搜索结果',
|
||||
icon: 'none'
|
||||
@@ -247,7 +246,7 @@ function Home() {
|
||||
const data = res?.list[0];
|
||||
setLongitude(data?.longitude)
|
||||
setLatitude(data?.latitude)
|
||||
if(isAdmin){
|
||||
if (isAdmin) {
|
||||
setMarkers([{
|
||||
id: data.id,
|
||||
latitude: data.latitude,
|
||||
@@ -268,7 +267,7 @@ function Home() {
|
||||
}])
|
||||
}
|
||||
}
|
||||
console.log(list.length,'carList.length')
|
||||
console.log(list.length, 'carList.length')
|
||||
})
|
||||
};
|
||||
|
||||
@@ -308,8 +307,12 @@ function Home() {
|
||||
getUserInfo().then((data) => {
|
||||
if (data) {
|
||||
// 是否管理员
|
||||
console.log(data.certification, 'certification')
|
||||
if(data.certification){
|
||||
if (data.certification) {
|
||||
setIsAdmin(true)
|
||||
}
|
||||
// 是否交警
|
||||
if (Taro.getStorageSync('certification') == 'jj') {
|
||||
console.log('交警', '12312')
|
||||
setIsAdmin(true)
|
||||
}
|
||||
setUserInfo(data)
|
||||
@@ -319,8 +322,11 @@ function Home() {
|
||||
if (!data.openid) {
|
||||
Taro.login({
|
||||
success: (res) => {
|
||||
getWxOpenId({code: res.code}).then(() => {
|
||||
})
|
||||
// 排查交警和邮政角色不保存openid
|
||||
if (Taro.getStorageSync('RoleCode') !== 'jiaojing' || Taro.getStorageSync('RoleCode') !== 'youzheng' || Taro.getStorageSync('RoleCode') !== 'Installer') {
|
||||
getWxOpenId({code: res.code}).then(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user