Authored by 陈峰

套餐优化分享

@@ -35,6 +35,8 @@ const detail = (params) => { @@ -35,6 +35,8 @@ const detail = (params) => {
35 --bundleIndex; 35 --bundleIndex;
36 return getBundleBySkn(params.skn).then(result => { 36 return getBundleBySkn(params.skn).then(result => {
37 if (_.has(result, `data[${bundleIndex}]`)) { 37 if (_.has(result, `data[${bundleIndex}]`)) {
  38 + let shareInfo = _.get(result, 'data[0].shareInfo', {});
  39 +
38 return { 40 return {
39 bundleDatas: _.map(result.data, (bundle, index) => { 41 bundleDatas: _.map(result.data, (bundle, index) => {
40 return { 42 return {
@@ -43,6 +45,12 @@ const detail = (params) => { @@ -43,6 +45,12 @@ const detail = (params) => {
43 href: helpers.urlFormat('/product/bundle/detail', {skn: params.skn, index: ++index}), 45 href: helpers.urlFormat('/product/bundle/detail', {skn: params.skn, index: ++index}),
44 }; 46 };
45 }), 47 }),
  48 + shareInfo: {
  49 + imgUrl: `http:${helpers.image(shareInfo.imgUrl, 300, 300)}`,
  50 + subTitle: encodeURIComponent(shareInfo.subTitle),
  51 + title: encodeURIComponent(shareInfo.title),
  52 + url: shareInfo.url
  53 + },
46 bundleInfo: _.get(result, `data[${bundleIndex}].bundleInfo`, {}), 54 bundleInfo: _.get(result, `data[${bundleIndex}].bundleInfo`, {}),
47 productList: productProcess.processProductList(_.get(result, `data[${bundleIndex}].productList`, [])) 55 productList: productProcess.processProductList(_.get(result, `data[${bundleIndex}].productList`, []))
48 }; 56 };
@@ -47,4 +47,10 @@ @@ -47,4 +47,10 @@
47 </div> 47 </div>
48 <input type="hidden" id="activityId" value="{{bundleId}}"> 48 <input type="hidden" id="activityId" value="{{bundleId}}">
49 {{/ bundleInfo}} 49 {{/ bundleInfo}}
  50 + {{#shareInfo}}
  51 + <input type="hidden" id="shareImgUrl" value="{{imgUrl}}">
  52 + <input type="hidden" id="shareSubTitle" value="{{subTitle}}">
  53 + <input type="hidden" id="shareTitle" value="{{title}}">
  54 + <input type="hidden" id="shareUrl" value="{{url}}">
  55 + {{/shareInfo}}
50 </div> 56 </div>
1 'use strict'; 1 'use strict';
2 2
3 const fs = require('fs'); 3 const fs = require('fs');
4 -let devHost = '127.0.0.1'; 4 +let devHost = 'm.yohobuy.com';
5 5
6 fs.readFile('.devhost', (err, buf)=> { 6 fs.readFile('.devhost', (err, buf)=> {
7 if (!err) { 7 if (!err) {
@@ -23,12 +23,14 @@ let actCkOpthn = { @@ -23,12 +23,14 @@ let actCkOpthn = {
23 23
24 $(function() { 24 $(function() {
25 window.setCookie('activity-info', '', actCkOpthn); 25 window.setCookie('activity-info', '', actCkOpthn);
26 - share({  
27 - imgUrl: 'https://feature.yoho.cn/300x300.png',  
28 - title: '会搭是成为潮流ICON的第一步,搭配购买还有优惠折扣!',  
29 - link: window.location.href,  
30 - desc: '超高性价比,开启省钱大作战!'  
31 - }); 26 + if ($('#shareUrl').length) {
  27 + share({
  28 + imgUrl: $('#shareImgUrl').val(),
  29 + title: decodeURIComponent($('#shareTitle').val()),
  30 + link: $('#shareUrl').val(),
  31 + desc: decodeURIComponent($('#shareSubTitle').val())
  32 + });
  33 + }
32 if ($('.bundle-tabs').find('.swiper-slide').length > 3) { 34 if ($('.bundle-tabs').find('.swiper-slide').length > 3) {
33 new Swiper('.bundle-tabs', { 35 new Swiper('.bundle-tabs', {
34 freeMode: true, 36 freeMode: true,