Authored by 李奇

拼团详情页分享修改

@@ -106,6 +106,7 @@ function progress(req, res, next) { @@ -106,6 +106,7 @@ function progress(req, res, next) {
106 localCss: true, 106 localCss: true,
107 nodownload: true, 107 nodownload: true,
108 width750: true, 108 width750: true,
  109 + wechatShare: true,
109 data: renderData 110 data: renderData
110 }); 111 });
111 }).catch(next); 112 }).catch(next);
1 {{#data}} 1 {{#data}}
2 -<div class="group-progress" data-page-go="{{pageGo}}" data-left-time="{{leftTime}}"> 2 +<div class="group-progress" data-page-go="{{pageGo}}"
  3 + data-activity-id="{{activityId}}"
  4 + data-left-time="{{leftTime}}"
  5 + data-lack-num="{{lackNum}}"
  6 + data-group-no="{{groupNo}}"
  7 + data-product-name="{{yourJoinItem.productName}}"
  8 + data-group-price="{{yourJoinItem.productGroupPrice}}"
  9 + data-share-img="{{image2 yourJoinItem.productIcon w=200 h=282}}">
3 <div class="card"> 10 <div class="card">
4 <div class="inner-card go-join" data-product-skn="{{yourJoinItem.productSkn}}" 11 <div class="inner-card go-join" data-product-skn="{{yourJoinItem.productSkn}}"
5 data-activity-id="{{activityId}}" data-group-no="{{groupNo}}" data-page-go="{{pageGo}}"> 12 data-activity-id="{{activityId}}" data-group-no="{{groupNo}}" data-page-go="{{pageGo}}">
@@ -22,16 +22,40 @@ class GroupProgress extends Page { @@ -22,16 +22,40 @@ class GroupProgress extends Page {
22 $countdown: $('.count-down') 22 $countdown: $('.count-down')
23 }; 23 };
24 this.timer = ''; 24 this.timer = '';
  25 + this.data = {
  26 + groupNo: '',
  27 + lackNum: '',
  28 + productName: '',
  29 + groupPrice: '',
  30 + shareImgUrl: ''
  31 + };
25 this.init(); 32 this.init();
26 } 33 }
27 34
28 init() { 35 init() {
29 lazyLoad(this.selector.$page.find('img.lazy')); 36 lazyLoad(this.selector.$page.find('img.lazy'));
  37 + this.initData();
30 this.bindEvents(); 38 this.bindEvents();
31 this.shareInfo(); 39 this.shareInfo();
32 this.countdown(); 40 this.countdown();
33 } 41 }
34 42
  43 + initData() {
  44 + let activityId = this.selector.$page.data('activity-id');
  45 + let groupNo = this.selector.$page.data('group-no');
  46 + let lackNum = this.selector.$page.data('lack-num');
  47 + let productName = this.selector.$page.data('product-name');
  48 + let groupPrice = this.selector.$page.data('group-price');
  49 + let shareImgUrl = this.selector.$page.data('share-img');
  50 +
  51 + this.data.groupNo = groupNo;
  52 + this.data.lackNum = lackNum;
  53 + this.data.productName = productName;
  54 + this.data.groupPrice = groupPrice;
  55 + this.data.activityId = activityId;
  56 + this.data.shareImgUrl = shareImgUrl;
  57 + }
  58 +
35 bindEvents() { 59 bindEvents() {
36 this.selector.$productItem.on('click', this.goDetail.bind(this)); 60 this.selector.$productItem.on('click', this.goDetail.bind(this));
37 this.selector.$goJoin.on('click', this.goJoin.bind(this)); 61 this.selector.$goJoin.on('click', this.goJoin.bind(this));
@@ -40,17 +64,23 @@ class GroupProgress extends Page { @@ -40,17 +64,23 @@ class GroupProgress extends Page {
40 } 64 }
41 65
42 shareInfo() { 66 shareInfo() {
  67 + let _this = this;
  68 + let link = '';
  69 + let [domain] = location.href.split('?');
  70 +
  71 + link = `${domain}?activityId=${this.data.activityId}&groupNo=${this.data.groupNo}`;
  72 +
  73 + _this.data.shareImgUrl = _this.data.shareImgUrl.replace(/(http:)?\/\//, 'https://');
  74 +
43 sharePlugin({ 75 sharePlugin({
44 - title: '有货福利团xx元包邮xxx商品',  
45 - imgUrl: '',  
46 - link: '',  
47 - desc: 'x人团更优惠,正品保证,全场包邮',  
48 - copyDeac: '【有货福利团 】x人团,xx元包邮xxx商品>>' 76 + title: `【还差${_this.data.lackNum}人】${_this.data.groupPrice}金额 ${_this.data.productName}`,
  77 + imgUrl: _this.data.shareImgUrl,
  78 + link: link
49 }); 79 });
50 80
51 let clipboardShare = new Clipboard('.h5-share-clipboard', { 81 let clipboardShare = new Clipboard('.h5-share-clipboard', {
52 text: function() { 82 text: function() {
53 - return '【有货福利团 】x人团,xx元包邮xxx商品>>'; 83 + return `【还差${_this.data.lackNum}人】${_this.data.groupPrice}金额 ${_this.data.productName}>>${link}`;
54 } 84 }
55 }); 85 });
56 86