Browse Source

取消自动更新

master
parent
commit
256d2bee18
  1. 99
      App.vue
  2. 4
      config.js
  3. 6
      pages/index.vue
  4. 5
      pages/owner.vue

99
App.vue

@ -9,37 +9,7 @@ export default {
await this.initApp()
},
onShow() {
const updateManager = uni.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
//
// console.log(res.hasUpdate)
})
updateManager.onUpdateReady(function (res) {
uni.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
showCancel: false,
success(res) {
if (res.confirm) {
// applyUpdate
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function (res) {
//
console.log('download error')
uni.showModal({
title: '提示',
content:
'新版小程序下载失败\n请自行退出程序,手动卸载本程序,再运行',
confirmText: '知道了'
})
})
// this.autoUpdate()
},
methods: {
//
@ -60,6 +30,73 @@ export default {
console.error('获取设备信息失败:', err)
}
})
},
autoUpdate() {
//
if (uni.canIUse('getUpdateManager')) {
//
const updateManager = uni.getUpdateManager()
//1.
updateManager.onCheckForUpdate(res => {
//
if (res.hasUpdate) {
//
uni.showModal({
title: '更新提示',
content: '检测到新版本,是否下载新版本并重启小程序?',
success: res => {
if (res.confirm) {
//2.
this.downLoadAndUpdate(updateManager)
} else if (res.cancel) {
//
uni.showModal({
title: '温馨提示',
content:
'本次版本更新涉及到新的功能添加,旧版本无法正常访问的哦',
showCancel: false, //
confirmText: '确定更新', //
success: res => {
if (res.confirm) {
//
this.downLoadAndUpdate(updateManager)
}
}
})
}
}
})
}
})
} else {
//
uni.showModal({
title: '提示',
content:
'当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
})
}
},
/**
* 下载小程序新版本并重启应用
*/
downLoadAndUpdate(updateManager) {
uni.showLoading()
//
updateManager.onUpdateReady(() => {
uni.hideLoading()
// applyUpdate
updateManager.applyUpdate()
})
//
updateManager.onUpdateFailed(() => {
//
uni.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
})
})
}
}
}

4
config.js

@ -2,8 +2,8 @@
module.exports = {
// baseUrl: 'http://188.188.5.188:48080',
// baseUrl: 'https://www.jzce.com',
// baseUrl: 'https://yxsthj.cn',
baseUrl: 'http://188.188.3.232:48080',
baseUrl: 'https://yxsthj.cn',
// baseUrl: 'http://188.188.3.232:48080',
// baseUrl: 'http://localhost:48080',
baseApi: '/admin-api',
// 应用信息

6
pages/index.vue

@ -34,9 +34,6 @@
:refresher-triggered="refresherTriggered"
@refresherpulling="refresherpulling"
>
<view class="box row-1">
<view
class="wd-flex"
@ -83,7 +80,8 @@
<view style="color: #4b5675">企业数量</view>
</view>
</view>
<cs-emty marginTop="0"
<cs-emty
marginTop="0"
v-if="detail.enterpriseCount == 0"
height="288rpx"
></cs-emty>

5
pages/owner.vue

@ -137,6 +137,7 @@
<button
class="section wd-flex wd-flex-row wd-justify-between"
@click="btnJobInfo"
v-if="isLeader()"
>
<view class="wd-flex wd-flex-row" style="gap: 8rpx">
<u--image
@ -236,7 +237,6 @@ export default {
url: '/sub/owner/edit'
})
},
invite() {
this.share = {
title: '邀请企业入驻', //
@ -248,6 +248,9 @@ export default {
uni.makePhoneCall({
phoneNumber: '04167230123'
})
},
isLeader() {
return this.$roles.checkRole(['director'])
}
}
}

Loading…
Cancel
Save