From 191a0933b75971a220a6e6f18769928def47d699 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Fri, 21 May 2021 17:42:18 +0800 Subject: [PATCH] 分享的优化,秒杀和拼团 --- pages/goods/goodsInfo/goodsInfo.js | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index fd595bb..9a9e311 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1990,9 +1990,12 @@ Page({ } var title= th.data.data.goods_name; var img=th.data.data.original_img; - if(th.data.prom_type==6){ + if(th.data.prom_type==6 || th.data.prom_type==1){ + title=th.data.prom_act.share_title; - img=th.data.iurl+th.data.prom_act.share_imgurl; + if(!title) title=th.data.prom_act.title; + if(th.data.prom_act.share_imgurl) + img=th.data.iurl+th.data.prom_act.share_imgurl; } @@ -3963,14 +3966,19 @@ Page({ context.setFillStyle("white"); context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); } - - + + var share_title=th.data.data.goods_name; + if(th.data.prom_type==1 || th.data.prom_type==4){ + share_title=th.data.prom_act.share_title; + if(!share_title) share_title=th.data.prom_act.title; + } + //---产品名称--- //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 if(type!=4){ context.setFillStyle("black"); context.setFontSize(21.3 * unit) - th.draw_Text(context, th.data.data.goods_name, + th.draw_Text(context, share_title, 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); //------产品的价格------- context.setFontSize(23 * unit) @@ -4431,18 +4439,23 @@ Page({ tt(); return false; } + + var img_url=ee.data.data.original_img; + if((this.data.prom_type==1 && this.data.prom_type==6) || this.data.prom_act.share_imgurl){ + img_url=this.data.iurl+this.data.prom_act.share_imgurl; + } + //获取商品是分享图信息 wx.getImageInfo({ - src: ee.data.data.original_img, + src: img_url, success: function(res) { - //res.path是网络图片的本地地址 - ee.data.share_goods_img = res.path; - tt(); + //res.path是网络图片的本地地址 + ee.data.share_goods_img = res.path; + tt(); }, fail: function(res) { - - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 - tt(); + ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 + tt(); } }); }, -- libgit2 0.21.4