Authored by zhangxiaoru

merge

@@ -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];
@@ -72,32 +73,35 @@ const _pageArticleContent = (articleContent, isApp, gender) => { @@ -72,32 +73,35 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
72 73
73 // 通过SKN获取商品信息 74 // 通过SKN获取商品信息
74 productDetailModel.productInfoBySkns(skns).then((product) => { 75 productDetailModel.productInfoBySkns(skns).then((product) => {
75 - if (product.data && product.data.product_list) {  
76 - let d = []; 76 + if (product && product.data) {
  77 + if (product.data.product_list) {
  78 + let d = [];
77 79
78 - for (let o = 0; o < product.data.product_list.length; o++) {  
79 - let goods = product.data.product_list[o]; 80 + for (let o = 0; o < product.data.product_list.length; o++) {
  81 + let goods = product.data.product_list[o];
80 82
81 - // 最多显示4个  
82 - if (o > 3) {  
83 - break; 83 + // 最多显示4个
  84 + if (o > 3) {
  85 + break;
  86 + }
  87 + d.push(guangProcess.formatProduct(goods, false, true, true, 235, 314, isApp, true, gender));
84 } 88 }
85 - d.push(guangProcess.formatProduct(goods, false, true, true, 235, 314, isApp, true, gender)); 89 + d.forEach(p => {
  90 + if (arr[p.id]) {
  91 + p.thumb = helpers.image(arr[p.id], 235, 314);
  92 + reco.push(p);
  93 + }
  94 + });
86 } 95 }
87 - d.forEach(p => {  
88 - if (arr[p.id]) {  
89 - p.thumb = helpers.image(arr[p.id], 235, 314);  
90 - reco.push(p);  
91 - }  
92 - });  
93 - }  
94 96
95 - // 多个商品  
96 - if (product.data.product_list.length > 1) {  
97 - build.relatedReco = reco;  
98 - } else if (product.data.product_list.length === 1) { // 单个商品  
99 - build.relatedReco = reco[0]; 97 + // 多个商品
  98 + if (product.data.product_list.length && (product.data.product_list.length > 1)) {
  99 + build.relatedReco = reco;
  100 + } else if (product.data.product_list.length === 1) { // 单个商品
  101 + build.relatedReco = reco[0];
  102 + }
100 } 103 }
  104 +
101 contents.push(build); 105 contents.push(build);
102 joinContentFunc(++i, len); 106 joinContentFunc(++i, len);
103 }); 107 });
@@ -120,7 +124,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { @@ -120,7 +124,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
120 124
121 // 通过SKN获取商品信息 125 // 通过SKN获取商品信息
122 productDetailModel.productInfoBySkns(skns).then((product) => { 126 productDetailModel.productInfoBySkns(skns).then((product) => {
123 - if (product.data.product_list) { 127 + if (product && product.data && product.data.product_list) {
124 let g = []; 128 let g = [];
125 129
126 product.data.product_list.forEach(_ => { 130 product.data.product_list.forEach(_ => {
@@ -157,6 +161,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { @@ -157,6 +161,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
157 resolve(contents); 161 resolve(contents);
158 } 162 }
159 }; 163 };
  164 +
160 joinContentFunc(0, articleContent.length); 165 joinContentFunc(0, articleContent.length);
161 }); 166 });
162 }; 167 };
@@ -167,6 +172,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => { @@ -167,6 +172,7 @@ const _pageArticleContent = (articleContent, isApp, gender) => {
167 */ 172 */
168 const _relatedBrand = (getBrand) => { 173 const _relatedBrand = (getBrand) => {
169 let relatedBrand = getBrand; 174 let relatedBrand = getBrand;
  175 +
170 relatedBrand.forEach(brand => { 176 relatedBrand.forEach(brand => {
171 brand.thumb = brand.thumb.replace('http://', '//'); 177 brand.thumb = brand.thumb.replace('http://', '//');
172 }); 178 });
@@ -180,6 +186,7 @@ const _relatedBrand = (getBrand) => { @@ -180,6 +186,7 @@ const _relatedBrand = (getBrand) => {
180 */ 186 */
181 const _relatedTag = (tags, isApp) => { 187 const _relatedTag = (tags, isApp) => {
182 let relatedTag = []; 188 let relatedTag = [];
  189 +
183 tags.forEach(value => { 190 tags.forEach(value => {
184 if (!isApp) { 191 if (!isApp) {
185 value.url = helpers.urlFormat('/tags/index', { 192 value.url = helpers.urlFormat('/tags/index', {
@@ -198,6 +205,7 @@ const _relatedTag = (tags, isApp) => { @@ -198,6 +205,7 @@ const _relatedTag = (tags, isApp) => {
198 */ 205 */
199 const _relatedInfo = (getOtherArticle, isApp) => { 206 const _relatedInfo = (getOtherArticle, isApp) => {
200 let relatedInfo = []; 207 let relatedInfo = [];
  208 +
201 getOtherArticle.forEach(value => { 209 getOtherArticle.forEach(value => {
202 if (!isApp) { 210 if (!isApp) {
203 value.url = helpers.urlFormat('/info/index', { 211 value.url = helpers.urlFormat('/info/index', {
@@ -217,6 +225,7 @@ const _relatedInfo = (getOtherArticle, isApp) => { @@ -217,6 +225,7 @@ const _relatedInfo = (getOtherArticle, isApp) => {
217 */ 225 */
218 const _shareInfo = (id, getArticle) => { 226 const _shareInfo = (id, getArticle) => {
219 let shareInfo = {}; 227 let shareInfo = {};
  228 +
220 shareInfo.shareLink = helpers.urlFormat('/info/index', { 229 shareInfo.shareLink = helpers.urlFormat('/info/index', {
221 id: id 230 id: id
222 }, 'guang'); 231 }, 'guang');
@@ -234,7 +243,7 @@ const _shareInfo = (id, getArticle) => { @@ -234,7 +243,7 @@ const _shareInfo = (id, getArticle) => {
234 * [逛资讯详情页] 243 * [逛资讯详情页]
235 */ 244 */
236 const index = (req, res, next) => { 245 const index = (req, res, next) => {
237 - let id = req.query.id, 246 + let id = req.query.id || req.params.id,
238 gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1, 247 gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || 1,
239 isApp = req.query.app_version || req.query.appVersion || false, // 标识是不是APP访问的 248 isApp = req.query.app_version || req.query.appVersion || false, // 标识是不是APP访问的
240 parameter = {}, 249 parameter = {},
@@ -314,6 +323,7 @@ const index = (req, res, next) => { @@ -314,6 +323,7 @@ const index = (req, res, next) => {
314 // 分享参数 323 // 分享参数
315 if (detail.getArticle.cover_image) { 324 if (detail.getArticle.cover_image) {
316 let shareInfo = _shareInfo(id, detail.getArticle); 325 let shareInfo = _shareInfo(id, detail.getArticle);
  326 +
317 Object.assign(guang, shareInfo); 327 Object.assign(guang, shareInfo);
318 data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停'; 328 data.title = detail.getArticle.article_title + ' | Yoho!Buy有货 | 潮流购物逛不停';
319 data.title_more = true; 329 data.title_more = true;
@@ -388,6 +398,7 @@ const mini = (req, res, next) => { @@ -388,6 +398,7 @@ const mini = (req, res, next) => {
388 // 分享参数 398 // 分享参数
389 if (detail.getArticle.cover_image) { 399 if (detail.getArticle.cover_image) {
390 let shareInfo = _shareInfo(id, detail.getArticle); 400 let shareInfo = _shareInfo(id, detail.getArticle);
  401 +
391 Object.assign(guang, shareInfo); 402 Object.assign(guang, shareInfo);
392 } 403 }
393 404
@@ -443,9 +454,11 @@ const foryoho = (req, res, next) => { @@ -443,9 +454,11 @@ const foryoho = (req, res, next) => {
443 let relatedRecoIndex = data.content.findIndex((cont) => { 454 let relatedRecoIndex = data.content.findIndex((cont) => {
444 return typeof cont.relatedReco !== 'undefined'; 455 return typeof cont.relatedReco !== 'undefined';
445 }); 456 });
  457 +
446 let collocationIndex = data.content.findIndex((cont) => { 458 let collocationIndex = data.content.findIndex((cont) => {
447 return typeof cont.collocation !== 'undefined'; 459 return typeof cont.collocation !== 'undefined';
448 }); 460 });
  461 +
449 if (relatedRecoIndex > 0) { 462 if (relatedRecoIndex > 0) {
450 data.goods = data.content[relatedRecoIndex].relatedReco; 463 data.goods = data.content[relatedRecoIndex].relatedReco;
451 data.content.splice(relatedRecoIndex, 1); 464 data.content.splice(relatedRecoIndex, 1);
@@ -43,6 +43,7 @@ router.post('/opt/praiseArticle', opt.praiseArticle); // 资讯文章点赞 (H5 @@ -43,6 +43,7 @@ router.post('/opt/praiseArticle', opt.praiseArticle); // 资讯文章点赞 (H5
43 router.post('/opt/favoriteBrand', opt.favoriteBrand); // 品牌收藏 43 router.post('/opt/favoriteBrand', opt.favoriteBrand); // 品牌收藏
44 44
45 router.get('/info/index', info.index); // 逛详情页 45 router.get('/info/index', info.index); // 逛详情页
  46 +router.get('/:id.html', info.index); // 逛详情页(兼容 PC 跳转过来的链接)
46 router.get('/info/mini', info.mini); // 逛mini内容页 47 router.get('/info/mini', info.mini); // 逛mini内容页
47 router.get('/info/foryoho', info.foryoho); // 逛foryoho内容页 48 router.get('/info/foryoho', info.foryoho); // 逛foryoho内容页
48 49
@@ -308,12 +308,20 @@ const postAccount = (req, res) => { @@ -308,12 +308,20 @@ const postAccount = (req, res) => {
308 }; 308 };
309 309
310 const startingService = (req, res) => { 310 const startingService = (req, res) => {
  311 + const banks = ['农业银行', '中国银行', '工商银行', '建设银行', '光大银行', '兴业银行', '邮储银行', '民生银行', '中信银行', '广发银行'];
  312 +
  313 + if (new Date() >= new Date('2016-10-18 00:00:00')) {
  314 + // 2016年10月12日至17日 平安银行业务暂停(平安银行期间不支持服务)
  315 + banks.push('平安银行');
  316 + }
  317 +
311 res.render('installment/starting-service', { 318 res.render('installment/starting-service', {
312 module: 'home', 319 module: 'home',
313 page: 'installment.starting-service', 320 page: 'installment.starting-service',
314 title: '开通有货分期', 321 title: '开通有货分期',
315 navTitle: '开通有货分期', 322 navTitle: '开通有货分期',
316 - navBtn: false 323 + navBtn: false,
  324 + banks: banks.join('、')
317 }); 325 });
318 }; 326 };
319 327
@@ -78,9 +78,7 @@ @@ -78,9 +78,7 @@
78 <div class="notice-area"> 78 <div class="notice-area">
79 <div class="notice-cont"> 79 <div class="notice-cont">
80 <h2>支持银行</h2> 80 <h2>支持银行</h2>
81 - <p>农业银行、中国银行、工商银行、建设银行、</p>  
82 - <p>光大银行、兴业银行、邮储银行、民生银行、</p>  
83 - <p>平安银行、中信银行、广发银行</p> 81 + <p>{{banks}}</p>
84 </div> 82 </div>
85 <div class="think-ok">我知道了</div> 83 <div class="think-ok">我知道了</div>
86 </div> 84 </div>
@@ -63,8 +63,14 @@ const _baseShop = (req, res, shopInfo, shopId) => { @@ -63,8 +63,14 @@ const _baseShop = (req, res, shopInfo, shopId) => {
63 * 基础模板收藏 63 * 基础模板收藏
64 */ 64 */
65 const baseShopFav = (req, res) => { 65 const baseShopFav = (req, res) => {
  66 + let allowOrigin = _.get(req, 'headers.origin', null) ?
  67 + req.headers.origin : req.protocol + '://' + req.headers.host;
  68 +
  69 + res.setHeader('Access-Control-Allow-Origin', allowOrigin);
  70 + res.setHeader('Access-Control-Allow-Credentials', 'true');
  71 +
66 let isApp = req.query.app_version || req.query.appVersion || false; 72 let isApp = req.query.app_version || req.query.appVersion || false;
67 - let uid = isApp ? req.query.uid : req.user.uid; 73 + let uid = req.user.uid || req.query.uid || req.cookies.appUid || _getUidFromUserAgent(req);
68 let shopId = req.query.shopId; 74 let shopId = req.query.shopId;
69 75
70 listModel.getShopData(req, shopId, uid, isApp).then(result => { 76 listModel.getShopData(req, shopId, uid, isApp).then(result => {
@@ -116,7 +122,7 @@ const _shop = (req, res, shopId) => { @@ -116,7 +122,7 @@ const _shop = (req, res, shopId) => {
116 } else { 122 } else {
117 listModel.searchProductBySkn(result.hotListproductSkn).then(hotList => { 123 listModel.searchProductBySkn(result.hotListproductSkn).then(hotList => {
118 result = _.assign(result, pageHeader, { 124 result = _.assign(result, pageHeader, {
119 - hotList: productProcess.processProductList(hotList) 125 + hotList: productProcess.processProductList(hotList, {isApp: isApp})
120 }); 126 });
121 127
122 _.forEach(result.hotList, (value, key) => { 128 _.forEach(result.hotList, (value, key) => {
@@ -148,6 +154,12 @@ const _shop = (req, res, shopId) => { @@ -148,6 +154,12 @@ const _shop = (req, res, shopId) => {
148 * app设置cookie 154 * app设置cookie
149 */ 155 */
150 const shopAppCookie = (req, res) => { 156 const shopAppCookie = (req, res) => {
  157 + let allowOrigin = _.get(req, 'headers.origin', null) ?
  158 + req.headers.origin : req.protocol + '://' + req.headers.host;
  159 +
  160 + res.setHeader('Access-Control-Allow-Origin', allowOrigin);
  161 + res.setHeader('Access-Control-Allow-Credentials', 'true');
  162 +
151 let uid = req.query.uid; 163 let uid = req.query.uid;
152 164
153 req.session.appUid = uid; 165 req.session.appUid = uid;
@@ -165,8 +177,14 @@ const shopAppCookie = (req, res) => { @@ -165,8 +177,14 @@ const shopAppCookie = (req, res) => {
165 * 前端请求判断shop是否收藏 177 * 前端请求判断shop是否收藏
166 */ 178 */
167 const shopFav = (req, res) => { 179 const shopFav = (req, res) => {
  180 + let allowOrigin = _.get(req, 'headers.origin', null) ?
  181 + req.headers.origin : req.protocol + '://' + req.headers.host;
  182 +
  183 + res.setHeader('Access-Control-Allow-Origin', allowOrigin);
  184 + res.setHeader('Access-Control-Allow-Credentials', 'true');
  185 +
168 let isApp = req.query.app_version || req.query.appVersion || false; 186 let isApp = req.query.app_version || req.query.appVersion || false;
169 - let uid = isApp ? req.query.uid : req.user.uid; 187 + let uid = req.user.uid || req.query.uid || req.cookies.appUid || _getUidFromUserAgent(req);
170 let shopId = req.query.shopId; 188 let shopId = req.query.shopId;
171 189
172 listModel.getShopFav(req, shopId, uid, isApp).then(result => { 190 listModel.getShopFav(req, shopId, uid, isApp).then(result => {
@@ -347,25 +365,7 @@ const favoriteBrand = (req, res, next) => { @@ -347,25 +365,7 @@ const favoriteBrand = (req, res, next) => {
347 let opt = req.query.opt || 'ok'; 365 let opt = req.query.opt || 'ok';
348 let type = req.query.type || 'product'; 366 let type = req.query.type || 'product';
349 let appVersion = req.query.appVersion || false; 367 let appVersion = req.query.appVersion || false;
350 - let refer = req.headers.origin;  
351 -  
352 - if (req.headers.referer) {  
353 - let refererSplit = _.split(req.headers.referer, '?');  
354 -  
355 - let shopIdSplit = _.split(refererSplit[1], '&');  
356 - let shopId = '';  
357 -  
358 - _.forEach(shopIdSplit, value => {  
359 - if (_.startsWith(value, 'shop_id')) {  
360 - shopId = value;  
361 - return;  
362 - }  
363 - });  
364 -  
365 - if (shopId) {  
366 - refer = refererSplit[0] + '?' + shopId;  
367 - }  
368 - } 368 + let refer = req.get('referer');
369 369
370 let url = helpers.urlFormat('/signin.html') + '?refer=' + refer; 370 let url = helpers.urlFormat('/signin.html') + '?refer=' + refer;
371 371
@@ -376,7 +376,8 @@ const favoriteBrand = (req, res, next) => { @@ -376,7 +376,8 @@ const favoriteBrand = (req, res, next) => {
376 uid = _getUidFromUserAgent(req); 376 uid = _getUidFromUserAgent(req);
377 } 377 }
378 378
379 - url = `${refer}&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"${refer}","param":{}},"requesturl":{"param":{},"url":""},"priority":"Y"}}`; // eslint-disable-line 379 + url = `${refer}&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"${refer}","param":{}},"requesturl":{"param":{"method":"app.favorite.add","id":"${id}","fav_id":"${id}","type":"shop"},"url":"${_.get(global, 'yoho.API.ApiUrl', '')}"},"priority":"Y"}}`; // eslint-disable-line
  380 +
380 } 381 }
381 382
382 if (!id) { 383 if (!id) {
@@ -468,23 +469,7 @@ const userCoupon = (req, res, next) => { @@ -468,23 +469,7 @@ const userCoupon = (req, res, next) => {
468 return; 469 return;
469 }).catch(next); 470 }).catch(next);
470 } else { 471 } else {
471 - let refer = req.headers.origin;  
472 -  
473 - if (req.headers.referer) {  
474 - let refererSplit = _.split(req.headers.referer, '?');  
475 -  
476 - let shopIdSplit = _.split(refererSplit[1], '&');  
477 - let shopId = '';  
478 -  
479 - _.forEach(shopIdSplit, value => {  
480 - if (_.startsWith(value, 'shop_id')) {  
481 - shopId = value;  
482 - return;  
483 - }  
484 - });  
485 -  
486 - refer = refererSplit[0] + '?' + shopId;  
487 - } 472 + let refer = req.get('referer');
488 473
489 if (req.yoho.isApp !== 'false') { 474 if (req.yoho.isApp !== 'false') {
490 let toUrl = refer + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' + 475 let toUrl = refer + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"' +
@@ -105,6 +105,9 @@ const _getShopDecorator = (shopId) => { @@ -105,6 +105,9 @@ const _getShopDecorator = (shopId) => {
105 * @return array 105 * @return array
106 */ 106 */
107 const _getShopInfo = (shopId, uid) => { 107 const _getShopInfo = (shopId, uid) => {
  108 + if (uid === 'undefined') {
  109 + uid = 0;
  110 + }
108 return api.get('', { 111 return api.get('', {
109 method: 'app.shops.getIntro', 112 method: 'app.shops.getIntro',
110 shop_id: shopId, 113 shop_id: shopId,
@@ -332,9 +335,10 @@ const _formShopData = (data, shopId, isApp) => { @@ -332,9 +335,10 @@ const _formShopData = (data, shopId, isApp) => {
332 } 335 }
333 }; 336 };
334 337
335 - _.forEach(resData, (cate) => { 338 + _.forEach(resData, cate => {
336 hotCategory.data.list.push({ 339 hotCategory.data.list.push({
337 - url: cate.url, 340 + url: isApp ? _modifyAppUrl(cate, shopId) :
  341 + _modifyWapUrl(cate, shopId),
338 src: helpers.image(cate.src), 342 src: helpers.image(cate.src),
339 name: cate.name 343 name: cate.name
340 }); 344 });
@@ -362,6 +366,16 @@ const _formShopData = (data, shopId, isApp) => { @@ -362,6 +366,16 @@ const _formShopData = (data, shopId, isApp) => {
362 title: '全部商品' 366 title: '全部商品'
363 }; 367 };
364 368
  369 + let moreUrl = helpers.urlFormat('', {
  370 + shop_id: shopId,
  371 + order: 's_n_d',
  372 + title: '人气单品'
  373 + }, 'search'); // 人气单品的链接
  374 +
  375 + if (isApp) {
  376 + moreUrl = 'openby:yohobuy={"action":"go.list","params":{"shop_id":"' + shopId + '","title":"人气单品"}}';
  377 + }
  378 +
365 formatData = _.assign({ 379 formatData = _.assign({
366 shopIntro: _.get(data, 'shopInfo.shop_intro', ''), 380 shopIntro: _.get(data, 'shopInfo.shop_intro', ''),
367 logoImg: _.get(data, 'shopInfo.shop_logo', ''), 381 logoImg: _.get(data, 'shopInfo.shop_logo', ''),
@@ -372,11 +386,7 @@ const _formShopData = (data, shopId, isApp) => { @@ -372,11 +386,7 @@ const _formShopData = (data, shopId, isApp) => {
372 url: helpers.urlFormat('', { 386 url: helpers.urlFormat('', {
373 shop_id: shopId 387 shop_id: shopId
374 }, 'search'), // 搜索链接 388 }, 'search'), // 搜索链接
375 - more_url: helpers.urlFormat('', {  
376 - shop_id: shopId,  
377 - order: 's_n_d',  
378 - title: '人气单品'  
379 - }, 'search') // 人气单品的链接 389 + more_url: moreUrl
380 }, formatData); 390 }, formatData);
381 391
382 if (single) { // 单品点 392 if (single) { // 单品点
@@ -528,7 +538,7 @@ const getShopData = (req, shopId, uid, isApp) => { @@ -528,7 +538,7 @@ const getShopData = (req, shopId, uid, isApp) => {
528 538
529 if (result[1]) { 539 if (result[1]) {
530 shopFilterSearchData.filter = productProcess.processFilter(result[1].filter || []); 540 shopFilterSearchData.filter = productProcess.processFilter(result[1].filter || []);
531 - shopFilterSearchData.goods = productProcess.processProductList(result[1].product_list || []); 541 + shopFilterSearchData.goods = productProcess.processProductList(result[1].product_list || [], {isApp: isApp});
532 } 542 }
533 543
534 /* 店鋪優惠券 */ 544 /* 店鋪優惠券 */
@@ -13,6 +13,15 @@ const api = global.yoho.API; @@ -13,6 +13,15 @@ const api = global.yoho.API;
13 const camelCase = global.yoho.camelCase; 13 const camelCase = global.yoho.camelCase;
14 14
15 /** 15 /**
  16 + * 封面图
  17 + * @type {{boys: string, gilrs: string}}
  18 + */
  19 +const _coverChannel = {
  20 + boys: '1,3',
  21 + gilrs: '2,3'
  22 +};
  23 +
  24 +/**
16 * 品牌名称处理 25 * 品牌名称处理
17 * @param {[object]} list 26 * @param {[object]} list
18 * @return {[object]} 27 * @return {[object]}
@@ -104,6 +113,8 @@ const _searchGoods = (params) => { @@ -104,6 +113,8 @@ const _searchGoods = (params) => {
104 113
105 if (params.order) { 114 if (params.order) {
106 params.order = searchProcess.getTypeCont(params.type || '', params.order); 115 params.order = searchProcess.getTypeCont(params.type || '', params.order);
  116 + } else {
  117 + params.order = 's_t_asc';
107 } 118 }
108 119
109 return api.get('', _.assign({ 120 return api.get('', _.assign({
@@ -119,7 +130,10 @@ const _searchGoods = (params) => { @@ -119,7 +130,10 @@ const _searchGoods = (params) => {
119 const getSearchData = (params) => { 130 const getSearchData = (params) => {
120 return _searchGoods(params).then((result) => { 131 return _searchGoods(params).then((result) => {
121 if (result && result.code === 200) { 132 if (result && result.code === 200) {
122 - return productProcess.processProductList(result.data.product_list || []); 133 + return productProcess.processProductList(result.data.product_list || [], {
  134 + isApp: params.appVersion,
  135 + gender: _coverChannel[params.coverChannel]
  136 + });
123 } else { 137 } else {
124 logger.error('get product search api return code is not 200'); 138 logger.error('get product search api return code is not 200');
125 return []; 139 return [];
@@ -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',
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.0.4", 3 + "version": "5.0.5",
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": {
@@ -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: '删除成功',
@@ -187,12 +189,16 @@ $search.on('touchend', function() { @@ -187,12 +189,16 @@ $search.on('touchend', function() {
187 } 189 }
188 190
189 $history.html(html); 191 $history.html(html);
  192 +
190 if (html !== '') { 193 if (html !== '') {
191 $clearHistory.removeClass('hide'); 194 $clearHistory.removeClass('hide');
192 $historySearch.removeClass('hide'); 195 $historySearch.removeClass('hide');
193 } 196 }
194 197
195 - // window.rePosFooter(); 198 + window.rePosFooter();
  199 + } else {
  200 + $historySearch.hide();
  201 + $clearHistory.hide();
196 } 202 }
197 } 203 }
198 }()); 204 }());
@@ -52,6 +52,9 @@ require('../../common'); @@ -52,6 +52,9 @@ require('../../common');
52 $.ajax({ 52 $.ajax({
53 type: 'GET', 53 type: 'GET',
54 url: '/product/index/shopAppCookie', 54 url: '/product/index/shopAppCookie',
  55 + xhrFields: {
  56 + withCredentials: true
  57 + },
55 error: function() { 58 error: function() {
56 tip.show('网络断开连接了~'); 59 tip.show('网络断开连接了~');
57 } 60 }
@@ -61,6 +64,9 @@ require('../../common'); @@ -61,6 +64,9 @@ require('../../common');
61 $.ajax({ 64 $.ajax({
62 type: 'GET', 65 type: 'GET',
63 url: '/product/index/shopFav', 66 url: '/product/index/shopFav',
  67 + xhrFields: {
  68 + withCredentials: true
  69 + },
64 data: { 70 data: {
65 shopId: $('.shopid').val(), 71 shopId: $('.shopid').val(),
66 }, 72 },
@@ -222,7 +228,7 @@ function newData(callback) { @@ -222,7 +228,7 @@ function newData(callback) {
222 req.url = location.protocol + '//m.yohobuy.com/product/search/search'; 228 req.url = location.protocol + '//m.yohobuy.com/product/search/search';
223 req.data = { 229 req.data = {
224 type: 'new', 230 type: 'new',
225 - order: '1', 231 + order: '0',
226 page: navInfo.new.page, 232 page: navInfo.new.page,
227 tagNew: '1' 233 tagNew: '1'
228 }; 234 };
@@ -637,7 +643,8 @@ function search(opt) { @@ -637,7 +643,8 @@ function search(opt) {
637 $.extend(setting, defaultOpt, { 643 $.extend(setting, defaultOpt, {
638 type: navType, 644 type: navType,
639 order: nav.order, 645 order: nav.order,
640 - page: page 646 + page: page,
  647 + appVersion: appVersion
641 }); 648 });
642 649
643 if (brand) { 650 if (brand) {
@@ -851,6 +858,7 @@ $subNav.on('touchend touchcancel', function(e) { @@ -851,6 +858,7 @@ $subNav.on('touchend touchcancel', function(e) {
851 type: 'shop_id', 858 type: 'shop_id',
852 id: shopId, 859 id: shopId,
853 brand: brand, 860 brand: brand,
  861 + appVersion: appVersion,
854 url: location.protocol + '//m.yohobuy.com/product/search/search', 862 url: location.protocol + '//m.yohobuy.com/product/search/search',
855 nextPage: false 863 nextPage: false
856 }); 864 });
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 36
37 .search { 37 .search {
38 position: absolute; 38 position: absolute;
39 - top: 18px; 39 + top: 14px;
40 right: 40px; 40 right: 40px;
41 border: none; 41 border: none;
42 background: transparent; 42 background: transparent;
@@ -55,6 +55,10 @@ const getTypeCont = (type, order) => { @@ -55,6 +55,10 @@ const getTypeCont = (type, order) => {
55 return order === '0' ? 'd_s_desc' : 'd_s_asc'; 55 return order === '0' ? 'd_s_desc' : 'd_s_asc';
56 case 'category': 56 case 'category':
57 return order === '0' ? 's_t_desc' : 's_t_asc'; 57 return order === '0' ? 's_t_desc' : 's_t_asc';
  58 + case 'new':
  59 + return order === '0' ? 's_t_desc' : 's_t_asc';
  60 + case 'hot':
  61 + return order === '0' ? 's_n_desc' : 's_n_asc';
58 default: 62 default:
59 return order === '0' ? 's_t_desc' : 's_t_asc'; 63 return order === '0' ? 's_t_desc' : 's_t_asc';
60 } 64 }