Authored by ccbikai(👎🏻🍜)

Merge branch 'master' into qCloud

@@ -104,9 +104,10 @@ const getResources = (params, options) => { @@ -104,9 +104,10 @@ const getResources = (params, options) => {
104 } 104 }
105 105
106 list = { 106 list = {
  107 + id: res.template_id,
107 title: res.data.title, 108 title: res.data.title,
108 - more_url: res.data.more_url,  
109 - more_name: res.data.more_name, 109 + moreUrl: res.data.more_url,
  110 + moreName: res.data.more_name,
110 image: res.data.image 111 image: res.data.image
111 }; 112 };
112 113
@@ -115,8 +116,8 @@ const getResources = (params, options) => { @@ -115,8 +116,8 @@ const getResources = (params, options) => {
115 case 'titleFloor': 116 case 'titleFloor':
116 list = { 117 list = {
117 name: res.data.title.name, 118 name: res.data.title.name,
118 - more_url: res.data.title.more_url,  
119 - more_name: res.data.title.more_name 119 + moreUrl: res.data.title.more_url,
  120 + moreName: res.data.title.more_name
120 }; 121 };
121 122
122 if (res.data.title.name === '热门商品') { 123 if (res.data.title.name === '热门商品') {
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <div class="focus-left-right"> 45 <div class="focus-left-right">
46 {{#each result.focus2.data}} 46 {{#each result.focus2.data}}
47 <a href="{{url}}" title="{{title}}"> 47 <a href="{{url}}" title="{{title}}">
48 - <img class="lazy" data-original="{{image src 250 250}}"> 48 + <img src="{{image src 250 250}}">
49 </a> 49 </a>
50 {{/each}} 50 {{/each}}
51 </div> 51 </div>
@@ -208,7 +208,7 @@ const myDetails = (uid) => { @@ -208,7 +208,7 @@ const myDetails = (uid) => {
208 // return finalResult; 208 // return finalResult;
209 }); 209 });
210 } else { 210 } else {
211 - return false; 211 + return Promise.resolve({});
212 } 212 }
213 }; 213 };
214 214
@@ -404,7 +404,7 @@ const getGrade = (param) => { @@ -404,7 +404,7 @@ const getGrade = (param) => {
404 return resu; 404 return resu;
405 }); 405 });
406 } else { 406 } else {
407 - return false; 407 + return Promise.resolve({});
408 } 408 }
409 }; 409 };
410 410
@@ -16,7 +16,7 @@ module.exports = (req, res, next) => { @@ -16,7 +16,7 @@ module.exports = (req, res, next) => {
16 }); 16 });
17 } 17 }
18 18
19 - res.redirect(helpers.urlFormat('/signin.html', { 19 + return res.redirect(helpers.urlFormat('/signin.html', {
20 refer: req.originalUrl 20 refer: req.originalUrl
21 })); 21 }));
22 } 22 }
@@ -16,6 +16,12 @@ module.exports = () => { @@ -16,6 +16,12 @@ module.exports = () => {
16 req.url = `/activity${req.url}`; 16 req.url = `/activity${req.url}`;
17 } 17 }
18 18
  19 + if (/^\/sale/.test(req.url)) {
  20 + // sale 兼容php的url
  21 + res.redirect(301, helpers.urlFormat('/product/sale', req.query, 'default'));
  22 + return;
  23 + }
  24 +
19 if (req.subdomains.length) { 25 if (req.subdomains.length) {
20 switch (req.subdomains[0]) { 26 switch (req.subdomains[0]) {
21 case 'guang': // 逛 27 case 'guang': // 逛
@@ -75,4 +81,4 @@ module.exports = () => { @@ -75,4 +81,4 @@ module.exports = () => {
75 } 81 }
76 next(); 82 next();
77 }; 83 };
78 -};  
  84 +};
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.0.11", 3 + "version": "5.0.12",
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": {
@@ -352,32 +352,34 @@ function givePoint(parameter) { @@ -352,32 +352,34 @@ function givePoint(parameter) {
352 var channel = cookie('_Channel'); 352 var channel = cookie('_Channel');
353 var header = $('#yoho-header'); 353 var header = $('#yoho-header');
354 354
355 - switch (channel) {  
356 - case 'boys':  
357 - if (!header.hasClass('boys')) {  
358 - header.addClass('boys');  
359 - }  
360 - break;  
361 - case 'girls':  
362 - if (!header.hasClass('girls')) {  
363 - header.addClass('girls');  
364 - }  
365 - break;  
366 - case 'lifestyle':  
367 - if (!header.hasClass('life-style')) {  
368 - header.addClass('life-style');  
369 - }  
370 - break;  
371 - case 'kids':  
372 - if (!header.hasClass('kids')) {  
373 - header.addClass('kids');  
374 - }  
375 - break;  
376 - default:  
377 - if (!header.hasClass('boys')) {  
378 - header.addClass('boys');  
379 - }  
380 - break; 355 + if (!/^\/home/.test(location.pathname)) {
  356 + switch (channel) {
  357 + case 'boys':
  358 + if (!header.hasClass('boys')) {
  359 + header.addClass('boys');
  360 + }
  361 + break;
  362 + case 'girls':
  363 + if (!header.hasClass('girls')) {
  364 + header.addClass('girls');
  365 + }
  366 + break;
  367 + case 'lifestyle':
  368 + if (!header.hasClass('life-style')) {
  369 + header.addClass('life-style');
  370 + }
  371 + break;
  372 + case 'kids':
  373 + if (!header.hasClass('kids')) {
  374 + header.addClass('kids');
  375 + }
  376 + break;
  377 + default:
  378 + if (!header.hasClass('boys')) {
  379 + header.addClass('boys');
  380 + }
  381 + break;
  382 + }
381 } 383 }
382 }()); 384 }());
383 385
1 var $ = require('yoho-jquery'), 1 var $ = require('yoho-jquery'),
2 tip = require('../plugin/tip'), 2 tip = require('../plugin/tip'),
3 Swiper = require('yoho-swiper'), 3 Swiper = require('yoho-swiper'),
4 - loading = require('../plugin/loading'),  
5 - lazyLoad = require('yoho-jquery-lazyload'); 4 + loading = require('../plugin/loading');
6 5
7 var plusstar = {}, 6 var plusstar = {},
8 $footer = $('#yoho-footer'); 7 $footer = $('#yoho-footer');
9 8
  9 +require('yoho-jquery-lazyload');
10 require('../common'); 10 require('../common');
11 11
12 plusstar = { 12 plusstar = {
@@ -82,16 +82,8 @@ plusstar = { @@ -82,16 +82,8 @@ plusstar = {
82 that.resInit(); 82 that.resInit();
83 83
84 loading.hideLoadingMask(); 84 loading.hideLoadingMask();
85 - lazyLoad($('img.lazy'));  
86 -  
87 - // 处理左右滑动,未加载的图片  
88 - setTimeout(function() {  
89 - $('img.lazy').each(function() {  
90 - if ($(this).attr('src') !== $(this).data('original')) {  
91 - $(this).attr('src', $(this).data('original'));  
92 - }  
93 - });  
94 - }, 40); 85 +
  86 + $('.plusstar-resources').find('img.lazy').lazyload();
95 87
96 // 设置滚动条的位置 88 // 设置滚动条的位置
97 if (window.localStorage) { 89 if (window.localStorage) {
@@ -169,36 +169,42 @@ $search.on('touchend', function() { @@ -169,36 +169,42 @@ $search.on('touchend', function() {
169 history, 169 history,
170 historys, i, num = 1; 170 historys, i, num = 1;
171 171
172 - if (localStorage) {  
173 - historys = localStorage.getItem(historyval); 172 + try {
  173 + if (localStorage) {
  174 + historys = localStorage.getItem(historyval);
174 175
175 - if (historys && historys.length > 0) {  
176 - historys = historys.split(ranToken);  
177 - for (i = historys.length; i > 0; i--) {  
178 - history = historys[i - 1]; 176 + if (historys && historys.length > 0) {
  177 + historys = historys.split(ranToken);
  178 + for (i = historys.length; i > 0; i--) {
  179 + history = historys[i - 1];
179 180
180 - if (history === '') {  
181 - continue;  
182 - } 181 + if (history === '') {
  182 + continue;
  183 + }
183 184
184 - if (num++ > 10) {  
185 - break; 185 + if (num++ > 10) {
  186 + break;
  187 + }
  188 +
  189 + html += '<li><a href="javascript:void(0);">' + history + '</li>';
186 } 190 }
187 191
188 - html += '<li><a href="javascript:void(0);">' + history + '</li>';  
189 - } 192 + $history.html(html);
190 193
191 - $history.html(html); 194 + if (html !== '') {
  195 + $clearHistory.removeClass('hide');
  196 + $historySearch.removeClass('hide');
  197 + }
192 198
193 - if (html !== '') {  
194 - $clearHistory.removeClass('hide');  
195 - $historySearch.removeClass('hide'); 199 + window.rePosFooter();
  200 + } else {
  201 + $historySearch.hide();
  202 + $clearHistory.hide();
196 } 203 }
197 -  
198 - window.rePosFooter();  
199 - } else {  
200 - $historySearch.hide();  
201 - $clearHistory.hide();  
202 } 204 }
  205 + } catch (e) {
  206 + console.log(e);
  207 + $historySearch.hide();
  208 + $clearHistory.hide();
203 } 209 }
204 }()); 210 }());
@@ -20,17 +20,21 @@ function getHistoryval() { @@ -20,17 +20,21 @@ function getHistoryval() {
20 function setHistoryValFun(query) { 20 function setHistoryValFun(query) {
21 var historys; 21 var historys;
22 22
23 - if (localStorage) {  
24 - historys = localStorage.getItem(historyval); 23 + try {
  24 + if (localStorage) {
  25 + historys = localStorage.getItem(historyval);
25 26
26 - historys = historys ? historys.replace(new RegExp((query + ranToken), 'g'), '') : ''; 27 + historys = historys ? historys.replace(new RegExp((query + ranToken), 'g'), '') : '';
27 28
28 - if (historys === '') {  
29 - query = ranToken + query;  
30 - } 29 + if (historys === '') {
  30 + query = ranToken + query;
  31 + }
31 32
32 - historys += query + ranToken;  
33 - localStorage.setItem(historyval, historys); 33 + historys += query + ranToken;
  34 + localStorage.setItem(historyval, historys);
  35 + }
  36 + } catch (e) {
  37 + console.log(e);
34 } 38 }
35 } 39 }
36 40
@@ -163,13 +163,11 @@ @@ -163,13 +163,11 @@
163 a { 163 a {
164 display: inline-block; 164 display: inline-block;
165 margin: 0 15px; 165 margin: 0 15px;
166 - width: 213px;  
167 - height: 213px;  
168 } 166 }
169 167
170 img { 168 img {
171 - width: 100%;  
172 - height: 100%; 169 + width: 213px;
  170 + height: 213px;
173 } 171 }
174 } 172 }
175 173
@@ -180,7 +178,11 @@ @@ -180,7 +178,11 @@
180 a { 178 a {
181 display: inline-block; 179 display: inline-block;
182 width: 50%; 180 width: 50%;
183 - overflow: hidden; 181 +
  182 + img {
  183 + width: 320px;
  184 + height: 320px;
  185 + }
184 } 186 }
185 } 187 }
186 188
@@ -88,6 +88,10 @@ exports.processProductList = (list, options) => { @@ -88,6 +88,10 @@ exports.processProductList = (list, options) => {
88 }, options); 88 }, options);
89 89
90 _.forEach(list, (product) => { 90 _.forEach(list, (product) => {
  91 + if (!product) {
  92 + return;
  93 + }
  94 +
91 // 商品信息有问题,则不显示 95 // 商品信息有问题,则不显示
92 if (!product.product_id || !product.goods_list || product.goods_list.length === 0) { 96 if (!product.product_id || !product.goods_list || product.goods_list.length === 0) {
93 return; 97 return;