|
|
|
@ -16,7 +16,7 @@ onLaunch(async () => {
|
|
|
|
|
appId: 'com.chanko.yunxi.mes.android'
|
|
|
|
|
}
|
|
|
|
|
const res = await appUpdateApi(params)
|
|
|
|
|
console.log('1-0', res.versionId)
|
|
|
|
|
console.log('1-0', res,res.versionId)
|
|
|
|
|
plus.runtime.getProperty(plus.runtime.appid, function (wgtinfo) {
|
|
|
|
|
const version = wgtinfo.version || plus.runtime.version
|
|
|
|
|
console.log('1-1', res.versionId,version)
|
|
|
|
@ -26,9 +26,10 @@ onLaunch(async () => {
|
|
|
|
|
showCancel: false,
|
|
|
|
|
confirmText: '立即更新',
|
|
|
|
|
content: res.remark || 'APP有新版本发布,点击 立即更新 进行最新版本下载。',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
onSureClick(res.url)
|
|
|
|
|
success: (res2) => {
|
|
|
|
|
if (res2.confirm) {
|
|
|
|
|
console.log(999,res.url)
|
|
|
|
|
plus.runtime.openURL(res.url)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
@ -44,30 +45,6 @@ onShow(async () => {
|
|
|
|
|
onHide(() => {
|
|
|
|
|
console.log('App Hide')
|
|
|
|
|
})
|
|
|
|
|
const onSureClick = (upDataUrl) => {
|
|
|
|
|
var downloadTask = uni.downloadFile({
|
|
|
|
|
url: upDataUrl,
|
|
|
|
|
success: (downloadResult) => {
|
|
|
|
|
if (downloadResult.statusCode === 200) {
|
|
|
|
|
plus.runtime.install(downloadResult.tempFilePath, {
|
|
|
|
|
force: false
|
|
|
|
|
}, function () {
|
|
|
|
|
plus.runtime.restart();
|
|
|
|
|
}, (e) => {
|
|
|
|
|
console.log(e)
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '安装升级包失败',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 下载进度变化事件的监听函数
|
|
|
|
|
downloadTask.onProgressUpdate((e) => {
|
|
|
|
|
//
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|