diff --git a/.idea/AugmentWebviewStateStore.xml b/.idea/AugmentWebviewStateStore.xml index 7d42d65..2e385c6 100644 --- a/.idea/AugmentWebviewStateStore.xml +++ b/.idea/AugmentWebviewStateStore.xml @@ -3,7 +3,7 @@ diff --git a/src/app.ts b/src/app.ts index 5f36060..67b1c72 100644 --- a/src/app.ts +++ b/src/app.ts @@ -6,13 +6,10 @@ import './app.scss' import {loginByOpenId} from "@/api/layout"; import {TenantId} from "@/utils/config"; // import {saveStorageByLoginUser} from "@/utils/server"; -import {mqttStart} from "@/api/hjm/hjmCar"; +// import {mqttStart} from "@/api/hjm/hjmCar"; function App(props) { const reload = () => { - mqttStart().then(() => { - console.log('mqttStart') - }) Taro.login({ success: (res) => { loginByOpenId({ diff --git a/src/hjm/gps-log/gps-log.config.ts b/src/hjm/gps-log/gps-log.config.ts index ff6a355..a347388 100644 --- a/src/hjm/gps-log/gps-log.config.ts +++ b/src/hjm/gps-log/gps-log.config.ts @@ -1,4 +1,3 @@ export default definePageConfig({ - navigationBarTitleText: '位置明细', - navigationBarBackgroundColor: '#ffe0e0' + navigationBarTitleText: '位置明细' }) diff --git a/src/hjm/list.tsx b/src/hjm/list.tsx index 2a5e6c2..7541ef8 100644 --- a/src/hjm/list.tsx +++ b/src/hjm/list.tsx @@ -6,6 +6,7 @@ import {HjmCar} from "@/api/hjm/hjmCar/model"; import Taro from '@tarojs/taro' import './location.scss' import BestSellers from "./BestSellers"; +import {getUserInfo} from "@/api/layout"; /** * 文章终极列表 @@ -19,31 +20,30 @@ const List = () => { setKeywords(keywords) } - const reload = () => { + const reload = async () => { // 搜索条件 const where = {status: 1, deleted: 0, keywords} + + // 读取用户信息 + const user = await getUserInfo(); + // 判断身份 const roleCode = Taro.getStorageSync('RoleCode'); if(roleCode == 'kuaidiyuan'){ // @ts-ignore - where.driverId = Taro.getStorageSync('UserId') + where.driverId = user.userId; } if(roleCode == 'zhandian'){ // @ts-ignore - where.organizationId = Taro.getStorageSync('OrganizationId'); + where.organizationId = user.organizationId; } if(roleCode == 'kuaidi'){ - if(Taro.getStorageSync('OrganizationId') == Taro.getStorageSync('OrganizationParentId')){ - // @ts-ignore - where.organizationParentId = Taro.getStorageSync('OrganizationParentId'); - }else { - // @ts-ignore - where.organizationId = Taro.getStorageSync('OrganizationId'); - } + // @ts-ignore + where.organizationParentId = user.organizationId; } if(roleCode == 'Installer'){ // @ts-ignore - where.installerId = Taro.getStorageSync('UserId') + where.installerId = user.userId; } if(roleCode == 'user'){ return false; diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 1ba108a..9772ed4 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -28,8 +28,8 @@ function Home() { const [isAdmin, setIsAdmin] = useState(false) const [search, setSearch] = useState(false) const [userInfo, setUserInfo] = useState() - const [longitude, setLongitude] = useState(108.374959) - const [latitude, setLatitude] = useState(22.767024) + const [longitude, setLongitude] = useState() + const [latitude, setLatitude] = useState() const [markers, setMarkers] = useState([]) const [scale, setScale] = useState(12) const [keywords, setKeywords] = useState('') @@ -110,6 +110,7 @@ function Home() { const res = await Taro.getLocation({ type: 'gcj02' //返回可以用于wx.openLocation的经纬度 }) + if (res.latitude) { setLatitude(res.latitude) } @@ -145,10 +146,12 @@ function Home() { reload(); } - const pageHjmCarByMap = (latitude?: any, longitude?: any) => { + const pageHjmCarByMap = async (latitude?: any, longitude?: any) => { // 搜索条件 const where = {} + const user = await getUserInfo(); + // 交警和邮管不能在小程序主界面地图上看到任何一个车辆的定位 if(Taro.getStorageSync('RoleCode') == 'jiaojing' || Taro.getStorageSync('RoleCode') == 'youzheng'){ return false @@ -165,19 +168,19 @@ function Home() { const roleCode = Taro.getStorageSync('RoleCode'); if (roleCode == 'kuaidiyuan') { // @ts-ignore - where.driverId = Taro.getStorageSync('UserId') + where.driverId = user.userId; } if (roleCode == 'zhandian') { // @ts-ignore - where.organizationId = Taro.getStorageSync('OrganizationId'); + where.organizationId = user.organizationId; } if (roleCode == 'kuaidi') { // @ts-ignore - where.organizationParentId = Taro.getStorageSync('OrganizationParentId'); + where.organizationParentId = user.organizationId; } pageByQQMap(where).then(res => { - console.log(res, 'pageByQQMap') + console.log(res?.count, 'pageByQQMap') if (res?.list && res?.list.length > 0) { const data = res?.list; const arr = [] @@ -323,11 +326,6 @@ function Home() { } }).catch(() => { setIsLogin(false); - setMarkers([{ - id: 123, - latitude: latitude, - longitude: longitude - }]) console.log('未登录') }); } diff --git a/src/pages/user/components/UserCell.tsx b/src/pages/user/components/UserCell.tsx index ab3bfdd..d903be3 100644 --- a/src/pages/user/components/UserCell.tsx +++ b/src/pages/user/components/UserCell.tsx @@ -57,24 +57,28 @@ const UserCell = () => { /> { - (roleName === 'kuaidi' || roleName == 'zhandian') && ( + (roleName === 'kuaidi' || roleName == 'zhandian' || roleName == 'youzheng') && ( <> - - - - 实名认证审核 - - } - align="center" - extra={} - onClick={() => { - navTo('/user/userVerify/admin', true) - }} - /> - + { + roleName != 'youzheng' && ( + + + + 实名认证审核 + + } + align="center" + extra={} + onClick={() => { + navTo('/user/userVerify/admin', true) + }} + /> + + ) + }