版本更新
This commit is contained in:
4
App.vue
4
App.vue
@@ -3,13 +3,13 @@
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
onLaunch: function() {
|
onLaunch: function() {
|
||||||
// return
|
|
||||||
//#ifdef APP-PLUS
|
//#ifdef APP-PLUS
|
||||||
// 获取系统版本号
|
// 获取系统版本号
|
||||||
getVersions({
|
getVersions({
|
||||||
platform: plus.os.name,
|
platform: plus.os.name,
|
||||||
version: plus.runtime.version
|
version : plus.runtime.version
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
|
console.log(res)
|
||||||
if (res.update) {
|
if (res.update) {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: "更新提示",
|
title: "更新提示",
|
||||||
|
|||||||
@@ -91,10 +91,11 @@
|
|||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.$store.commit('setToken', res.token_type + ' ' + res.access_token);
|
this.$store.commit('setToken', res.token_type + ' ' + res.access_token);
|
||||||
if(res.is_new){
|
if(res.is_new){
|
||||||
uni.setStorageSync('isnew', res.is_new ? 0 : 1)
|
uni.setStorageSync('isnew', 0)
|
||||||
this.$Router.replace({name: 'AuthRole'})
|
this.$Router.replace({name: 'AuthRole'})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
uni.setStorageSync('isnew', 1)
|
||||||
this.$Router.pushTab({name: 'Life'})
|
this.$Router.pushTab({name: 'Life'})
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
sex : this.sex,
|
sex : this.sex,
|
||||||
storage_id : this.storageId
|
storage_id : this.storageId
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
this.$store.commit('setIsNew', 1)
|
uni.setStorageSync('isnew', 1)
|
||||||
this.$Router.pushTab({name: 'Life'})
|
this.$Router.pushTab({name: 'Life'})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
|
|||||||
@@ -175,9 +175,6 @@
|
|||||||
},
|
},
|
||||||
// 签到
|
// 签到
|
||||||
onSign(){
|
onSign(){
|
||||||
|
|
||||||
console.log(this.isSign)
|
|
||||||
|
|
||||||
if(this.isSign){
|
if(this.isSign){
|
||||||
this.$Router.push({name: 'Capacity'})
|
this.$Router.push({name: 'Capacity'})
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
意见反馈
|
意见反馈
|
||||||
<uni-icons class="forward" type="forward" color="#999" />
|
<uni-icons class="forward" type="forward" color="#999" />
|
||||||
</view>
|
</view>
|
||||||
<view class="btns-box-item">
|
<view class="btns-box-item" @click="updateApp">
|
||||||
<image class="icon" src="@/static/user/userIcon_03.png" mode="widthFix" />
|
<image class="icon" src="@/static/user/userIcon_03.png" mode="widthFix" />
|
||||||
版本更新
|
版本更新
|
||||||
<uni-icons class="forward" type="forward" color="#999" />
|
<uni-icons class="forward" type="forward" color="#999" />
|
||||||
@@ -125,7 +125,9 @@
|
|||||||
info,
|
info,
|
||||||
chainSeed
|
chainSeed
|
||||||
} from '@/apis/interfaces/user';
|
} from '@/apis/interfaces/user';
|
||||||
|
import {
|
||||||
|
getVersions
|
||||||
|
} from '@/apis/interfaces/versions.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
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>
|
</script>
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ const router = createRouter({
|
|||||||
|
|
||||||
//全局路由前置守卫
|
//全局路由前置守卫
|
||||||
router.beforeEach((to, from, next) => {
|
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){
|
if(uni.getStorageSync('isnew') === 0){
|
||||||
next({
|
next({
|
||||||
name: 'AuthRole',
|
name: 'AuthRole',
|
||||||
@@ -26,6 +27,9 @@ router.beforeEach((to, from, next) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
next();
|
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