完成HBY102

This commit is contained in:
liub
2025-11-17 15:30:57 +08:00
parent cb9ed0b1da
commit 18fd446b07
8 changed files with 164 additions and 51 deletions

View File

@ -1,7 +1,7 @@
import request, {
baseURL
} from '@/utils/request.js'
import Common from '@/utils/Common.js'
/**
* 检查并执行wgt热更新
* @param {String} updateUrl - 检查更新的接口地址
@ -178,10 +178,20 @@ function downloadAndInstallWgt(wgtUrl) {
var wating = plus.nativeUI.showWaiting({
title: "下载中0%"
});
// uni.showLoading({
// title: '更新下载中...',
// mask: true
// });
//手动更新
let ManualUpdate=()=>{
setTimeout(()=>{
let url=Common.getOSAndUpload().url
plus.runtime.openURL(url, (res) => {
uni.showToast({
title: '打开失败',
icon: 'none'
});
});
},1000);
}
// 1. 下载wgt包
const downloadTask = uni.downloadFile({
@ -219,20 +229,22 @@ function downloadAndInstallWgt(wgtUrl) {
wating.close();
uni.showToast({
title: '安装失败: ' + error.message,
title: '安装失败,请手动下载更新;' + error.message,
icon: 'none',
duration: 3000
});
console.error('wgt安装失败:', error);
ManualUpdate();
});
} else {
wating.close();
uni.showToast({
title: '下载失败',
title: '下载失败,请手动下载更新;',
icon: 'none',
duration: 2000
});
ManualUpdate();
}
},
fail: (err) => {
@ -243,6 +255,7 @@ function downloadAndInstallWgt(wgtUrl) {
duration: 2000
});
console.error('wgt下载失败:', err);
ManualUpdate();
}
});