Commit dffe0a18 authored by Damon's avatar Damon

env

parents 7d8ca475 26f11c2b
......@@ -70,8 +70,6 @@ export default {
// 应用初始化(全局只触发一次)
AnalysysAgent.registerSuperProperty("platform", "self-support");
this.getSystemInfo();
// 版本更新
await this.updateApp();
// 系统自动登录::每次运行小程序重新获取用户信息
await this.autoLogin();
......@@ -79,6 +77,8 @@ export default {
//this.deleteTempImg()
},
onShow: async function () {
// 版本更新
await this.updateApp();
// 应用启动,或从后台进入前台显示
if (this.uploadTask.length > 0) {
upload.uploadImageTask(this)
......@@ -168,11 +168,13 @@ export default {
/* 版本更新 */
async updateApp() {
if (uni.canIUse('getUpdateManager')) {
// 版本更新
const updateManager = uni.getUpdateManager();
updateManager.onCheckForUpdate(function (res) {
// 请求完新版本信息的回调
console.log("update", res)
});
updateManager.onUpdateReady(function (res) {
......@@ -182,7 +184,16 @@ export default {
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
updateManager.applyUpdate()
} else if (res.cancel) {
//如果需要强制更新,则给出二次弹窗
uni.showModal({
title: '温馨提示~',
content: '本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦~',
success: function (res) {
updateManager.applyUpdate()
}
})
}
},
});
......@@ -190,7 +201,17 @@ export default {
updateManager.onUpdateFailed(function (res) {
// 新的版本下载失败
uni.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
})
});
} else {
uni.showModal({
title: '提示',
content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})
}
},
/* ------------------------- 数据埋点begin ------------------------------ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment