更新图标,更换提示
This commit is contained in:
parent
17fb49e90c
commit
4742833c49
Binary file not shown.
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 138 KiB |
Binary file not shown.
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 214 KiB |
@ -34,7 +34,7 @@ const loadMP = async (id) => {
|
||||
console.log(mp, uni);
|
||||
// return ;
|
||||
uni.showLoading({
|
||||
title: '下载中...',
|
||||
title: '初始化中...',
|
||||
mask: true
|
||||
})
|
||||
mp.getUniMPVersion(id, (ret) => {
|
||||
@ -50,11 +50,11 @@ const loadMP = async (id) => {
|
||||
let count = 0;
|
||||
timer = setInterval(() => {
|
||||
if (count < 100) uni.showLoading({
|
||||
title: `下载中... ${count}%`,
|
||||
title: `初始化中... ${count}%`,
|
||||
mask: true
|
||||
})
|
||||
else uni.showLoading({
|
||||
title: '安装中...',
|
||||
title: '初始化中...100%',
|
||||
mask: true
|
||||
})
|
||||
}, 600)
|
||||
@ -62,12 +62,17 @@ const loadMP = async (id) => {
|
||||
url: info.data.version_info?.dow_url,
|
||||
success(res) {
|
||||
wgtFile = res.tempFilePath;
|
||||
console.log('下载完成', wgtFile);
|
||||
console.log('初始化完成', wgtFile);
|
||||
installMP();
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
uni.hideLoading();
|
||||
}
|
||||
});
|
||||
downloadTask.onProgressUpdate((res) => {
|
||||
// console.log('下载进度' + res.progress);
|
||||
// console.log('初始化进度' + res.progress);
|
||||
if (res.progress > count) count += 10;
|
||||
if (count >= 90) {
|
||||
clearInterval(timer);
|
||||
@ -88,22 +93,10 @@ const getVersion = (id) => {
|
||||
});
|
||||
})
|
||||
}
|
||||
// 安装小程序
|
||||
// 初始化小程序
|
||||
const installMP = () => {
|
||||
mp.getUniMPVersion(appid, (ret) => {
|
||||
console.log('安装:供销', ret);
|
||||
doInstallMP();
|
||||
// if (0 != ret.code) { //获取失败时安装应用
|
||||
// doInstallMP();
|
||||
// } else {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: 'uni小程序已安装,是否覆盖?',
|
||||
// success: res => {
|
||||
// res.confirm && doInstallMP();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
console.log('getUniMPVersion: ' + JSON.stringify(ret));
|
||||
});
|
||||
};
|
||||
@ -113,20 +106,18 @@ const doInstallMP = () => {
|
||||
wgtFile: wgtFile
|
||||
}, (r) => {
|
||||
if (0 == r.code) {
|
||||
// uni.showToast({
|
||||
// title: '安装成功'
|
||||
// });
|
||||
console.log('小程序安装成功');
|
||||
open();
|
||||
} else {
|
||||
uni.hideLoading();
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
uni.showModal({
|
||||
title: '安装失败',
|
||||
title: '初始化失败',
|
||||
content: JSON.stringify(r),
|
||||
showCancel: false
|
||||
});
|
||||
}
|
||||
console.log('安装供销: ' + JSON.stringify(r));
|
||||
console.log('初始化供销: ' + JSON.stringify(r));
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user