diff --git a/static/applet/gx_app.png b/static/applet/gx_app.png index 6d0c19b..91c8468 100644 Binary files a/static/applet/gx_app.png and b/static/applet/gx_app.png differ diff --git a/static/applet/shop_app.png b/static/applet/shop_app.png index 370e6ed..a3388c6 100644 Binary files a/static/applet/shop_app.png and b/static/applet/shop_app.png differ diff --git a/utils/uniMP.js b/utils/uniMP.js index 0bd86ef..ac28b4e 100644 --- a/utils/uniMP.js +++ b/utils/uniMP.js @@ -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)); }); };