From a59ff44b2eaa7020f0529632d9ec064c4dc38e27 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期二, 28 四月 2026 22:08:46 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/gtzxinglijicun
---
app/App.vue | 43 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/app/App.vue b/app/App.vue
index 12bc3d4..237c93d 100644
--- a/app/App.vue
+++ b/app/App.vue
@@ -24,6 +24,7 @@
onLaunch: function() {
this.initJPush()
this.checkAndStartLocationPolling()
+ this.checkAppUpdate()
},
onShow: function() {
console.log('App Show')
@@ -128,13 +129,53 @@
uni.getLocation({
type: 'gcj02',
success: (res) => {
- console.log(res)
this.$u.api.updateLocation({
latitude: res.latitude,
longitude: res.longitude
})
}
})
+ },
+
+ compareVersion(localVersion, serverVersion) {
+ const v1 = localVersion.split('.')
+ const v2 = serverVersion.split('.')
+ for (let i = 0; i < Math.max(v1.length, v2.length); i++) {
+ const n1 = parseInt(v1[i] || 0)
+ const n2 = parseInt(v2[i] || 0)
+ if (n1 < n2) return -1
+ if (n1 > n2) return 1
+ }
+ return 0
+ },
+
+ checkAppUpdate() {
+ this.$u.api.getApiVersion({ type: 0 }).then(res => {
+ if (res.code === 200 && res.data) {
+ const localVersionCode = plus.runtime.versionCode
+ const serverVersionCode = res.data.versionCode
+ if (serverVersionCode && localVersionCode < serverVersionCode) {
+ const isForce = res.data.isForce === 1
+ uni.showModal({
+ title: '鍙戠幇鏂扮増鏈�',
+ content: res.data.versionInfo || '鏈夋柊鐗堟湰鍙敤锛屾槸鍚︾珛鍗虫洿鏂帮紵',
+ showCancel: !isForce,
+ cancelText: isForce ? '' : '鏆備笉鏇存柊',
+ confirmText: '绔嬪嵆鏇存柊',
+ success: (modalRes) => {
+ if (modalRes.confirm) {
+ if (res.data.fileUrl) {
+ plus.runtime.openURL(res.data.fileUrl)
+ }
+ }
+ if (isForce && modalRes.cancel) {
+ this.checkAppUpdate()
+ }
+ }
+ })
+ }
+ }
+ })
}
}
}
--
Gitblit v1.9.3