Commit 191a0933b75971a220a6e6f18769928def47d699
1 parent
d9f057aa
分享的优化,秒杀和拼团
Showing
1 changed file
with
25 additions
and
12 deletions
pages/goods/goodsInfo/goodsInfo.js
| @@ -1990,9 +1990,12 @@ Page({ | @@ -1990,9 +1990,12 @@ Page({ | ||
| 1990 | } | 1990 | } |
| 1991 | var title= th.data.data.goods_name; | 1991 | var title= th.data.data.goods_name; |
| 1992 | var img=th.data.data.original_img; | 1992 | var img=th.data.data.original_img; |
| 1993 | - if(th.data.prom_type==6){ | 1993 | + if(th.data.prom_type==6 || th.data.prom_type==1){ |
| 1994 | + | ||
| 1994 | title=th.data.prom_act.share_title; | 1995 | title=th.data.prom_act.share_title; |
| 1995 | - img=th.data.iurl+th.data.prom_act.share_imgurl; | 1996 | + if(!title) title=th.data.prom_act.title; |
| 1997 | + if(th.data.prom_act.share_imgurl) | ||
| 1998 | + img=th.data.iurl+th.data.prom_act.share_imgurl; | ||
| 1996 | } | 1999 | } |
| 1997 | 2000 | ||
| 1998 | 2001 | ||
| @@ -3963,14 +3966,19 @@ Page({ | @@ -3963,14 +3966,19 @@ Page({ | ||
| 3963 | context.setFillStyle("white"); | 3966 | context.setFillStyle("white"); |
| 3964 | context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); | 3967 | context.fillText('强烈推荐', 149 * unit + width + 15 * unit, 75 * unit); |
| 3965 | } | 3968 | } |
| 3966 | - | ||
| 3967 | - | 3969 | + |
| 3970 | + var share_title=th.data.data.goods_name; | ||
| 3971 | + if(th.data.prom_type==1 || th.data.prom_type==4){ | ||
| 3972 | + share_title=th.data.prom_act.share_title; | ||
| 3973 | + if(!share_title) share_title=th.data.prom_act.title; | ||
| 3974 | + } | ||
| 3975 | + | ||
| 3968 | //---产品名称--- | 3976 | //---产品名称--- |
| 3969 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 | 3977 | //文本换行 参数:1、canvas对象,2、文本 3、距离左侧的距离 4、距离顶部的距离 5、6、文本的宽度 |
| 3970 | if(type!=4){ | 3978 | if(type!=4){ |
| 3971 | context.setFillStyle("black"); | 3979 | context.setFillStyle("black"); |
| 3972 | context.setFontSize(21.3 * unit) | 3980 | context.setFontSize(21.3 * unit) |
| 3973 | - th.draw_Text(context, th.data.data.goods_name, | 3981 | + th.draw_Text(context, share_title, |
| 3974 | 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); | 3982 | 38 * unit, 180 * unit, 200 * unit, 279 * unit, unit); |
| 3975 | //------产品的价格------- | 3983 | //------产品的价格------- |
| 3976 | context.setFontSize(23 * unit) | 3984 | context.setFontSize(23 * unit) |
| @@ -4431,18 +4439,23 @@ Page({ | @@ -4431,18 +4439,23 @@ Page({ | ||
| 4431 | tt(); | 4439 | tt(); |
| 4432 | return false; | 4440 | return false; |
| 4433 | } | 4441 | } |
| 4442 | + | ||
| 4443 | + var img_url=ee.data.data.original_img; | ||
| 4444 | + if((this.data.prom_type==1 && this.data.prom_type==6) || this.data.prom_act.share_imgurl){ | ||
| 4445 | + img_url=this.data.iurl+this.data.prom_act.share_imgurl; | ||
| 4446 | + } | ||
| 4447 | + | ||
| 4434 | //获取商品是分享图信息 | 4448 | //获取商品是分享图信息 |
| 4435 | wx.getImageInfo({ | 4449 | wx.getImageInfo({ |
| 4436 | - src: ee.data.data.original_img, | 4450 | + src: img_url, |
| 4437 | success: function(res) { | 4451 | success: function(res) { |
| 4438 | - //res.path是网络图片的本地地址 | ||
| 4439 | - ee.data.share_goods_img = res.path; | ||
| 4440 | - tt(); | 4452 | + //res.path是网络图片的本地地址 |
| 4453 | + ee.data.share_goods_img = res.path; | ||
| 4454 | + tt(); | ||
| 4441 | }, | 4455 | }, |
| 4442 | fail: function(res) { | 4456 | fail: function(res) { |
| 4443 | - | ||
| 4444 | - ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 | ||
| 4445 | - tt(); | 4457 | + ee.data.share_goods_img = "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 |
| 4458 | + tt(); | ||
| 4446 | } | 4459 | } |
| 4447 | }); | 4460 | }); |
| 4448 | }, | 4461 | }, |