|
|
@@ -158,9 +158,18 @@
|
|
|
success: (res) => {
|
|
|
console.log(res)
|
|
|
if (res.statusCode === 200) {
|
|
|
- console.log('下载成功');
|
|
|
- console.log('安装包下载成功,即将安装:' + JSON.stringify(res, null, 4));
|
|
|
- plus.runtime.openFile(res.tempFilePath);
|
|
|
+ console.log('安装包下载成功,即将安装:' + res.tempFilePath);
|
|
|
+ // 调起系统安装器安装 apk(需在系统设置中允许本应用“安装未知应用”)
|
|
|
+ plus.runtime.install(res.tempFilePath, { force: false }, () => {
|
|
|
+ console.log('已调起安装')
|
|
|
+ }, (e) => {
|
|
|
+ console.log('安装失败:', e)
|
|
|
+ uni.showModal({
|
|
|
+ title: '安装失败',
|
|
|
+ content: '请在系统设置中允许本应用“安装未知应用”权限后重试',
|
|
|
+ showCancel: false
|
|
|
+ })
|
|
|
+ })
|
|
|
this.showA = false
|
|
|
this.isShow = false
|
|
|
}
|
|
|
@@ -176,7 +185,6 @@
|
|
|
this.percentNum = res.progress
|
|
|
if (res.progress == 100) {
|
|
|
console.log('下载完成了')
|
|
|
- plus.runtime.quit();
|
|
|
}
|
|
|
});
|
|
|
},
|