From fc3296f871229a826eb955ffdc47e10ed0114efc Mon Sep 17 00:00:00 2001 From: From-wh Date: Wed, 21 Jun 2023 18:11:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=89=8D?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=89=88=E6=9C=AC=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/uni-app/App.vue | 78 ++++++++++++++++++++-------------- template/uni-app/api/public.js | 11 ++++- 2 files changed, 55 insertions(+), 34 deletions(-) diff --git a/template/uni-app/App.vue b/template/uni-app/App.vue index 03d33895c..1b66ad637 100644 --- a/template/uni-app/App.vue +++ b/template/uni-app/App.vue @@ -3,24 +3,22 @@ checkLogin } from './libs/login'; import { - HTTP_REQUEST_URL + HTTP_REQUEST_URL, + SYSTEM_VERSION } from './config/app'; import { getShopConfig, - silenceAuth + silenceAuth, + getSystemVersion } from '@/api/public'; import Auth from '@/libs/wechat.js'; import Routine from './libs/routine.js'; import { silenceBindingSpread } from "@/utils"; - import { - getCartCounts, - } from '@/api/order.js'; import { colorChange, getCrmebCopyRight, - } from '@/api/api.js'; import { getLangJson, @@ -83,6 +81,7 @@ } }, onShow() { + console.log(this.globalData.cccc) const queryData = uni.getEnterOptionsSync() // uni-app版本 3.5.1+ 支持 if (queryData.query.spread) { this.$Cache.set('spread', queryData.query.spread); @@ -97,33 +96,33 @@ silenceBindingSpread(this.globalData) } // #ifdef MP - if (queryData.query.scene) { - let param = this.$util.getUrlParams(decodeURIComponent(queryData.query.scene)) - console.log(queryData.query.scene) - console.log(param) - if(param.pid){ - this.$Cache.set('spread', param.pid); - this.globalData.spid = param.pid; - this.globalData.pid = param.pid; - }else{ - switch (queryData.scene) { - //扫描小程序码 - case 1047: - this.globalData.code = queryData.query.scene; - break; - //长按图片识别小程序码 - case 1048: - this.globalData.code = queryData.query.scene; - break; - //手机相册选取小程序码 - case 1049: - this.globalData.code = queryData.query.scene; - break; - //直接进入小程序 - case 1001: - this.globalData.spid = queryData.query.scene; - break; - } + if (queryData.query.scene) { + let param = this.$util.getUrlParams(decodeURIComponent(queryData.query.scene)) + console.log(queryData.query.scene) + console.log(param) + if (param.pid) { + this.$Cache.set('spread', param.pid); + this.globalData.spid = param.pid; + this.globalData.pid = param.pid; + } else { + switch (queryData.scene) { + //扫描小程序码 + case 1047: + this.globalData.code = queryData.query.scene; + break; + //长按图片识别小程序码 + case 1048: + this.globalData.code = queryData.query.scene; + break; + //手机相册选取小程序码 + case 1049: + this.globalData.code = queryData.query.scene; + break; + //直接进入小程序 + case 1001: + this.globalData.spid = queryData.query.scene; + break; + } } silenceBindingSpread(this.globalData) } @@ -282,6 +281,19 @@ getCrmebCopyRight().then(res => { uni.setStorageSync('copyRight', res.data) }) + // #ifdef MP + getSystemVersion().then(res => { + if (res.data.version_code < SYSTEM_VERSION) { + uni.showModal({ + title: '提示', + content: '请重新打包并上传小程序', + success: function(res) { + if (res.confirm) {} + } + }); + } + }) + // #endif }, // #ifdef H5 onHide() { diff --git a/template/uni-app/api/public.js b/template/uni-app/api/public.js index c39ba1923..b0d7cd57d 100644 --- a/template/uni-app/api/public.js +++ b/template/uni-app/api/public.js @@ -221,7 +221,7 @@ export function getCategoryVersion(name) { noAuth: true }); } - + /** * 配置信息 * @@ -231,3 +231,12 @@ export function basicConfig(name) { noAuth: true }); } +/** + * 后台版本信息 + * + */ +export function getSystemVersion() { + return request.get(`version`, {}, { + noAuth: true + }); +}