uu
This commit is contained in:
parent
9e5ff8dc57
commit
ed71aaab08
@ -18,6 +18,11 @@ export const getCurrentAppInfo = ()=> {
|
|||||||
resolve(widgetInfo)
|
resolve(widgetInfo)
|
||||||
});
|
});
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef APP-PLUS
|
||||||
|
// TODO MOCK数据
|
||||||
|
resolve({})
|
||||||
|
// #endif
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,12 +110,17 @@ const compareInfo = (curAppInfo, lastAppInfo)=> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const checkUpdate = async ()=> {
|
export const getCompareVersion = async()=> {
|
||||||
let curAppInfo = await getCurrentAppInfo()
|
let curAppInfo = await getCurrentAppInfo()
|
||||||
let lastAppInfo = await getLastAppInfo(curAppInfo)
|
let lastAppInfo = await getLastAppInfo(curAppInfo)
|
||||||
let cmpRes = await compareInfo(curAppInfo, lastAppInfo)
|
let cmpRes = await compareInfo(curAppInfo, lastAppInfo)
|
||||||
console.log("checkUpdate cmpRes ====", cmpRes)
|
console.log("checkUpdate cmpRes ====", cmpRes)
|
||||||
if(cmpRes.hasNewVersion && cmpRes.url) {
|
return cmpRes
|
||||||
|
}
|
||||||
|
|
||||||
|
export const checkUpdate = async ()=> {
|
||||||
|
let cmpRes = await getCompareVersion()
|
||||||
|
if(cmpRes.hasNewVersion) {
|
||||||
let fmBl = await confirmModal(`app最新版本:${cmpRes.lastAppInfo.version}.${cmpRes.lastAppInfo.versionCode}, 是否更新?`)
|
let fmBl = await confirmModal(`app最新版本:${cmpRes.lastAppInfo.version}.${cmpRes.lastAppInfo.versionCode}, 是否更新?`)
|
||||||
if(fmBl) {
|
if(fmBl) {
|
||||||
await installNewApk(cmpRes.url)
|
await installNewApk(cmpRes.url)
|
||||||
|
|||||||
@ -58,14 +58,19 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="blk-mdl">
|
<view class="blk-mdl">
|
||||||
<view v-if="isAppChannel">
|
<view >
|
||||||
<u-row @click="handleCheckAppVersion" custom-style="padding: 30rpx;" justify="between">
|
<u-row @click="handleCheckAppVersion" custom-style="padding: 30rpx;" justify="between">
|
||||||
<u-row>
|
<u-row>
|
||||||
<u-image :src="getCdnUrl(`mine/banbenup.png`)" height="34" width="34"></u-image>
|
<u-image :src="getCdnUrl(`mine/banbenup.png`)" height="34" width="34"></u-image>
|
||||||
<u-text margin="0 0 0 30rpx" text="版本更新" size="28" color="#333"></u-text>
|
<u-text margin="0 0 0 30rpx" text="版本更新" size="28" color="#333"></u-text>
|
||||||
</u-row>
|
</u-row>
|
||||||
<u-row>
|
<u-row>
|
||||||
<u-text margin="0 10rpx 0 0" :text="curAppVersion" size="28" color="#666"></u-text>
|
<view>
|
||||||
|
<view v-if="chkVRes.hasNewVersion" class="com-tag-grey">
|
||||||
|
<text class="clr-prm">新版本</text>
|
||||||
|
</view>
|
||||||
|
<u-text v-else margin="0 10rpx 0 0" :text="curAppVersion" size="28" color="#666"></u-text>
|
||||||
|
</view>
|
||||||
<u-icon name="arrow-right" size="32" color="#333"></u-icon>
|
<u-icon name="arrow-right" size="32" color="#333"></u-icon>
|
||||||
</u-row>
|
</u-row>
|
||||||
</u-row>
|
</u-row>
|
||||||
@ -135,7 +140,7 @@
|
|||||||
import * as apiService from "@/common/api"
|
import * as apiService from "@/common/api"
|
||||||
import { setSessionSystemInfo, getSessionSystemInfo } from "@/session"
|
import { setSessionSystemInfo, getSessionSystemInfo } from "@/session"
|
||||||
import { getAuthList, authCodeEnum } from "@/common/authCode"
|
import { getAuthList, authCodeEnum } from "@/common/authCode"
|
||||||
import { getCurrentAppInfo, getSystemInfo, checkUpdate } from "@/common/appUpdate"
|
import { getCurrentAppInfo, getSystemInfo, checkUpdate, getCompareVersion } from "@/common/appUpdate"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
@ -173,6 +178,7 @@
|
|||||||
},
|
},
|
||||||
saomiao: true,
|
saomiao: true,
|
||||||
curAppVersion: '',
|
curAppVersion: '',
|
||||||
|
chkVRes: {},
|
||||||
curDeviceId: '',
|
curDeviceId: '',
|
||||||
hongWaiSwitch,
|
hongWaiSwitch,
|
||||||
}
|
}
|
||||||
@ -194,6 +200,8 @@
|
|||||||
this.curDeviceId = getSystemInfo()?.deviceId
|
this.curDeviceId = getSystemInfo()?.deviceId
|
||||||
let appRes = await getCurrentAppInfo()
|
let appRes = await getCurrentAppInfo()
|
||||||
this.curAppVersion = appRes._appVersion
|
this.curAppVersion = appRes._appVersion
|
||||||
|
this.chkVRes = await getCompareVersion()
|
||||||
|
|
||||||
},
|
},
|
||||||
async getAppHomeStatData(){
|
async getAppHomeStatData(){
|
||||||
let res = await apiService.getAppHomeStatData()
|
let res = await apiService.getAppHomeStatData()
|
||||||
@ -205,7 +213,7 @@
|
|||||||
},
|
},
|
||||||
async handleCheckAppVersion() {
|
async handleCheckAppVersion() {
|
||||||
let ckRes = await checkUpdate()
|
let ckRes = await checkUpdate()
|
||||||
if(!(ckRes.hasNewVersion && ckRes.url)) {
|
if(!(ckRes.hasNewVersion)) {
|
||||||
this.showToast('已经是最新版本,无需更新')
|
this.showToast('已经是最新版本,无需更新')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user