修复:已知问题

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

View File

@@ -28,8 +28,8 @@ function Home() {
const [isAdmin, setIsAdmin] = useState<boolean>(false)
const [search, setSearch] = useState(false)
const [userInfo, setUserInfo] = useState<User>()
const [longitude, setLongitude] = useState<any>(108.374959)
const [latitude, setLatitude] = useState<any>(22.767024)
const [longitude, setLongitude] = useState<any>()
const [latitude, setLatitude] = useState<any>()
const [markers, setMarkers] = useState<Market[]>([])
const [scale, setScale] = useState<any>(12)
const [keywords, setKeywords] = useState<string>('')
@@ -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('未登录')
});
}