注释定位失败提示代码
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -514,34 +514,34 @@ const getCurrentLocation = () => {
|
|||||||
isLocating.value = false
|
isLocating.value = false
|
||||||
|
|
||||||
// 根据错误类型给出不同提示
|
// 根据错误类型给出不同提示
|
||||||
let errorMsg = '定位失败'
|
// let errorMsg = '定位失败'
|
||||||
if (err.errMsg.includes('auth deny')) {
|
// if (err.errMsg.includes('auth deny')) {
|
||||||
errorMsg = '定位权限被拒绝,请在设置中开启'
|
// errorMsg = '定位权限被拒绝,请在设置中开启'
|
||||||
} else if (err.errMsg.includes('timeout')) {
|
// } else if (err.errMsg.includes('timeout')) {
|
||||||
errorMsg = '定位超时,请重试'
|
// errorMsg = '定位超时,请重试'
|
||||||
} else if (err.errMsg.includes('network')) {
|
// } else if (err.errMsg.includes('network')) {
|
||||||
errorMsg = '网络异常,请检查网络连接'
|
// errorMsg = '网络异常,请检查网络连接'
|
||||||
}
|
// }
|
||||||
|
|
||||||
uni.showModal({
|
// uni.showModal({
|
||||||
title: '定位失败',
|
// title: '定位失败',
|
||||||
content: errorMsg + ',是否使用默认位置?',
|
// content: errorMsg + ',是否使用默认位置?',
|
||||||
confirmText: '使用默认位置',
|
// confirmText: '使用默认位置',
|
||||||
cancelText: '重试',
|
// cancelText: '重试',
|
||||||
success: (modalRes) => {
|
// success: (modalRes) => {
|
||||||
if (modalRes.confirm) {
|
// if (modalRes.confirm) {
|
||||||
// 使用默认位置(北京)
|
// // 使用默认位置(北京)
|
||||||
longitude.value = 116.397428
|
// longitude.value = 116.397428
|
||||||
latitude.value = 39.90923
|
// latitude.value = 39.90923
|
||||||
reverseGeocode(longitude.value, latitude.value)
|
// reverseGeocode(longitude.value, latitude.value)
|
||||||
} else {
|
// } else {
|
||||||
// 重试定位
|
// // 重试定位
|
||||||
setTimeout(() => {
|
// setTimeout(() => {
|
||||||
getCurrentLocation()
|
// getCurrentLocation()
|
||||||
}, 2000)
|
// }, 2000)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ function handleControl(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
$api.msg('使用模拟定位');
|
// $api.msg('使用模拟定位');
|
||||||
getInit();
|
getInit();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const useLocationStore = defineStore("location", () => {
|
|||||||
}
|
}
|
||||||
longitudeVal.value = resd.longitude
|
longitudeVal.value = resd.longitude
|
||||||
latitudeVal.value = resd.latitude
|
latitudeVal.value = resd.latitude
|
||||||
msg('用户位置获取失败,使用模拟定位')
|
// msg('用户位置获取失败,使用模拟定位')
|
||||||
resole(resd)
|
resole(resd)
|
||||||
},
|
},
|
||||||
complete: function(e) {
|
complete: function(e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user