版本更新
This commit is contained in:
2
App.vue
2
App.vue
@@ -3,13 +3,13 @@
|
||||
|
||||
export default {
|
||||
onLaunch: function() {
|
||||
// return
|
||||
//#ifdef APP-PLUS
|
||||
// 获取系统版本号
|
||||
getVersions({
|
||||
platform: plus.os.name,
|
||||
version : plus.runtime.version
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
if (res.update) {
|
||||
uni.showModal({
|
||||
title: "更新提示",
|
||||
|
||||
@@ -91,10 +91,11 @@
|
||||
}).then((res) => {
|
||||
this.$store.commit('setToken', res.token_type + ' ' + res.access_token);
|
||||
if(res.is_new){
|
||||
uni.setStorageSync('isnew', res.is_new ? 0 : 1)
|
||||
uni.setStorageSync('isnew', 0)
|
||||
this.$Router.replace({name: 'AuthRole'})
|
||||
return
|
||||
}
|
||||
uni.setStorageSync('isnew', 1)
|
||||
this.$Router.pushTab({name: 'Life'})
|
||||
uni.hideLoading()
|
||||
}).catch((err) => {
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
sex : this.sex,
|
||||
storage_id : this.storageId
|
||||
}).then(res => {
|
||||
this.$store.commit('setIsNew', 1)
|
||||
uni.setStorageSync('isnew', 1)
|
||||
this.$Router.pushTab({name: 'Life'})
|
||||
}).catch(err => {
|
||||
this.disabled = false
|
||||
|
||||
@@ -175,9 +175,6 @@
|
||||
},
|
||||
// 签到
|
||||
onSign(){
|
||||
|
||||
console.log(this.isSign)
|
||||
|
||||
if(this.isSign){
|
||||
this.$Router.push({name: 'Capacity'})
|
||||
return
|
||||
|
||||
@@ -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 {
|
||||
@@ -234,6 +236,71 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
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>
|
||||
|
||||
@@ -11,7 +11,8 @@ const router = createRouter({
|
||||
|
||||
//全局路由前置守卫
|
||||
router.beforeEach((to, from, next) => {
|
||||
if(to.name === 'Auth' && store.getters.getToken != '' && uni.getStorageSync('token') != ''){
|
||||
if(to.name === 'Auth'){
|
||||
if(store.getters.getToken != '' || uni.getStorageSync('token') != ''){
|
||||
if(uni.getStorageSync('isnew') === 0){
|
||||
next({
|
||||
name: 'AuthRole',
|
||||
@@ -26,6 +27,9 @@ router.beforeEach((to, from, next) => {
|
||||
return
|
||||
}
|
||||
next();
|
||||
return
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
// 全局路由后置守卫
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
unpackage/dist/dev/app-plus/__uniappscan.js
vendored
2
unpackage/dist/dev/app-plus/__uniappscan.js
vendored
File diff suppressed because one or more lines are too long
6547
unpackage/dist/dev/app-plus/app-service.js
vendored
6547
unpackage/dist/dev/app-plus/app-service.js
vendored
File diff suppressed because one or more lines are too long
18317
unpackage/dist/dev/app-plus/app-view.js
vendored
18317
unpackage/dist/dev/app-plus/app-view.js
vendored
File diff suppressed because one or more lines are too long
2
unpackage/dist/dev/app-plus/view.css
vendored
2
unpackage/dist/dev/app-plus/view.css
vendored
File diff suppressed because one or more lines are too long
6
unpackage/dist/dev/app-plus/view.umd.min.js
vendored
6
unpackage/dist/dev/app-plus/view.umd.min.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user