From 31ead800b115652b63e8becb7b715cd82d658245 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 15 Jun 2023 20:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=8B=BC=E5=9B=A2=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E3=80=91=201.=20=E6=95=B4=E7=90=86=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods_combination_details/index.vue | 197 ++++++++---------- .../activity/goods_seckill_details/index.vue | 29 ++- 2 files changed, 99 insertions(+), 127 deletions(-) diff --git a/pages/activity/goods_combination_details/index.vue b/pages/activity/goods_combination_details/index.vue index 56b40546..f4a924f2 100644 --- a/pages/activity/goods_combination_details/index.vue +++ b/pages/activity/goods_combination_details/index.vue @@ -123,14 +123,13 @@ - + - + 用户评价({{replyCount}}) - 好评{{replyChance || 0}}% - + :url='"/pages/users/goods_comment_list/index?productId="+spu.productId'> + 好评{{ replyChance || 0}}% @@ -204,7 +203,7 @@ @iptCartNum="iptCartNum" @close="closeAttr" /> - + { - // #ifdef MP - const menuButton = uni.getMenuButtonBoundingClientRect(); - const query = uni.createSelectorQuery().in(this); - query - .select('#home') - .boundingClientRect(data => { - this.homeTop = menuButton.top * 2 + menuButton.height - data.height; - }) - .exec(); - // #endif - }); + // 设置商品列表高度 + uni.getSystemInfo({ + success: res => { + this.height = res.windowHeight + //res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度; + }, + }); // #ifdef MP this.navH = app.globalData.navHeight; // #endif // #ifndef MP this.navH = 96; // #endif - //设置商品列表高度 - uni.getSystemInfo({ - success: function(res) { - that.height = res.windowHeight - //res.windowHeight:获取整个窗口高度为px,*2为rpx;98为头部占据的高度; - }, - }); - if (options.hasOwnProperty('id') || options.scene) { - if (options.scene) { // 仅仅小程序扫码进入 - let qrCodeValue = this.$util.getUrlParams(decodeURIComponent(options.scene)); - let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue); - app.globalData.spread = mapeMpQrCodeValue.spread; - this.id = mapeMpQrCodeValue.id; - setTimeout(()=>{ - spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {}) - },2000) - }else{ - this.id = options.id; - } - if (this.isLogin) { - this.combinationDetail(); - } else { - // #ifdef H5 || APP-PLUS - try { - uni.setStorageSync('comGoodsId', options.id); - } catch (e) {} - // #endif - this.$Cache.set('login_back_url', - `/pages/activity/goods_combination_details/index?id=${options.id}&spread=${options.pid?options.pid:0}` - ); - toLogin(); - } - } else { - try { - let val = uni.getStorageSync('comGoodsId'); - if (val != '') { - this.id = val - this.combinationDetail(); - } - } catch (e) { - uni.showToast({ - title: '参数错误', - icon: 'none', - duration: 1000, - mask: true, - }) - } - } + + // 校验参数是否正确 + if (!options.scene && !options.id){ + this.$util.Tips({ + title: '缺少参数无法查看商品' + }, { + url: '/pages/index/index' + }); + return; + } + // 解析 id 商品编号 + if (options.scene) { // 仅仅小程序扫码进入 + // TODO 芋艿:code 是啥 + let qrCodeValue = this.$util.getUrlParams(decodeURIComponent(options.scene)); + let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue); + app.globalData.spread = mapeMpQrCodeValue.spread; + this.id = mapeMpQrCodeValue.id; + // TODO 芋艿:code 是啥 + setTimeout(()=>{ + spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {}) + }, 2000) + } else { + this.id = options.id; + } + + // 获取拼团信息 + this.combinationDetail(); }, //#ifdef MP onShareAppMessage() { @@ -472,6 +433,20 @@ }; }, //#endif + onReady() { + this.$nextTick(() => { + // 设置微信的头部 top 位置 + // #ifdef MP + const menuButton = uni.getMenuButtonBoundingClientRect(); + const query = uni.createSelectorQuery().in(this); + query.select('#home') + .boundingClientRect(data => { + this.homeTop = menuButton.top * 2 + menuButton.height - data.height; + }) + .exec(); + // #endif + }); + }, methods: { // ========== 拼团活动相关 ========== combinationDetail() { diff --git a/pages/activity/goods_seckill_details/index.vue b/pages/activity/goods_seckill_details/index.vue index 944dda3b..84f0d929 100644 --- a/pages/activity/goods_seckill_details/index.vue +++ b/pages/activity/goods_seckill_details/index.vue @@ -252,7 +252,6 @@ posters: false, // 分享弹窗的开关 weixinStatus: false, // 微信分享是否打开 canvasStatus: false, // 是否显示海报 - imagePath: '', // 海报路径 H5ShareBox: false, // 公众号分享的弹出 posterbackgd: '/static/images/posterbackgd.png', // 海报的背景,用于海报的生成 storeImage: '', // 下载商品图片后的文件地址 @@ -330,21 +329,19 @@ return; } // 解析 id 商品编号 - if (options.hasOwnProperty('id') || options.scene){ - if (options.scene) { // 仅仅小程序扫码进入 - // TODO 芋艿:code 是啥 - let qrCodeValue = this.$util.getUrlParams(decodeURIComponent(options.scene)); - let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue); - app.globalData.spread = mapeMpQrCodeValue.spread; - this.id = mapeMpQrCodeValue.id; - // TODO 芋艿:code 是啥 - setTimeout(()=>{ - spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {}) - },2000) - } else { - this.id = options.id; - } - } + if (options.scene) { // 仅仅小程序扫码进入 + // TODO 芋艿:code 是啥 + let qrCodeValue = this.$util.getUrlParams(decodeURIComponent(options.scene)); + let mapeMpQrCodeValue = this.$util.formatMpQrCodeData(qrCodeValue); + app.globalData.spread = mapeMpQrCodeValue.spread; + this.id = mapeMpQrCodeValue.id; + // TODO 芋艿:code 是啥 + setTimeout(()=>{ + spread(mapeMpQrCodeValue.spread).then(res => {}).catch(res => {}) + },2000) + } else { + this.id = options.id; + } // 获得秒杀详情 this.getSeckillDetail();