From 27bdf1f2b0651a48b78004342588dd36da119c35 Mon Sep 17 00:00:00 2001 From: ghusermoon <2673031505@qq.com> Date: Tue, 25 Aug 2020 10:13:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 12 +++++++++++- README.md | 8 ++++++++ main.js | 4 ++++ pageE/setting/updateVersion.vue | 8 ++++++-- pageE/setting/version.vue | 20 +++++++++++++------- pages/mine/index.vue | 2 +- 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/App.vue b/App.vue index 469409e..3bb066b 100644 --- a/App.vue +++ b/App.vue @@ -28,7 +28,7 @@ // #endif }, onShow(){ - + this.getVersion(); }, onHide(){ @@ -45,6 +45,16 @@ } }) }, + getVersion() { + this.$u.post("Specialci/checkVersion",{ app_version: this.$app_version }).then(res => { + // console.log(res); + if(res.data.app_version != this.$app_version) { + this.$u.route('/pageE/setting/updateVersion', { + status: res.data.is_focus_upgrade + }); + } + }) + }, } } diff --git a/README.md b/README.md index 762c8f6..d0ab8f7 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,12 @@ unescapeHTML(temp){} * @return { object } promise 对象 resolve 返回文件服务器地址 reject 返回错误信息 */ uploadFile({ url, name, filePath }) {} + +/** +* 广告位跳转 +* @param { String } type 跳转类型 1 商品 2 店铺 3 领取优惠券 +* @param { String | Number } id 跳转id 商品id/商家id... +* @return { undefined } undefined +*/ +jumpPage({ type, id }) () ``` \ No newline at end of file diff --git a/main.js b/main.js index 66cc346..c5b63f8 100644 --- a/main.js +++ b/main.js @@ -5,6 +5,10 @@ import uView from "uview-ui"; Vue.config.productionTip = false Vue.use(uView); App.mpType = 'app' + +// 当前 app 版本号 +Vue.prototype.$app_version = '1.0.0'; + Vue.prototype.imService = new IMService(); Vue.prototype.a = 1; import store from '@/common/store/index.js' diff --git a/pageE/setting/updateVersion.vue b/pageE/setting/updateVersion.vue index 569bf89..456b2fb 100644 --- a/pageE/setting/updateVersion.vue +++ b/pageE/setting/updateVersion.vue @@ -1,7 +1,7 @@ @@ -10,6 +10,7 @@ export default { data() { return { + is_focus_upgrade: Boolean, // 是否强制更新 show: true, // 传递给uni-app"rich-text"组件的内容,可以使用"
"进行换行 content: ` @@ -19,6 +20,9 @@ `, } }, + onLoad(option) { + this.is_focus_upgrade = option.status == 1 ? false : true; + }, onReady() { this.show = true; }, diff --git a/pageE/setting/version.vue b/pageE/setting/version.vue index ca9f2a1..c1c05f2 100644 --- a/pageE/setting/version.vue +++ b/pageE/setting/version.vue @@ -3,7 +3,7 @@ 德铭阳光 - 版本:{{ version }} for {{ phone_type }} + 版本: {{ $app_version }} for {{ phone_type }} @@ -12,8 +12,8 @@ 版本更新 - 已是最新版本 - 发现新版本 + 发现新版本: {{ version }} + 已是最新版本 @@ -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 + }); } } }; diff --git a/pages/mine/index.vue b/pages/mine/index.vue index f4764f9..5a0fcb8 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -179,8 +179,8 @@ export default { }) } else { this.getOrderNumber(); + this.getUserInfo(); } - this.getUserInfo(); }, onNavigationBarButtonTap(e) { // console.log(e); -- 2.45.2