版本更新

This commit is contained in:
唐明明
2022-06-11 13:53:54 +08:00
parent bfed17d7d6
commit 45288f7470
12 changed files with 9541 additions and 16526 deletions

View File

@@ -91,7 +91,7 @@
意见反馈
<uni-icons class="forward" type="forward" color="#999" />
</view>
<view class="btns-box-item">
<view class="btns-box-item" @click="updateApp">
<image class="icon" src="@/static/user/userIcon_03.png" mode="widthFix" />
版本更新
<uni-icons class="forward" type="forward" color="#999" />
@@ -125,7 +125,9 @@
info,
chainSeed
} from '@/apis/interfaces/user';
import {
getVersions
} from '@/apis/interfaces/versions.js'
export default {
data() {
return {
@@ -233,7 +235,72 @@
})
}
});
},
},
updateApp(){
uni.showLoading({
title: '检查更新'
})
//#ifdef APP-PLUS
// 获取系统版本号
getVersions({
platform: plus.os.name,
version : plus.runtime.version
}).then(res => {
uni.hideLoading()
if (res.update) {
uni.showModal({
title: "更新提示",
content: res.note || '版本更新信息',
confirmText: "更新",
success: modalRes => {
if (modalRes.confirm) {
if (plus.os.name == "Android") {
uni.showToast({
title: '新版本下载中,将在下载完成后自动为您安装更新包',
icon: 'none'
})
uni.downloadFile({
url: res.info.download,
success: apkPick => {
plus.runtime.install(apkPick
.tempFilePath, '',
installRES => {
// 安装完成用于提示新版本引导,暂时无用
}, installERR => {
// 安装失败
})
},
fail(err) {
uni.showToast({
title: '安装包下载失败,请检查您的网络或稍后重试',
icon: 'none'
})
}
})
} else {
uni.showToast({
title: 'IOS应用暂未上架请打开测试(TestFlight)工具点击更新',
icon: 'none'
})
}
}
}
})
return
}
uni.showModal({
title : "提示",
content : "当前已是最新版本",
showCancel : false,
})
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
//#endif
}
}
};
</script>