From efb2a7963ed08568ed0f5382f601862c6bb9789c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lemon=E6=A9=AA?= <17633066053@163.com> Date: Fri, 2 Jul 2021 10:52:36 +0800 Subject: [PATCH] =?UTF-8?q?=20=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E7=89=88=E6=9C=AC=E6=8F=90=E4=BA=A4=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=20=E8=A7=A3=E5=86=B3=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 31 +++++++++++++++++++++++ pages/product/goods.vue | 15 +++++------ pages/tabbar/home/template/tpl_goods.vue | 9 ------- static/exchange.png | Bin 4389 -> 4109 bytes static/logo.png | Bin 20124 -> 19221 bytes 5 files changed, 38 insertions(+), 17 deletions(-) diff --git a/App.vue b/App.vue index 8a71a42..8a4bb12 100644 --- a/App.vue +++ b/App.vue @@ -58,6 +58,10 @@ export default { this.checkArguments(); // 检测启动参数 }); // #endif + + // #ifdef MP-WEIXIN + this.applyUpdateWeChat(); + // #endif }, onShow() { @@ -66,6 +70,33 @@ export default { // #endif }, methods: { + /** + * 微信小程序版本提交更新版本 解决缓存问题 + */ + applyUpdateWeChat() { + const updateManager = uni.getUpdateManager(); + + updateManager.onCheckForUpdate(function (res) { + // 请求完新版本信息的回调 + }); + + updateManager.onUpdateReady(function (res) { + uni.showModal({ + title: "更新提示", + content: "发现新版本,是否重启应用?", + success(res) { + if (res.confirm) { + // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 + updateManager.applyUpdate(); + } + }, + }); + }); + updateManager.onUpdateFailed(function (res) { + // 新的版本下载失败 + }); + }, + // TODO 开屏广告 后续优化添加 launch() { try { diff --git a/pages/product/goods.vue b/pages/product/goods.vue index 6cddd8f..77a8090 100644 --- a/pages/product/goods.vue +++ b/pages/product/goods.vue @@ -399,9 +399,9 @@ export default { return { title: this.goodsDetail.goodsName, type: 0, - query:`id=${this.routerVal.id}&goodsId=${this.routerVal.goodsId}`, + query: `id=${this.routerVal.id}&goodsId=${this.routerVal.goodsId}`, path: `/pages/product/goods`, - imageUrl:this.goodsDetail.goodsGalleryList[0], + imageUrl: this.goodsDetail.goodsGalleryList[0], }; }, // #endif @@ -499,15 +499,14 @@ export default { return true; } }, - selectSku (idObj) { - console.log(idObj) - this.init(idObj.skuId,idObj.goodsId) - }, + selectSku(idObj) { + this.init(idObj.skuId, idObj.goodsId); + }, /** * 初始化信息 */ - async init(id, goodsId, distributionId) { - console.log(id, goodsId) + async init(id, goodsId, distributionId) { + console.log(id, goodsId); this.isGroup = false; //初始化拼团 this.productId = id; // skuId // 这里请求获取到页面数据 解析数据 diff --git a/pages/tabbar/home/template/tpl_goods.vue b/pages/tabbar/home/template/tpl_goods.vue index 20ba180..839dc1d 100644 --- a/pages/tabbar/home/template/tpl_goods.vue +++ b/pages/tabbar/home/template/tpl_goods.vue @@ -27,10 +27,8 @@