h5app怎么实现整包升级?
h5app怎么实现整包升级?h5app怎么实现整包升级?
1条回答 默认 最新
- 北海屿鹿 2023-03-28 09:38关注
// APP整包更新 //#ifdef APP-PLUS let thatProgress=this; console.log(thatProgress.progress) let server = this.constant.baseUrl+"/system-service/api/app/update"; //检查更新地址 plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) { uni.request({ url: server+'?version='+widgetInfo.version+'&appid='+widgetInfo.appid, method:'POST', success: (res) => { console.log(res) let data=res.data if (data.code === 200 && data.data.update) { uni.showModal({ //提醒用户更新 title: "更新提示", content: data.data.note, cancelText:'立即更新', confirmText:'取消', success: (result) => { if (result.cancel) { var task=plus.downloader.createDownload( data.data.pkgUrl, {}, function(download,status){ //安装到手机的目录 if ( status == 200 ) { plus.runtime.install(download.filename); // 安装下载的apk文件 } else { mui.toast("下载更新失败!"); plus.nativeUI.closeWaiting(); } }); var showLoading = plus.nativeUI.showWaiting("正在下载"); //监听下载 task.addEventListener("statechanged", function (download, status) { // console.log(download.state) // console.log(task.downloadedSize) switch (download.state) { case 2: showLoading.showWaiting("正在下载..."); break; case 3: //进度条百分比 totalSize为总量,baifen为当前下载的百分比 let prg = parseInt( (parseFloat(task.downloadedSize) /parseFloat(task.totalSize)) *100 ); showLoading.setTitle("下载进度" +prg + "% "); if(prg==100){ plus.nativeUI.closeWaiting() } break; case 4: mui.toast("下载完成"); plus.nativeUI.closeWaiting(); break; } }); task.start(); } } }) } }, fail: (res) =>{ console.log(res) uni.showToast({ title:res.message, icon:'none' }) } }); });
解决 1无用
悬赏问题
- ¥200 关于#c++#的问题,请各位专家解答!
- ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
- ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
- ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
- ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
- ¥20 腾讯企业邮箱邮件可以恢复么
- ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
- ¥15 错误 LNK2001 无法解析的外部符号
- ¥50 安装pyaudiokits失败
- ¥15 计组这些题应该咋做呀