Authored by zzzzzzz

Merge branch 'release/usercenter' of git.yoho.cn:fe/yohobuywap-node into release/usercenter

@@ -29,6 +29,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { @@ -29,6 +29,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
29 29
30 return new Promise((resolve) => { 30 return new Promise((resolve) => {
31 let joinContentFunc = (i, len) => { 31 let joinContentFunc = (i, len) => {
  32 +
32 if (i < len) { 33 if (i < len) {
33 let build = {}; 34 let build = {};
34 let art = articleContent[i]; 35 let art = articleContent[i];
@@ -160,6 +161,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { @@ -160,6 +161,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
160 resolve(contents); 161 resolve(contents);
161 } 162 }
162 }; 163 };
  164 +
163 joinContentFunc(0, articleContent.length); 165 joinContentFunc(0, articleContent.length);
164 }); 166 });
165 }; 167 };
@@ -170,6 +172,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { @@ -170,6 +172,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
170 */ 172 */
171 const _relatedBrand = (getBrand) => { 173 const _relatedBrand = (getBrand) => {
172 let relatedBrand = getBrand; 174 let relatedBrand = getBrand;
  175 +
173 relatedBrand.forEach(brand => { 176 relatedBrand.forEach(brand => {
174 brand.thumb = brand.thumb.replace('http://', '//'); 177 brand.thumb = brand.thumb.replace('http://', '//');
175 }); 178 });
@@ -183,6 +186,7 @@ const _relatedBrand = (getBrand) => { @@ -183,6 +186,7 @@ const _relatedBrand = (getBrand) => {
183 */ 186 */
184 const _relatedTag = (tags, isApp) => { 187 const _relatedTag = (tags, isApp) => {
185 let relatedTag = []; 188 let relatedTag = [];
  189 +
186 tags.forEach(value => { 190 tags.forEach(value => {
187 if (!isApp) { 191 if (!isApp) {
188 value.url = helpers.urlFormat('/tags/index', { 192 value.url = helpers.urlFormat('/tags/index', {
@@ -201,6 +205,7 @@ const _relatedTag = (tags, isApp) => { @@ -201,6 +205,7 @@ const _relatedTag = (tags, isApp) => {
201 */ 205 */
202 const _relatedInfo = (getOtherArticle, isApp) => { 206 const _relatedInfo = (getOtherArticle, isApp) => {
203 let relatedInfo = []; 207 let relatedInfo = [];
  208 +
204 getOtherArticle.forEach(value => { 209 getOtherArticle.forEach(value => {
205 if (!isApp) { 210 if (!isApp) {
206 value.url = helpers.urlFormat('/info/index', { 211 value.url = helpers.urlFormat('/info/index', {
@@ -220,6 +225,7 @@ const _relatedInfo = (getOtherArticle, isApp) => { @@ -220,6 +225,7 @@ const _relatedInfo = (getOtherArticle, isApp) => {
220 */ 225 */
221 const _shareInfo = (id, getArticle) => { 226 const _shareInfo = (id, getArticle) => {
222 let shareInfo = {}; 227 let shareInfo = {};
  228 +
223 shareInfo.shareLink = helpers.urlFormat('/info/index', { 229 shareInfo.shareLink = helpers.urlFormat('/info/index', {
224 id: id 230 id: id
225 }, 'guang'); 231 }, 'guang');
@@ -317,6 +323,7 @@ const index = (req, res, next) => { @@ -317,6 +323,7 @@ const index = (req, res, next) => {
317 // 分享参数 323 // 分享参数
318 if (detail.getArticle.cover_image) { 324 if (detail.getArticle.cover_image) {
319 let shareInfo = _shareInfo(id, detail.getArticle); 325 let shareInfo = _shareInfo(id, detail.getArticle);
  326 +
320 Object.assign(guang, shareInfo); 327 Object.assign(guang, shareInfo);
321 data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停'; 328 data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停';
322 data.title_more = true; 329 data.title_more = true;
@@ -391,6 +398,7 @@ const mini = (req, res, next) => { @@ -391,6 +398,7 @@ const mini = (req, res, next) => {
391 // 分享参数 398 // 分享参数
392 if (detail.getArticle.cover_image) { 399 if (detail.getArticle.cover_image) {
393 let shareInfo = _shareInfo(id, detail.getArticle); 400 let shareInfo = _shareInfo(id, detail.getArticle);
  401 +
394 Object.assign(guang, shareInfo); 402 Object.assign(guang, shareInfo);
395 } 403 }
396 404
@@ -446,9 +454,11 @@ const foryoho = (req, res, next) => { @@ -446,9 +454,11 @@ const foryoho = (req, res, next) => {
446 let relatedRecoIndex = data.content.findIndex((cont) => { 454 let relatedRecoIndex = data.content.findIndex((cont) => {
447 return typeof cont.relatedReco !== 'undefined'; 455 return typeof cont.relatedReco !== 'undefined';
448 }); 456 });
  457 +
449 let collocationIndex = data.content.findIndex((cont) => { 458 let collocationIndex = data.content.findIndex((cont) => {
450 return typeof cont.collocation !== 'undefined'; 459 return typeof cont.collocation !== 'undefined';
451 }); 460 });
  461 +
452 if (relatedRecoIndex > 0) { 462 if (relatedRecoIndex > 0) {
453 data.goods = data.content[relatedRecoIndex].relatedReco; 463 data.goods = data.content[relatedRecoIndex].relatedReco;
454 data.content.splice(relatedRecoIndex, 1); 464 data.content.splice(relatedRecoIndex, 1);
@@ -237,6 +237,10 @@ const brand = (req, res, next) => { @@ -237,6 +237,10 @@ const brand = (req, res, next) => {
237 } 237 }
238 238
239 listModel.getBrandLogoByDomain(domain).then(result => { 239 listModel.getBrandLogoByDomain(domain).then(result => {
  240 + if (!result) {
  241 + return next();
  242 + }
  243 +
240 brandLogo = result; 244 brandLogo = result;
241 245
242 title = brandLogo.name; 246 title = brandLogo.name;
@@ -942,13 +942,10 @@ let _getPromotionInfo = (skn) => { @@ -942,13 +942,10 @@ let _getPromotionInfo = (skn) => {
942 method: 'app.product.promotion', 942 method: 'app.product.promotion',
943 product_skn: _.toString(skn) 943 product_skn: _.toString(skn)
944 }, { 944 }, {
  945 + code: 200,
945 cache: true 946 cache: true
946 }).then((result) => { 947 }).then((result) => {
947 - if (result.code === 200) {  
948 - return result.data;  
949 - }  
950 -  
951 - return {}; 948 + return result && result.data;
952 }); 949 });
953 }; 950 };
954 951
@@ -599,16 +599,18 @@ const getBrandIntro = (brandId, uid) => { @@ -599,16 +599,18 @@ const getBrandIntro = (brandId, uid) => {
599 code: 200, 599 code: 200,
600 cache: true 600 cache: true
601 }).then(result => { 601 }).then(result => {
  602 + if (result && result.data) {
  603 + let list = result.data;
602 604
603 - let list = result.data;  
604 -  
605 - return {  
606 - id: list.brand_id,  
607 - intro: list.brand_intro,  
608 - collected: list.is_favorite && list.is_favorite === 'Y',  
609 - title: list.brand_name ? list.brand_name : ''  
610 - };  
611 - 605 + return {
  606 + id: list.brand_id,
  607 + intro: list.brand_intro,
  608 + collected: list.is_favorite && list.is_favorite === 'Y',
  609 + title: list.brand_name ? list.brand_name : ''
  610 + };
  611 + } else {
  612 + return false;
  613 + }
612 }); 614 });
613 }; 615 };
614 616
@@ -650,7 +652,7 @@ const getBrandLogoByDomain = (domain) => { @@ -650,7 +652,7 @@ const getBrandLogoByDomain = (domain) => {
650 code: 200, 652 code: 200,
651 cache: true 653 cache: true
652 }).then(result => { 654 }).then(result => {
653 - if (result.data) { 655 + if (result && result.data) {
654 let formatData = result.data; 656 let formatData = result.data;
655 657
656 return { 658 return {
@@ -131,7 +131,7 @@ const getSearchData = (params) => { @@ -131,7 +131,7 @@ const getSearchData = (params) => {
131 return _searchGoods(params).then((result) => { 131 return _searchGoods(params).then((result) => {
132 if (result && result.code === 200) { 132 if (result && result.code === 200) {
133 return productProcess.processProductList(result.data.product_list || [], { 133 return productProcess.processProductList(result.data.product_list || [], {
134 - isApp: params.appVersion, 134 + isApp: params.appVersion && params.appVersion !== 'false',
135 gender: _coverChannel[params.coverChannel] 135 gender: _coverChannel[params.coverChannel]
136 }); 136 });
137 } else { 137 } else {
@@ -16,15 +16,15 @@ module.exports = { @@ -16,15 +16,15 @@ module.exports = {
16 siteUrl: '//m.yohobuy.com', 16 siteUrl: '//m.yohobuy.com',
17 assetUrl: '//localhost:5001', 17 assetUrl: '//localhost:5001',
18 domains: { 18 domains: {
19 - // api: 'http://api.yoho.cn/',  
20 - // service: 'http://service.yoho.cn/',  
21 - // liveApi: 'http://api.live.yoho.cn/',  
22 - // singleApi: 'http://single.yoho.cn/', 19 + api: 'http://api.yoho.cn/',
  20 + service: 'http://service.yoho.cn/',
  21 + liveApi: 'http://api.live.yoho.cn/',
  22 + singleApi: 'http://single.yoho.cn/',
23 23
24 - api: 'http://api-test1.yohops.com:9999/',  
25 - service: 'http://service-test1.yohops.com:9999/',  
26 - liveApi: 'http://testapi.live.yohops.com:9999/',  
27 - singleApi: 'http://api-test1.yohops.com:9999/', 24 + // api: 'http://api-test1.yohops.com:9999/',
  25 + // service: 'http://service-test1.yohops.com:9999/',
  26 + // liveApi: 'http://testapi.live.yohops.com:9999/',
  27 + // singleApi: 'http://api-test1.yohops.com:9999/',
28 }, 28 },
29 subDomains: { 29 subDomains: {
30 host: '.m.yohobuy.com', 30 host: '.m.yohobuy.com',
@@ -31,6 +31,8 @@ var historyval = writeSearch.getHistoryval(); @@ -31,6 +31,8 @@ var historyval = writeSearch.getHistoryval();
31 31
32 var chHammer, cHammer; 32 var chHammer, cHammer;
33 33
  34 +require('../../common');
  35 +
34 chHammer = new Hammer($clearHistory[0]); 36 chHammer = new Hammer($clearHistory[0]);
35 37
36 chHammer.on('tap', function() { 38 chHammer.on('tap', function() {
@@ -50,7 +52,7 @@ chHammer.on('tap', function() { @@ -50,7 +52,7 @@ chHammer.on('tap', function() {
50 $historySearch.hide(); 52 $historySearch.hide();
51 $clearHistory.hide(); 53 $clearHistory.hide();
52 54
53 - // window.rePosFooter(); 55 + window.rePosFooter();
54 56
55 dialog.showDialog({ 57 dialog.showDialog({
56 dialogText: '删除成功', 58 dialogText: '删除成功',
@@ -36,7 +36,7 @@ var $subNav = $('.home-sub-nav'), @@ -36,7 +36,7 @@ var $subNav = $('.home-sub-nav'),
36 brand = $('input[name="brand"]').val(), 36 brand = $('input[name="brand"]').val(),
37 coverChannel = $('input[name="coverChannel"]').val(), 37 coverChannel = $('input[name="coverChannel"]').val(),
38 favId = $('input[name="favId"]').val(); 38 favId = $('input[name="favId"]').val();
39 - uid = $('input[name="uid"]').val(); 39 +uid = $('input[name="uid"]').val();
40 40
41 var winH = $(window).height(), 41 var winH = $(window).height(),
42 noResult = '<p class="no-result">未找到相关搜索结果</p>'; 42 noResult = '<p class="no-result">未找到相关搜索结果</p>';
@@ -230,7 +230,8 @@ function newData(callback) { @@ -230,7 +230,8 @@ function newData(callback) {
230 type: 'new', 230 type: 'new',
231 order: '0', 231 order: '0',
232 page: navInfo.new.page, 232 page: navInfo.new.page,
233 - tagNew: '1' 233 + tagNew: '1',
  234 + appVersion: appVersion
234 }; 235 };
235 236
236 getParam(req); 237 getParam(req);
@@ -255,7 +256,8 @@ function hotData(callback) { @@ -255,7 +256,8 @@ function hotData(callback) {
255 type: 'hot', 256 type: 'hot',
256 order: '1', 257 order: '1',
257 page: navInfo.hot.page, 258 page: navInfo.hot.page,
258 - showTag: '1' 259 + showTag: '1',
  260 + appVersion: appVersion
259 }; 261 };
260 262
261 getParam(req); 263 getParam(req);
@@ -587,6 +587,7 @@ @@ -587,6 +587,7 @@
587 margin-top: 1px; 587 margin-top: 1px;
588 588
589 .filter-body { 589 .filter-body {
  590 + top: 1px;
590 overflow: auto; 591 overflow: auto;
591 } 592 }
592 593