修复:已知问题

This commit is contained in:
2025-07-07 13:21:46 +08:00
parent 78bc420fb8
commit 8b0a0df98d
6 changed files with 45 additions and 47 deletions

File diff suppressed because one or more lines are too long

View File

@@ -6,13 +6,10 @@ import './app.scss'
import {loginByOpenId} from "@/api/layout"; import {loginByOpenId} from "@/api/layout";
import {TenantId} from "@/utils/config"; import {TenantId} from "@/utils/config";
// import {saveStorageByLoginUser} from "@/utils/server"; // import {saveStorageByLoginUser} from "@/utils/server";
import {mqttStart} from "@/api/hjm/hjmCar"; // import {mqttStart} from "@/api/hjm/hjmCar";
function App(props) { function App(props) {
const reload = () => { const reload = () => {
mqttStart().then(() => {
console.log('mqttStart')
})
Taro.login({ Taro.login({
success: (res) => { success: (res) => {
loginByOpenId({ loginByOpenId({

View File

@@ -1,4 +1,3 @@
export default definePageConfig({ export default definePageConfig({
navigationBarTitleText: '位置明细', navigationBarTitleText: '位置明细'
navigationBarBackgroundColor: '#ffe0e0'
}) })

View File

@@ -6,6 +6,7 @@ import {HjmCar} from "@/api/hjm/hjmCar/model";
import Taro from '@tarojs/taro' import Taro from '@tarojs/taro'
import './location.scss' import './location.scss'
import BestSellers from "./BestSellers"; import BestSellers from "./BestSellers";
import {getUserInfo} from "@/api/layout";
/** /**
* 文章终极列表 * 文章终极列表
@@ -19,31 +20,30 @@ const List = () => {
setKeywords(keywords) setKeywords(keywords)
} }
const reload = () => { const reload = async () => {
// 搜索条件 // 搜索条件
const where = {status: 1, deleted: 0, keywords} const where = {status: 1, deleted: 0, keywords}
// 读取用户信息
const user = await getUserInfo();
// 判断身份 // 判断身份
const roleCode = Taro.getStorageSync('RoleCode'); const roleCode = Taro.getStorageSync('RoleCode');
if(roleCode == 'kuaidiyuan'){ if(roleCode == 'kuaidiyuan'){
// @ts-ignore // @ts-ignore
where.driverId = Taro.getStorageSync('UserId') where.driverId = user.userId;
} }
if(roleCode == 'zhandian'){ if(roleCode == 'zhandian'){
// @ts-ignore // @ts-ignore
where.organizationId = Taro.getStorageSync('OrganizationId'); where.organizationId = user.organizationId;
} }
if(roleCode == 'kuaidi'){ if(roleCode == 'kuaidi'){
if(Taro.getStorageSync('OrganizationId') == Taro.getStorageSync('OrganizationParentId')){
// @ts-ignore // @ts-ignore
where.organizationParentId = Taro.getStorageSync('OrganizationParentId'); where.organizationParentId = user.organizationId;
}else {
// @ts-ignore
where.organizationId = Taro.getStorageSync('OrganizationId');
}
} }
if(roleCode == 'Installer'){ if(roleCode == 'Installer'){
// @ts-ignore // @ts-ignore
where.installerId = Taro.getStorageSync('UserId') where.installerId = user.userId;
} }
if(roleCode == 'user'){ if(roleCode == 'user'){
return false; return false;

View File

@@ -28,8 +28,8 @@ function Home() {
const [isAdmin, setIsAdmin] = useState<boolean>(false) const [isAdmin, setIsAdmin] = useState<boolean>(false)
const [search, setSearch] = useState(false) const [search, setSearch] = useState(false)
const [userInfo, setUserInfo] = useState<User>() const [userInfo, setUserInfo] = useState<User>()
const [longitude, setLongitude] = useState<any>(108.374959) const [longitude, setLongitude] = useState<any>()
const [latitude, setLatitude] = useState<any>(22.767024) const [latitude, setLatitude] = useState<any>()
const [markers, setMarkers] = useState<Market[]>([]) const [markers, setMarkers] = useState<Market[]>([])
const [scale, setScale] = useState<any>(12) const [scale, setScale] = useState<any>(12)
const [keywords, setKeywords] = useState<string>('') const [keywords, setKeywords] = useState<string>('')
@@ -110,6 +110,7 @@ function Home() {
const res = await Taro.getLocation({ const res = await Taro.getLocation({
type: 'gcj02' //返回可以用于wx.openLocation的经纬度 type: 'gcj02' //返回可以用于wx.openLocation的经纬度
}) })
if (res.latitude) { if (res.latitude) {
setLatitude(res.latitude) setLatitude(res.latitude)
} }
@@ -145,10 +146,12 @@ function Home() {
reload(); reload();
} }
const pageHjmCarByMap = (latitude?: any, longitude?: any) => { const pageHjmCarByMap = async (latitude?: any, longitude?: any) => {
// 搜索条件 // 搜索条件
const where = {} const where = {}
const user = await getUserInfo();
// 交警和邮管不能在小程序主界面地图上看到任何一个车辆的定位 // 交警和邮管不能在小程序主界面地图上看到任何一个车辆的定位
if(Taro.getStorageSync('RoleCode') == 'jiaojing' || Taro.getStorageSync('RoleCode') == 'youzheng'){ if(Taro.getStorageSync('RoleCode') == 'jiaojing' || Taro.getStorageSync('RoleCode') == 'youzheng'){
return false return false
@@ -165,19 +168,19 @@ function Home() {
const roleCode = Taro.getStorageSync('RoleCode'); const roleCode = Taro.getStorageSync('RoleCode');
if (roleCode == 'kuaidiyuan') { if (roleCode == 'kuaidiyuan') {
// @ts-ignore // @ts-ignore
where.driverId = Taro.getStorageSync('UserId') where.driverId = user.userId;
} }
if (roleCode == 'zhandian') { if (roleCode == 'zhandian') {
// @ts-ignore // @ts-ignore
where.organizationId = Taro.getStorageSync('OrganizationId'); where.organizationId = user.organizationId;
} }
if (roleCode == 'kuaidi') { if (roleCode == 'kuaidi') {
// @ts-ignore // @ts-ignore
where.organizationParentId = Taro.getStorageSync('OrganizationParentId'); where.organizationParentId = user.organizationId;
} }
pageByQQMap(where).then(res => { pageByQQMap(where).then(res => {
console.log(res, 'pageByQQMap') console.log(res?.count, 'pageByQQMap')
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 = []
@@ -323,11 +326,6 @@ function Home() {
} }
}).catch(() => { }).catch(() => {
setIsLogin(false); setIsLogin(false);
setMarkers([{
id: 123,
latitude: latitude,
longitude: longitude
}])
console.log('未登录') console.log('未登录')
}); });
} }

View File

@@ -57,8 +57,10 @@ const UserCell = () => {
/> />
</Cell.Group> </Cell.Group>
{ {
(roleName === 'kuaidi' || roleName == 'zhandian') && ( (roleName === 'kuaidi' || roleName == 'zhandian' || roleName == 'youzheng') && (
<> <>
{
roleName != 'youzheng' && (
<Cell.Group divider={true}> <Cell.Group divider={true}>
<Cell <Cell
className="nutui-cell-clickable" className="nutui-cell-clickable"
@@ -75,6 +77,8 @@ const UserCell = () => {
}} }}
/> />
</Cell.Group> </Cell.Group>
)
}
<Cell.Group divider={true}> <Cell.Group divider={true}>
<Cell <Cell
className="nutui-cell-clickable" className="nutui-cell-clickable"