提交 de2754a0 作者: 方治民

fix: 修复引导页没有正常关闭的问题

上级 0621e144
...@@ -12,24 +12,8 @@ ...@@ -12,24 +12,8 @@
}) })
onLoad(() => { onLoad(() => {
uni.getLocation({ // 关闭启动页并检查更新
type: 'wgs84', closeSplashscreenAndChechUpgrade()
success(res) {
pageData.weather.lon = res.longitude
pageData.weather.lat = res.latitude
uni.setStorageSync('location', {
// 缓存地址
lon: res.longitude,
lat: res.latitude,
})
},
fail() {
uni.showToast({
title: '获取地址失败,将导致部分功能不可用',
icon: 'none',
})
},
})
}) })
onShow(() => { onShow(() => {
...@@ -42,16 +26,24 @@ ...@@ -42,16 +26,24 @@
if (res.longitude === 0 || res.latitude === 0) { if (res.longitude === 0 || res.latitude === 0) {
return return
} }
pageData.weather.lon = res.longitude
pageData.weather.lat = res.latitude
uni.setStorageSync('location', {
// 缓存地址
lon: res.longitude,
lat: res.latitude,
})
model.location = `${res.longitude},${res.latitude}` model.location = `${res.longitude},${res.latitude}`
reloadWeather() reloadWeather()
}, },
fail(res) { fail(res) {
console.log('获取位置失败:', res) console.log('获取位置失败:', res)
reloadWeather() reloadWeather()
}, uni.showToast({
complete() { title: '获取地址失败,将导致部分功能不可用',
// 关闭启动页并检查更新 icon: 'none',
closeSplashscreenAndChechUpgrade() })
}, },
}) })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论