|
@@ -15,10 +15,10 @@
|
|
|
//console.log('App Launch')
|
|
//console.log('App Launch')
|
|
|
// 配置1秒后自动关闭启动页
|
|
// 配置1秒后自动关闭启动页
|
|
|
|
|
|
|
|
- console.log('Vue version:', Vue.version);
|
|
|
|
|
|
|
+ console.log('Vue version:~~~', Vue.version);
|
|
|
// #ifdef APP-PLUS
|
|
// #ifdef APP-PLUS
|
|
|
const apiInfo = uni.getStorageSync('apiInfo')
|
|
const apiInfo = uni.getStorageSync('apiInfo')
|
|
|
-
|
|
|
|
|
|
|
+ console.log('apiInfo:', apiInfo)
|
|
|
if (apiInfo.protocal) {
|
|
if (apiInfo.protocal) {
|
|
|
Vue.prototype.apiUrl = `${apiInfo.protocal}${apiInfo.hostname}:${apiInfo.port}/api`
|
|
Vue.prototype.apiUrl = `${apiInfo.protocal}${apiInfo.hostname}:${apiInfo.port}/api`
|
|
|
Vue.prototype.webviewUrl = `${apiInfo.protocal}${apiInfo.hostname}:${apiInfo.port}`
|
|
Vue.prototype.webviewUrl = `${apiInfo.protocal}${apiInfo.hostname}:${apiInfo.port}`
|
|
@@ -36,6 +36,7 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getLatestVersion().then(res => {
|
|
getLatestVersion().then(res => {
|
|
|
|
|
+ console.log('res:', res)
|
|
|
const {
|
|
const {
|
|
|
appVersion
|
|
appVersion
|
|
|
} = uni.getAppBaseInfo()
|
|
} = uni.getAppBaseInfo()
|
|
@@ -46,11 +47,11 @@
|
|
|
confirmText: '立即更新',
|
|
confirmText: '立即更新',
|
|
|
success: (val) => {
|
|
success: (val) => {
|
|
|
if (val.confirm) {
|
|
if (val.confirm) {
|
|
|
- uni.showLoading({
|
|
|
|
|
- title: "正在下载安装包...",
|
|
|
|
|
- mask: true,
|
|
|
|
|
- });
|
|
|
|
|
- uni.downloadFile({
|
|
|
|
|
|
|
+ // uni.showLoading({
|
|
|
|
|
+ // title: "正在下载安装包...",
|
|
|
|
|
+ // mask: true,
|
|
|
|
|
+ // });
|
|
|
|
|
+ const downloadTask = uni.downloadFile({
|
|
|
url: `${Vue.prototype.webviewUrl}/kd-aiot/${res.fileStorePath}`,
|
|
url: `${Vue.prototype.webviewUrl}/kd-aiot/${res.fileStorePath}`,
|
|
|
success: (data) => {
|
|
success: (data) => {
|
|
|
if (data.statusCode === 200) {
|
|
if (data.statusCode === 200) {
|
|
@@ -58,15 +59,15 @@
|
|
|
tempFilePath: data
|
|
tempFilePath: data
|
|
|
.tempFilePath,
|
|
.tempFilePath,
|
|
|
success: (saveRes) => {
|
|
success: (saveRes) => {
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '下载成功',
|
|
|
|
|
- icon: 'success'
|
|
|
|
|
- });
|
|
|
|
|
- uni.hideLoading();
|
|
|
|
|
- uni.showLoading({
|
|
|
|
|
- title: "正在更新...",
|
|
|
|
|
- mask: true,
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ // uni.showToast({
|
|
|
|
|
+ // title: '下载成功',
|
|
|
|
|
+ // icon: 'success'
|
|
|
|
|
+ // });
|
|
|
|
|
+ // uni.hideLoading();
|
|
|
|
|
+ // uni.showLoading({
|
|
|
|
|
+ // title: "正在更新...",
|
|
|
|
|
+ // mask: true,
|
|
|
|
|
+ // });
|
|
|
// 调用安装逻辑
|
|
// 调用安装逻辑
|
|
|
plus.runtime.install(
|
|
plus.runtime.install(
|
|
|
saveRes
|
|
saveRes
|
|
@@ -91,11 +92,32 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ downloadTask.onProgressUpdate((res) => {
|
|
|
|
|
+ console.log('下载进度:', res)
|
|
|
|
|
+ // uni.showModal({
|
|
|
|
|
+ // content: '下载进度:' + res.progress + '%',
|
|
|
|
|
+ // showCancel: false,
|
|
|
|
|
+ // success: (val) => {
|
|
|
|
|
+ // if (val.confirm) {
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ uni.showLoading({
|
|
|
|
|
+ title: "正在下载安装包: " + res.progress + "%",
|
|
|
|
|
+ mask: true,
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ if (res.progress == 100) {
|
|
|
|
|
+ uni.hideLoading();
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ }).catch(err => {
|
|
|
|
|
+ console.log('err:', err)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
|