From d815574e974b84893956626c6719f19ec1ececf2 Mon Sep 17 00:00:00 2001 From: aihe <961836564@qq.com> Date: Sun, 16 Jun 2024 02:31:52 +0800 Subject: [PATCH] uu --- common/appUpdate/index.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/common/appUpdate/index.js b/common/appUpdate/index.js index a181e28..0e87c14 100644 --- a/common/appUpdate/index.js +++ b/common/appUpdate/index.js @@ -21,10 +21,12 @@ export const getCurrentAppInfo = ()=> { } const installNewApk = (url)=> { + console.log("installNewApk url===", url) return new Promise((resolve, reject)=> { let downInstance = uni.downloadFile({ url: url, success: (downloadResult) => { + console.log("===downloadResult===", downloadResult) hideLoading() if (downloadResult.statusCode === 200) { showLoading('正在安装...') @@ -41,11 +43,13 @@ const installNewApk = (url)=> { reject() }); } else { + showToast(`文件下载失败, 错误码:${downloadResult.statusCode}`) reject() } }, fail: (err)=> { - console.log('download file err...', err); + console.log('download file err...', err); + showToast("文件下载失败") hideLoading() } }); @@ -61,8 +65,8 @@ const getLastAppInfo = async (curAppInfo)=> { return { version: '1.0.1', versionCode: 101, - apkUrl: '', - wgtUrl: '', + apkUrl: 'http://localhost:5173/static/t.apk?t.apk', + wgtUrl: 'http://localhost:5173/static/t.wgt?t.wgt', // whiteDeviceIds: ['F9E778C90D0E9A8DA9D95AA97B00A3FB'], } } @@ -97,8 +101,9 @@ export const checkUpdate = async ()=> { let curAppInfo = await getCurrentAppInfo() let lastAppInfo = await getLastAppInfo(curAppInfo) let cmpRes = await compareInfo(curAppInfo, lastAppInfo) + console.log("checkUpdate cmpRes ====", cmpRes) if(cmpRes.hasNewVersion) { - let fmBl = confirmModal(`app最新版本:${cmpRes.lastAppInfo.version}.${cmpRes.lastAppInfo.versionCode}, 是否更新?`) + let fmBl = await confirmModal(`app最新版本:${cmpRes.lastAppInfo.version}.${cmpRes.lastAppInfo.versionCode}, 是否更新?`) if(fmBl) { await installNewApk(cmpRes.url) }