Authored by yyq

Merge branch 'feature/activity' into release/question

@@ -2,6 +2,9 @@ @@ -2,6 +2,9 @@
2 const model = require('../models/feature'); 2 const model = require('../models/feature');
3 3
4 exports.index = function(req, res, next) { 4 exports.index = function(req, res, next) {
  5 + // 唤起 APP 的路径
  6 + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param": {"share_id":"${req.query.share_id}"},"url":"https://activity.yoho.cn/feature/${req.params.code}.html"}}`;
  7 +
5 model.index({ 8 model.index({
6 code: req.params.code, 9 code: req.params.code,
7 type: req.query.type 10 type: req.query.type
@@ -22,9 +22,9 @@ @@ -22,9 +22,9 @@
22 style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}"> 22 style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
23 {{#if param.bgimg}} 23 {{#if param.bgimg}}
24 {{#isLazyLoad type @index}} 24 {{#isLazyLoad type @index}}
25 - <img class="lazy" data-original="{{image2 param.bgimg q=75}}"> 25 + <img class="lazy" data-original="{{imageslim param.bgimg}}">
26 {{else}} 26 {{else}}
27 - <img src="{{image2 param.bgimg q=75}}"> 27 + <img src="{{imageslim param.bgimg}}">
28 {{/isLazyLoad}} 28 {{/isLazyLoad}}
29 {{/if}} 29 {{/if}}
30 {{#component}} 30 {{#component}}
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 {{#if modalImg}} 34 {{#if modalImg}}
35 <div class="modal"> 35 <div class="modal">
36 <span class="modal-close"></span> 36 <span class="modal-close"></span>
37 - <img class="modal-img lazy" data-original="{{image2 modalImg q=75}}"> 37 + <img class="modal-img lazy" data-original="{{imageslim modalImg}}">
38 </div> 38 </div>
39 {{/if}} 39 {{/if}}
40 {{/isEqualOr}} 40 {{/isEqualOr}}
@@ -66,7 +66,7 @@ @@ -66,7 +66,7 @@
66 <div class="swiper-wrapper"> 66 <div class="swiper-wrapper">
67 {{#list}} 67 {{#list}}
68 <div class="swiper-slide" style="{{styleFormat this percent=1}}"> 68 <div class="swiper-slide" style="{{styleFormat this percent=1}}">
69 - <img src="{{image2 src q=75}}"> 69 + <img src="{{imageslim src}}">
70 <a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a> 70 <a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
71 </div> 71 </div>
72 {{/list}} 72 {{/list}}
@@ -88,7 +88,7 @@ @@ -88,7 +88,7 @@
88 88
89 {{#isEqualOr type 'productGroup'}} 89 {{#isEqualOr type 'productGroup'}}
90 {{! 商品池}} 90 {{! 商品池}}
91 - <div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{image2 proBgImg q=75}}) repeat;background-size:100%;"{{/if}}> 91 + <div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{imageslim proBgImg}}) repeat;background-size:100%;"{{/if}}>
92 <div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}" 92 <div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}"
93 {{#unless defaultPros.length}} 93 {{#unless defaultPros.length}}
94 {{#if searchCondition.item}} 94 {{#if searchCondition.item}}
@@ -103,9 +103,9 @@ @@ -103,9 +103,9 @@
103 <div class="feature-product-info {{#if ../searchCondition}}novisible{{/if}}"> 103 <div class="feature-product-info {{#if ../searchCondition}}novisible{{/if}}">
104 <a class="first-part product-detail" href='{{producturl}}'> 104 <a class="first-part product-detail" href='{{producturl}}'>
105 <div class="product-detail-imgbox"> 105 <div class="product-detail-imgbox">
106 - {{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{image2 ../lefTopImg q=75}}">{{/if}}  
107 - {{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{image2 ../rigTopImg q=75}}">{{/if}}  
108 - <img class="product-detail-img lazy" data-original="{{image2 productimg q=75}}"> 106 + {{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{imageslim ../lefTopImg}}">{{/if}}
  107 + {{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{imageslim ../rigTopImg}}">{{/if}}
  108 + <img class="product-detail-img lazy" data-original="{{imageslim productimg}}">
109 </div> 109 </div>
110 {{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}} 110 {{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}}
111 <div class="product-detail-text"> 111 <div class="product-detail-text">
@@ -128,7 +128,7 @@ @@ -128,7 +128,7 @@
128 <div class="brand-div"> 128 <div class="brand-div">
129 <span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span> 129 <span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span>
130 </div> 130 </div>
131 - <img class="brand-img lazy" data-original="{{image2 ../brandImg q=75}}"> 131 + <img class="brand-img lazy" data-original="{{imageslim ../brandImg}}">
132 </a> 132 </a>
133 {{/if}} 133 {{/if}}
134 </div> 134 </div>
@@ -137,8 +137,8 @@ @@ -137,8 +137,8 @@
137 <div class="feature-product-info novisible"> 137 <div class="feature-product-info novisible">
138 <a class="first-part product-detail" href=''> 138 <a class="first-part product-detail" href=''>
139 <div class="product-detail-imgbox"> 139 <div class="product-detail-imgbox">
140 - {{#if lefTopImg}}<img class="leftopimg" src="{{image2 lefTopImg q=75}}">{{/if}}  
141 - {{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=75}}">{{/if}} 140 + {{#if lefTopImg}}<img class="leftopimg" src="{{imageslim lefTopImg}}">{{/if}}
  141 + {{#if rigTopImg}}<img class="rigtopimg" src="{{imageslim rigTopImg}}">{{/if}}
142 <img class="product-detail-img" src=""> 142 <img class="product-detail-img" src="">
143 </div> 143 </div>
144 {{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}} 144 {{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}}
@@ -161,7 +161,7 @@ @@ -161,7 +161,7 @@
161 <div class="brand-div"> 161 <div class="brand-div">
162 <span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span> 162 <span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
163 </div> 163 </div>
164 - <img class="brand-img" src="{{image2 brandImg q=75}}"> 164 + <img class="brand-img" src="{{imageslim brandImg}}">
165 </a> 165 </a>
166 {{/if}} 166 {{/if}}
167 </div> 167 </div>
@@ -15,6 +15,10 @@ let configFile = ` @@ -15,6 +15,10 @@ let configFile = `
15 { 15 {
16 "appID": "EX33S4LRW7.com.yoho.buy", 16 "appID": "EX33S4LRW7.com.yoho.buy",
17 "paths": [ "*" ] 17 "paths": [ "*" ]
  18 + },
  19 + {
  20 + "appID": "FP8T8KM2NE.com.yoho.buy.c3",
  21 + "paths": [ "*" ]
18 } 22 }
19 ] 23 ]
20 } 24 }
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 var isWechat = /micromessenger/i.test(navigator.userAgent || ''); 26 var isWechat = /micromessenger/i.test(navigator.userAgent || '');
27 if (isWechat) { 27 if (isWechat) {
28 document.title =document.title.replace(' | Yoho!Buy有货 | 潮流购物逛不停', ''); 28 document.title =document.title.replace(' | Yoho!Buy有货 | 潮流购物逛不停', '');
29 - (function () { if (typeof (WeixinJSBridge) == "undefined") { document.addEventListener("WeixinJSBridgeReady", function (a) { setTimeout(function () { WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 }, function (b) { }) }, 0) }) } else { setTimeout(function () { WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 }, function (a) { }) }, 0) } })(); 29 + (function(){function setWechatSize(){if(typeof WeixinJSBridge!=="undefined"&&WeixinJSBridge.invoke){WeixinJSBridge.invoke("setFontSizeCallback",{fontSize:0},function(){})}}if(typeof WeixinJSBridge!=="undefined"){setTimeout(setWechatSize,0)}else{document.addEventListener("WeixinJSBridgeReady",function(){setTimeout(setWechatSize,0)})};}());
30 } 30 }
31 </script> 31 </script>
32 32
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.7.2", 3 + "version": "5.7.3",
4 "private": true, 4 "private": true,
5 "description": "A New Yohobuy Project With Express", 5 "description": "A New Yohobuy Project With Express",
6 "repository": { 6 "repository": {
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 "yoho-fastclick": "^1.0.6", 103 "yoho-fastclick": "^1.0.6",
104 "yoho-hammer": "^2.0.7", 104 "yoho-hammer": "^2.0.7",
105 "yoho-iscroll": "^5.2.0", 105 "yoho-iscroll": "^5.2.0",
106 - "yoho-jquery": "^2.2.4", 106 + "yoho-jquery": "^1.12.4",
107 "yoho-jquery-lazyload": "^1.9.12", 107 "yoho-jquery-lazyload": "^1.9.12",
108 "yoho-jquery-qrcode": "^0.14.0", 108 "yoho-jquery-qrcode": "^0.14.0",
109 "yoho-mlellipsis": "0.0.3", 109 "yoho-mlellipsis": "0.0.3",
@@ -15,13 +15,13 @@ let fCbFn, hCbFn; // 筛选和关闭的回调 @@ -15,13 +15,13 @@ let fCbFn, hCbFn; // 筛选和关闭的回调
15 // 隐藏筛选界面 15 // 隐藏筛选界面
16 function hideFilter() { 16 function hideFilter() {
17 setTimeout(function() { 17 setTimeout(function() {
18 - $filter.addClass('hide'); 18 + $filter && $filter.addClass('hide');
19 }, 301); 19 }, 301);
20 } 20 }
21 21
22 // 显示筛选界面 22 // 显示筛选界面
23 function showFilter() { 23 function showFilter() {
24 - $filter.removeClass('hide'); 24 + $filter && $filter.removeClass('hide');
25 } 25 }
26 26
27 // 一级菜单点击时背景高亮 27 // 一级菜单点击时背景高亮
@@ -313,8 +313,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW @@ -313,8 +313,7 @@ const processArticleDetail = (articleContent, isApp, gender, isWeixin, isqq, isW
313 finalDetail.push({ 313 finalDetail.push({
314 relatedReco: { 314 relatedReco: {
315 isApp: isApp, 315 isApp: isApp,
316 - goods: goodsData,  
317 - moreNum: goodsData.length - 2 > 0 ? goodsData.length - 2 : 0 316 + goods: goodsData
318 } 317 }
319 }); 318 });
320 } 319 }
@@ -380,14 +379,26 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => { @@ -380,14 +379,26 @@ const pushGoodsInfo = (finalDetail, goodsList, isApp) => {
380 379
381 _.forEach(finalDetail, (value, key) => { 380 _.forEach(finalDetail, (value, key) => {
382 if (value.relatedReco) { 381 if (value.relatedReco) {
383 - _.forEach(value.relatedReco.goods, (item, subKey) => {  
384 - if (goodsObj[item.id]) {  
385 - finalDetail[key].relatedReco.goods[subKey] = goodsObj[item.id]; 382 + let goodsIds = [];
  383 +
  384 + _.forEach(value.relatedReco.goods, relatedGoods => {
  385 + goodsIds.push(relatedGoods.id);
  386 + });
  387 +
  388 + goodsIds = _.uniq(goodsIds);
  389 + finalDetail[key].relatedReco.goods = [];
  390 +
  391 + _.forEach(goodsIds, (item, subKey) => {
  392 + if (goodsObj[item]) {
  393 + finalDetail[key].relatedReco.goods[subKey] = goodsObj[item];
386 } else { 394 } else {
387 delete finalDetail[key].relatedReco.goods[subKey]; 395 delete finalDetail[key].relatedReco.goods[subKey];
388 - finalDetail[key].relatedReco.moreNum--;  
389 } 396 }
390 }); 397 });
  398 +
  399 + let moreNum = _.get(finalDetail[key], 'relatedReco.goods.length', 0);
  400 +
  401 + finalDetail[key].relatedReco.moreNum = moreNum - 2 > 0 ? moreNum - 2 : 0;
391 } 402 }
392 403
393 if (value.collocation) { 404 if (value.collocation) {
@@ -143,6 +143,24 @@ module.exports = { @@ -143,6 +143,24 @@ module.exports = {
143 return ''; 143 return '';
144 } 144 }
145 }, 145 },
  146 +
  147 + /**
  148 + * 图片质量调整
  149 + */
  150 + imageslim: function(imageUrl) {
  151 + if (imageUrl && _.isString(imageUrl)) {
  152 + let urls = imageUrl.split('?');
  153 + let uri = urls[0];
  154 +
  155 + if (uri.indexOf('http:') === 0) {
  156 + uri = uri.replace('http:', '');
  157 + }
  158 +
  159 + return uri + '?imageslim';
  160 + } else {
  161 + return '';
  162 + }
  163 + },
146 isEqualOr: function() { 164 isEqualOr: function() {
147 let args = Array.prototype.slice.call(arguments); 165 let args = Array.prototype.slice.call(arguments);
148 let v1 = args[0]; 166 let v1 = args[0];