版本更新

This commit is contained in:
2020-08-25 10:13:49 +08:00
parent 0d96af99e1
commit 27bdf1f2b0
6 changed files with 43 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
<template>
<u-modal v-model="show" :show-cancel-button="true" confirm-text="升级" title="发现新版本" @cancel="cancel" @confirm="confirm">
<u-modal v-model="show" :show-cancel-button="is_focus_upgrade" confirm-text="升级" title="发现新版本" @cancel="cancel" @confirm="confirm">
<view class="u-update-content">
<rich-text :nodes="content"></rich-text>
<!-- <rich-text :nodes="content"></rich-text> -->
</view>
</u-modal>
</template>
@@ -10,6 +10,7 @@
export default {
data() {
return {
is_focus_upgrade: Boolean, // 是否强制更新
show: true,
// 传递给uni-app"rich-text"组件的内容,可以使用"<br>"进行换行
content: `
@@ -19,6 +20,9 @@
`,
}
},
onLoad(option) {
this.is_focus_upgrade = option.status == 1 ? false : true;
},
onReady() {
this.show = true;
},

View File

@@ -3,7 +3,7 @@
<view class="header">
<image src="../../pageD/images/file.png" class="tit-img" mode=""></image>
<view class="title">德铭阳光</view>
<view class="tit-info">版本:{{ version }} for {{ phone_type }}</view>
<view class="tit-info">版本: {{ $app_version }} for {{ phone_type }}</view>
</view>
<view class="main">
<view @click="viewAboutUs">
@@ -12,8 +12,8 @@
</view>
<view class="version-view">
<text class="title">版本更新</text>
<text class="tips" v-if="1">已是最新版本</text>
<text class="tips" v-else @click="updateVersion">发现新版本</text>
<text class="tips" v-if="version" @click="updateVersion">发现新版本: {{ version }}</text>
<text class="tips" v-else>已是最新版本</text>
</view>
</view>
</view>
@@ -22,8 +22,9 @@
export default {
data() {
return {
version: "",
version: '',
phone_type: "",
status: '',
}
},
onLoad() {
@@ -33,9 +34,12 @@ export default {
methods: {
// 检查版本号
getVersion() {
this.$u.post("Specialci/checkVersion",{ app_version: 1 }).then(res => {
this.$u.post("Specialci/checkVersion",{ app_version: this.$app_version }).then(res => {
// console.log(res);
this.version = res.data.app_version;
if(res.data.app_version != this.$app_version) {
this.version = res.data.app_version;
this.status = res.data.is_focus_upgrade; // 0 不强制 1 强制
}
})
},
viewAboutUs() {
@@ -44,7 +48,9 @@ export default {
});
},
updateVersion() {
this.$u.route('/pageE/setting/updateVersion');
this.$u.route('/pageE/setting/updateVersion', {
status: this.status
});
}
}
};