From ed71aaab087e3b4116d1b293e58d65280bbe5e33 Mon Sep 17 00:00:00 2001 From: aihe <961836564@qq.com> Date: Wed, 19 Jun 2024 15:57:49 +0800 Subject: [PATCH] uu --- common/appUpdate/index.js | 14 ++++++++++++-- main.js | 1 + pages/tabBar/mine/mine.vue | 16 ++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/common/appUpdate/index.js b/common/appUpdate/index.js index 1fe296b..43d646c 100644 --- a/common/appUpdate/index.js +++ b/common/appUpdate/index.js @@ -18,6 +18,11 @@ export const getCurrentAppInfo = ()=> { resolve(widgetInfo) }); // #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 lastAppInfo = await getLastAppInfo(curAppInfo) let cmpRes = await compareInfo(curAppInfo, lastAppInfo) 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}, 是否更新?`) if(fmBl) { await installNewApk(cmpRes.url) diff --git a/main.js b/main.js index 0466f10..06e8515 100644 --- a/main.js +++ b/main.js @@ -69,3 +69,4 @@ export function createApp() { } } // #endif + diff --git a/pages/tabBar/mine/mine.vue b/pages/tabBar/mine/mine.vue index c57ea97..9d7cfe8 100644 --- a/pages/tabBar/mine/mine.vue +++ b/pages/tabBar/mine/mine.vue @@ -58,14 +58,19 @@ - + - + + + 新版本 + + + @@ -135,7 +140,7 @@ import * as apiService from "@/common/api" import { setSessionSystemInfo, getSessionSystemInfo } from "@/session" import { getAuthList, authCodeEnum } from "@/common/authCode" - import { getCurrentAppInfo, getSystemInfo, checkUpdate } from "@/common/appUpdate" + import { getCurrentAppInfo, getSystemInfo, checkUpdate, getCompareVersion } from "@/common/appUpdate" export default { computed: { @@ -173,6 +178,7 @@ }, saomiao: true, curAppVersion: '', + chkVRes: {}, curDeviceId: '', hongWaiSwitch, } @@ -194,6 +200,8 @@ this.curDeviceId = getSystemInfo()?.deviceId let appRes = await getCurrentAppInfo() this.curAppVersion = appRes._appVersion + this.chkVRes = await getCompareVersion() + }, async getAppHomeStatData(){ let res = await apiService.getAppHomeStatData() @@ -205,7 +213,7 @@ }, async handleCheckAppVersion() { let ckRes = await checkUpdate() - if(!(ckRes.hasNewVersion && ckRes.url)) { + if(!(ckRes.hasNewVersion)) { this.showToast('已经是最新版本,无需更新') } },