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