增加区表 热更新

This commit is contained in:
zhangwentao 2024-11-27 17:24:19 +08:00
parent 6e4f5cfce6
commit 58bfa671e8
4 changed files with 15383 additions and 15704 deletions

View File

@ -1,4 +1,7 @@
<script>
import {
VersionUpdate
} from '@/utils/lib/tool.js'
export default {
onLaunch: function() {
console.log('App Launch')
@ -10,6 +13,10 @@
// this.$tool.update()
//
// #endif
// #ifdef MP-WEIXIN
VersionUpdate()
// #endif
},
onShow: function() {
console.log('App Show')

View File

@ -2089,6 +2089,14 @@ var areaData = [
"label": "太和区",
"value": "210711"
},
{
"label": "高新区",
"value": "210712"
},
{
"label": "经开区",
"value": "210713"
},
{
"label": "黑山县",
"value": "210726"

File diff suppressed because it is too large Load Diff

View File

@ -77,4 +77,66 @@ export default {
// #endif
},
}
// 检测小程序是否更新
export const VersionUpdate = () => {
// 判断应用的 getUpdateManager 是否在当前版本可用
console.log(uni.canIUse('getUpdateManager'));
if (uni.canIUse('getUpdateManager')) {
const updateManager = uni.getUpdateManager()
// 向小程序后台请求完新版本信息
updateManager.onCheckForUpdate(function(res) {
if (res.hasUpdate) {
//小程序有新版本,静默下载新版本,新版本下载完成
updateManager.onUpdateReady(function() {
//模态弹窗(确认、取消)
uni.showModal({
title: '更新提示',
content: '小程序已发布新版本,是否重启?',
success: function(res) {
//用户点击确定
if (res.confirm) {
//当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启
updateManager.applyUpdate()
}
//用户点击取消
else if (res.cancel) {
//强制用户更新,弹出第二次弹窗
uni.showModal({
title: '提示',
content: '小程序已发布新版本,是否重启',
showCancel: false, //隐藏取消按钮
success: function(res) {
//第二次提示后,强制更新
if (res.confirm) {
// 当新版本下载完成,调用该方法会强制当前小程序应用上新版本并重启
updateManager.applyUpdate()
} else if (res.cancel) {
//重新回到版本更新提示
VersionUpdate()
}
},
})
}
},
})
})
// 当新版本下载失败
updateManager.onUpdateFailed(function() {
uni.showModal({
title: '提示',
content: '请您删除当前小程序,重新打开小程序',
})
})
}
})
} else {
// 提示用户在最新版本的客户端上体验
uni.showModal({
title: '温馨提示',
content: '当前微信版本过低,可能无法使用该功能,请升级到最新版本后重试。',
})
}
}