Authored by zhangxiaoru

merge

@@ -83,6 +83,7 @@ app.use((req, res, next) => { @@ -83,6 +83,7 @@ app.use((req, res, next) => {
83 try { 83 try {
84 const user = require('./doraemon/middleware/user'); 84 const user = require('./doraemon/middleware/user');
85 const subDomain = require('./doraemon/middleware/sub-domain'); 85 const subDomain = require('./doraemon/middleware/sub-domain');
  86 + const itemNameHandler = require('./doraemon/middleware/item-name-handler');
86 const setYohoData = require('./doraemon/middleware/set-yoho-data'); 87 const setYohoData = require('./doraemon/middleware/set-yoho-data');
87 const errorHanlder = require('./doraemon/middleware/error-handler'); 88 const errorHanlder = require('./doraemon/middleware/error-handler');
88 const setPageInfo = require('./doraemon/middleware/set-pageinfo'); 89 const setPageInfo = require('./doraemon/middleware/set-pageinfo');
@@ -91,6 +92,7 @@ try { @@ -91,6 +92,7 @@ try {
91 92
92 // YOHO 前置中间件 93 // YOHO 前置中间件
93 app.use(subDomain()); 94 app.use(subDomain());
  95 + app.use(itemNameHandler);
94 app.use(setYohoData()); 96 app.use(setYohoData());
95 app.use(user()); 97 app.use(user());
96 app.use(seo()); 98 app.use(seo());
@@ -7,9 +7,7 @@ const _ = require('lodash'); @@ -7,9 +7,7 @@ const _ = require('lodash');
7 const helpers = global.yoho.helpers; 7 const helpers = global.yoho.helpers;
8 const crypto = global.yoho.crypto; 8 const crypto = global.yoho.crypto;
9 9
10 -const SUB_DOMAIN = '.dev.yohobuy.com',  
11 - OLD_MAIN = '//m.yohobuy.com',  
12 - SITE_MAIN = '//m.dev.yohobuy.com'; 10 +const SITE_MAIN = '//m.yohobuy.com';
13 11
14 /** 12 /**
15 * 仿php的strrpos 13 * 仿php的strrpos
@@ -60,7 +58,8 @@ const getShare = (code, shareTitle, shareDesc, shareImg) => { @@ -60,7 +58,8 @@ const getShare = (code, shareTitle, shareDesc, shareImg) => {
60 * 过滤app的url 58 * 过滤app的url
61 */ 59 */
62 const _getFilterUrl = url => { 60 const _getFilterUrl = url => {
63 - url = url.replace('.m.yohobuy.com', SUB_DOMAIN).replace(OLD_MAIN, SITE_MAIN).replace('www.yohobuy.com', SITE_MAIN); 61 + url = url.replace('www.yohobuy.com', SITE_MAIN);
  62 +
64 if (strrpos(url, 'm.yohobuy.com') && !strrpos(url, 'sale.m.yohobuy.com') && !strrpos(url, 'cuxiao.m.yohobuy.com') && 63 if (strrpos(url, 'm.yohobuy.com') && !strrpos(url, 'sale.m.yohobuy.com') && !strrpos(url, 'cuxiao.m.yohobuy.com') &&
65 !strrpos(url, 'activity.m.yohobuy.com') && !strrpos(url, 'huodong.m.yohobuy.com') && 64 !strrpos(url, 'activity.m.yohobuy.com') && !strrpos(url, 'huodong.m.yohobuy.com') &&
66 strrpos(url, 'cdn.yoho.cn/myohobuy') && !strrpos(url, '/home/orders/pay')) { 65 strrpos(url, 'cdn.yoho.cn/myohobuy') && !strrpos(url, '/home/orders/pay')) {
@@ -353,4 +352,4 @@ exports.receiveCoupon = (receiveData, uid) => { @@ -353,4 +352,4 @@ exports.receiveCoupon = (receiveData, uid) => {
353 } 352 }
354 return returnData; 353 return returnData;
355 }); 354 });
356 -}; 355 +};
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <strong class="fz18">现金券</strong> 6 <strong class="fz18">现金券</strong>
7 <p class="fz9 bold">CPOUPON</p> 7 <p class="fz9 bold">CPOUPON</p>
8 <div class="pirbox absolute"> 8 <div class="pirbox absolute">
9 - <em class="absolute"></em>0 9 + <em class="absolute">&yen;</em>0
10 </div> 10 </div>
11 </div>--> 11 </div>-->
12 <div class="coupon-box chit0"></div> 12 <div class="coupon-box chit0"></div>
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <strong class="fz18">现金券</strong> 6 <strong class="fz18">现金券</strong>
7 <p class="fz9 bold">CPOUPON</p> 7 <p class="fz9 bold">CPOUPON</p>
8 <div class="pirbox absolute"> 8 <div class="pirbox absolute">
9 - <em class="absolute"></em>{{amount}} 9 + <em class="absolute">&yen;</em>{{amount}}
10 </div> 10 </div>
11 <div class="count-not fz11 absolute"><hr class="fn-left"><hr class="fn-right">已送达您的账户</div> 11 <div class="count-not fz11 absolute"><hr class="fn-left"><hr class="fn-right">已送达您的账户</div>
12 </div> 12 </div>
@@ -90,9 +90,9 @@ @@ -90,9 +90,9 @@
90 <span class="reco-name">{{name}}</span> 90 <span class="reco-name">{{name}}</span>
91 </p> 91 </p>
92 <p class="price"> 92 <p class="price">
93 - <span class="sale-price {{^price}}no-price{{/price}}">{{salePrice}}</span> 93 + <span class="sale-price {{^price}}no-price{{/price}}">&yen;{{salePrice}}</span>
94 {{#price}} 94 {{#price}}
95 - <span class="market-price">{{.}}</span> 95 + <span class="market-price">&yen;{{.}}</span>
96 {{/price}} 96 {{/price}}
97 <a class="check-detail" href={{url}}> 97 <a class="check-detail" href={{url}}>
98 查看详情 98 查看详情
@@ -49,7 +49,8 @@ exports.addressAct = (req, res, next) => { @@ -49,7 +49,8 @@ exports.addressAct = (req, res, next) => {
49 module: 'home', 49 module: 'home',
50 page: 'address-act', 50 page: 'address-act',
51 pageHeader: headerModel.setNav({ 51 pageHeader: headerModel.setNav({
52 - navTitle: result.navTitle 52 + navTitle: result.navTitle,
  53 + navBtn: false
53 }), 54 }),
54 title: result.navTitle 55 title: result.navTitle
55 }; 56 };
@@ -161,7 +162,8 @@ exports.addressModify = (req, res, next) => { @@ -161,7 +162,8 @@ exports.addressModify = (req, res, next) => {
161 module: 'home', 162 module: 'home',
162 page: 'address-modify', 163 page: 'address-modify',
163 pageHeader: headerModel.setNav({ 164 pageHeader: headerModel.setNav({
164 - navTitle: '选择地址' 165 + navTitle: '选择地址',
  166 + navBtn: false
165 }), 167 }),
166 title: '选择地址', 168 title: '选择地址',
167 }; 169 };
@@ -184,6 +186,10 @@ exports.addressModify = (req, res, next) => { @@ -184,6 +186,10 @@ exports.addressModify = (req, res, next) => {
184 * @param next 186 * @param next
185 */ 187 */
186 exports.locationList = (req, res, next) => { 188 exports.locationList = (req, res, next) => {
  189 + res.set({
  190 + 'Cache-Control': 'max-age=600'
  191 + });
  192 +
187 addressModel.locationList({ 193 addressModel.locationList({
188 uid: req.user.uid 194 uid: req.user.uid
189 }).then(result => { 195 }).then(result => {
@@ -9,11 +9,12 @@ exports.index = (req, res, next) => { @@ -9,11 +9,12 @@ exports.index = (req, res, next) => {
9 module: 'home', 9 module: 'home',
10 page: 'help', 10 page: 'help',
11 pageHeader: headerModel.setNav({ 11 pageHeader: headerModel.setNav({
12 - navTitle: '帮助中心' 12 + navTitle: '帮助中心',
  13 + navBtn: false
13 }), 14 }),
14 title: '帮助中心', 15 title: '帮助中心',
15 pageFooter: true, 16 pageFooter: true,
16 - iHelp: result, 17 + iHelp: result
17 }); 18 });
18 }).catch(next); 19 }).catch(next);
19 }; 20 };
@@ -24,7 +25,8 @@ exports.helpDetail = (req, res, next) => { @@ -24,7 +25,8 @@ exports.helpDetail = (req, res, next) => {
24 module: 'home', 25 module: 'home',
25 page: 'help-detail', 26 page: 'help-detail',
26 pageHeader: headerModel.setNav({ 27 pageHeader: headerModel.setNav({
27 - navTitle: req.query.name 28 + navTitle: req.query.name,
  29 + navBtn: false
28 }), 30 }),
29 title: req.query.name, 31 title: req.query.name,
30 pageFooter: true, 32 pageFooter: true,
@@ -52,6 +52,7 @@ router.get('/locationList', auth, addressController.locationList); // 异步获å @@ -52,6 +52,7 @@ router.get('/locationList', auth, addressController.locationList); // 异步获å
52 router.get('/orders', auth, orderController.order); // 订单列表 52 router.get('/orders', auth, orderController.order); // 订单列表
53 router.get('/getOrders', auth, orderController.getOrders); // 获取订单列表数据 53 router.get('/getOrders', auth, orderController.getOrders); // 获取订单列表数据
54 router.get('/orderDetail', auth, orderDetailController.orderDetailData); // 订单详情页 54 router.get('/orderDetail', auth, orderDetailController.orderDetailData); // 订单详情页
  55 +router.get('/orders/detail', auth, orderDetailController.orderDetailData); // 订单详情页兼容老的
55 router.get('/delOrder', auth, orderDetailController.delOrder); // 删除订单 56 router.get('/delOrder', auth, orderDetailController.delOrder); // 删除订单
56 router.get('/readd', auth, orderDetailController.readdData); // 再次购买 57 router.get('/readd', auth, orderDetailController.readdData); // 再次购买
57 router.get('/cancelOrder', auth, orderDetailController.cancelOrder); // 取消订单 58 router.get('/cancelOrder', auth, orderDetailController.cancelOrder); // 取消订单
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 {{# banner}} 21 {{# banner}}
22 {{# data}} 22 {{# data}}
23 <a href="{{url}}"> 23 <a href="{{url}}">
24 - <img src="{{image src 640 200 2}}" alt="img"> 24 + <img src="{{image src 640 200}}" alt="img">
25 </a> 25 </a>
26 {{/ data}} 26 {{/ data}}
27 {{/ banner}} 27 {{/ banner}}
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 {{# productList}} 23 {{# productList}}
24 <li class="swiper-slide"> 24 <li class="swiper-slide">
25 <a href="{{link}}"> 25 <a href="{{link}}">
26 - <img class="swiper-lazy" data-src="{{image imgUrl 97 150}}" alt=""/> 26 + <img class="swiper-lazy" data-src="{{image imgUrl 235 314}}" alt=""/>
27 </a> 27 </a>
28 <div class="brand-product"> 28 <div class="brand-product">
29 <div class="{{# discount}}price-discount{{/ discount}}"> 29 <div class="{{# discount}}price-discount{{/ discount}}">
@@ -7,11 +7,11 @@ @@ -7,11 +7,11 @@
7 <ul class="cost block"> 7 <ul class="cost block">
8 <li> 8 <li>
9 年度累计金额: 9 年度累计金额:
10 - <span>{{costOfThisYear}}</span> 10 + <span>&yen;{{costOfThisYear}}</span>
11 </li> 11 </li>
12 <li> 12 <li>
13 历史消费总金额: 13 历史消费总金额:
14 - <span>{{sumCost}}</span> 14 + <span>&yen;{{sumCost}}</span>
15 </li> 15 </li>
16 </ul> 16 </ul>
17 17
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 您已升级至最高的等级啦! 7 您已升级至最高的等级啦!
8 </p> 8 </p>
9 <p class="sum-cost"> 9 <p class="sum-cost">
10 - 年度累计金额<span> {{costOfThisYear}}</span> 10 + 年度累计金额<span> &yen;{{costOfThisYear}}</span>
11 </p> 11 </p>
12 <div class="progresser"> 12 <div class="progresser">
13 <div class="outer"></div> 13 <div class="outer"></div>
@@ -24,11 +24,11 @@ @@ -24,11 +24,11 @@
24 <span class="vip-icon vip-2"></span> 24 <span class="vip-icon vip-2"></span>
25 </p> 25 </p>
26 <p class="grade-desc"> 26 <p class="grade-desc">
27 - 还差<span class="cost-gap">{{costGap}}</span>就可以升级为白金会员! 27 + 还差<span class="cost-gap">&yen;{{costGap}}</span>就可以升级为白金会员!
28 <span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span> 28 <span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span>
29 </p> 29 </p>
30 <p class="sum-cost"> 30 <p class="sum-cost">
31 - 年度累计金额<span> {{costOfThisYear}}</span> 31 + 年度累计金额<span> &yen;{{costOfThisYear}}</span>
32 </p> 32 </p>
33 <div class="progresser"> 33 <div class="progresser">
34 <div class="outer"></div> 34 <div class="outer"></div>
@@ -37,7 +37,7 @@ @@ -37,7 +37,7 @@
37 金卡会员 37 金卡会员
38 </span> 38 </span>
39 <span class="beacon beacon-max">白金卡会员</span> 39 <span class="beacon beacon-max">白金卡会员</span>
40 - <span class="cost-limit">5000.00</span> 40 + <span class="cost-limit">&yen;5000.00</span>
41 </div> 41 </div>
42 {{/if}} 42 {{/if}}
43 43
@@ -47,11 +47,11 @@ @@ -47,11 +47,11 @@
47 <span class="vip-icon vip-1"></span> 47 <span class="vip-icon vip-1"></span>
48 </p> 48 </p>
49 <p class="grade-desc"> 49 <p class="grade-desc">
50 - 还差<span class="cost-gap">{{costGap}}</span>就可以升级为金卡会员! 50 + 还差<span class="cost-gap">&yen;{{costGap}}</span>就可以升级为金卡会员!
51 <span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span> 51 <span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span>
52 </p> 52 </p>
53 <p class="sum-cost"> 53 <p class="sum-cost">
54 - 年度累计金额<span> {{costOfThisYear}}</span> 54 + 年度累计金额<span> &yen;{{costOfThisYear}}</span>
55 </p> 55 </p>
56 <div class="progresser"> 56 <div class="progresser">
57 <div class="outer"></div> 57 <div class="outer"></div>
@@ -60,7 +60,7 @@ @@ -60,7 +60,7 @@
60 银卡会员 60 银卡会员
61 </span> 61 </span>
62 <span class="beacon beacon-max">金卡会员</span> 62 <span class="beacon beacon-max">金卡会员</span>
63 - <span class="cost-limit">2000.00</span> 63 + <span class="cost-limit">&yen;2000.00</span>
64 </div> 64 </div>
65 {{/if}} 65 {{/if}}
66 66
@@ -70,11 +70,11 @@ @@ -70,11 +70,11 @@
70 <span>普通会员</span> 70 <span>普通会员</span>
71 </p> 71 </p>
72 <p class="grade-desc"> 72 <p class="grade-desc">
73 - 还差<span class="cost-gap">{{costGap}}</span>就可以升级为银卡会员! 73 + 还差<span class="cost-gap">&yen;{{costGap}}</span>就可以升级为银卡会员!
74 <span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span> 74 <span class="sub-desc">(VIP金额累计需订单成功签收满15天并无退换货)</span>
75 </p> 75 </p>
76 <p class="sum-cost"> 76 <p class="sum-cost">
77 - 年度累计金额<span> {{costOfThisYear}}</span> 77 + 年度累计金额<span> &yen;{{costOfThisYear}}</span>
78 </p> 78 </p>
79 <div class="progresser"> 79 <div class="progresser">
80 <div class="outer"></div> 80 <div class="outer"></div>
@@ -83,6 +83,6 @@ @@ -83,6 +83,6 @@
83 普通 83 普通
84 </span> 84 </span>
85 <span class="beacon beacon-max">银卡会员</span> 85 <span class="beacon beacon-max">银卡会员</span>
86 - <span class="cost-limit">600.00</span> 86 + <span class="cost-limit">&yen;600.00</span>
87 </div> 87 </div>
88 {{/if}} 88 {{/if}}
@@ -35,7 +35,8 @@ const newGoods = (req, res, next) => { @@ -35,7 +35,8 @@ const newGoods = (req, res, next) => {
35 dayLimit: 1, 35 dayLimit: 1,
36 discount: '', 36 discount: '',
37 cartUrl: helpers.urlFormat('/cart/index/index', null), 37 cartUrl: helpers.urlFormat('/cart/index/index', null),
38 - pageFooter: true 38 + pageFooter: true,
  39 + showDownloadApp: true
39 }); 40 });
40 }).catch(next); 41 }).catch(next);
41 }; 42 };
@@ -98,14 +98,17 @@ let _processComment = (data) => { @@ -98,14 +98,17 @@ let _processComment = (data) => {
98 comments: [] 98 comments: []
99 }; 99 };
100 100
101 - _.forEach(data.pageResponse.list, (item) => {  
102 - result.comments.push({  
103 - userName: item.userInfo ? item.userInfo.nickName : '',  
104 - desc: item.goods ? `${item.goods.color_name}/${item.goods.size_name}` : '',  
105 - content: item.content,  
106 - time: helpers.dateFormat('YYYY-MM-DD HH:mm:ss', new Date(item.createTime * 1000)) 101 + if (data && data.pageResponse) {
  102 + _.forEach(data.pageResponse.list, (item) => {
  103 + result.comments.push({
  104 + userName: item.userInfo ? item.userInfo.nickName : '',
  105 + desc: item.goods ? `${item.goods.color_name}/${item.goods.size_name}` : '',
  106 + content: item.content,
  107 + time: helpers.dateFormat('YYYY-MM-DD HH:mm:ss', new Date(item.createTime * 1000))
  108 + });
107 }); 109 });
108 - }); 110 + }
  111 +
109 return result; 112 return result;
110 }; 113 };
111 114
@@ -175,7 +178,7 @@ let consults = (params) => { @@ -175,7 +178,7 @@ let consults = (params) => {
175 data.consults = result[1].list; 178 data.consults = result[1].list;
176 } 179 }
177 180
178 - data.showReadMore = result[1].list.length > 2; 181 + data.showReadMore = _.get(result[1], 'list.length', 0) > 2;
179 182
180 return data; 183 return data;
181 }); 184 });
@@ -929,7 +929,7 @@ let _getShopsInfo = (brandId) => { @@ -929,7 +929,7 @@ let _getShopsInfo = (brandId) => {
929 }, { 929 }, {
930 cache: true 930 cache: true
931 }).then(shops => { 931 }).then(shops => {
932 - if (shops.code === 200) { 932 + if (shops && shops.code === 200) {
933 return _processShopsInfo(shops.data); 933 return _processShopsInfo(shops.data);
934 } 934 }
935 935
@@ -596,8 +596,7 @@ const getBrandIntro = (brandId, uid) => { @@ -596,8 +596,7 @@ const getBrandIntro = (brandId, uid) => {
596 method: 'app.brand.getBrandIntro', 596 method: 'app.brand.getBrandIntro',
597 brand_id: brandId 597 brand_id: brandId
598 }, param), { 598 }, param), {
599 - code: 200,  
600 - cache: true 599 + code: 200
601 }).then(result => { 600 }).then(result => {
602 if (result && result.data) { 601 if (result && result.data) {
603 let list = result.data; 602 let list = result.data;
@@ -71,7 +71,7 @@ const getNewFocus = (channel) => { @@ -71,7 +71,7 @@ const getNewFocus = (channel) => {
71 const getSearchData = (params) => { 71 const getSearchData = (params) => {
72 return _searchGoods(params).then((result) => { 72 return _searchGoods(params).then((result) => {
73 if (result && result.code === 200) { 73 if (result && result.code === 200) {
74 - return productProcess.processProductList(result.data.product_list || []); 74 + return productProcess.processProductList(result.data.product_list || [], {showTags: false});
75 } else { 75 } else {
76 logger.error('get product search api return code is not 200'); 76 logger.error('get product search api return code is not 200');
77 return []; 77 return [];
@@ -91,6 +91,10 @@ const _searchGoods = (params) => { @@ -91,6 +91,10 @@ const _searchGoods = (params) => {
91 delete params.filter_poolId; 91 delete params.filter_poolId;
92 } 92 }
93 93
  94 + if (params.brand) {
  95 + method = 'app.search.brand';
  96 + }
  97 +
94 // 排除基本筛选项默认值为0的对象 98 // 排除基本筛选项默认值为0的对象
95 for (let str in params) { 99 for (let str in params) {
96 if (str !== 'order' && params[str] === '0' || params[str] === null) { 100 if (str !== 'order' && params[str] === '0' || params[str] === null) {
@@ -92,6 +92,7 @@ router.get('/search/search', search.search); @@ -92,6 +92,7 @@ router.get('/search/search', search.search);
92 92
93 // 品类 93 // 品类
94 router.get('/index/index', list.category); 94 router.get('/index/index', list.category);
  95 +router.get('/list/index', list.category); // 兼容 PC 的链接
95 96
96 // 品牌 | 店铺 97 // 品牌 | 店铺
97 router.get('/index/brand', list.brand); 98 router.get('/index/brand', list.brand);
@@ -110,6 +111,7 @@ router.get('/opt/favoriteBrand', list.favoriteBrand); @@ -110,6 +111,7 @@ router.get('/opt/favoriteBrand', list.favoriteBrand);
110 111
111 // 新品到着 112 // 新品到着
112 router.get('/new', news.newGoods); 113 router.get('/new', news.newGoods);
  114 +router.get('/list/new', news.newGoods); // 兼容 PC 的链接
113 router.get('/new/selectNewSale', news.selectNewSale); 115 router.get('/new/selectNewSale', news.selectNewSale);
114 router.get('/new/filter', news.filter); 116 router.get('/new/filter', news.filter);
115 117
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 </div> 9 </div>
10 <div class="price"> 10 <div class="price">
11 <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span> 11 <span class="sale-price {{^price}}no-price{{/price}}">¥{{salePrice}}</span>
12 - {{#price}}<span class="old-price">{{.}}</span>{{/price}} 12 + {{#price}}<span class="old-price">&yen;{{.}}</span>{{/price}}
13 </div> 13 </div>
14 <div class="swiper-lazy-preloader"></div> 14 <div class="swiper-lazy-preloader"></div>
15 </a> 15 </a>
@@ -41,3 +41,5 @@ @@ -41,3 +41,5 @@
41 41
42 {{> common/suspend-cart}} 42 {{> common/suspend-cart}}
43 </div> 43 </div>
  44 +
  45 +{{download-app}}
@@ -16,10 +16,10 @@ module.exports = { @@ -16,10 +16,10 @@ 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.yohoops.org/',
  20 + service: 'http://service.yoho.yohoops.org/',
  21 + liveApi: 'http://api.live.yoho.cn/',
  22 + singleApi: 'http://single.yoho.cn/'
23 23
24 // api: 'http://api-test1.yohops.com:9999/', 24 // api: 'http://api-test1.yohops.com:9999/',
25 // service: 'http://service-test1.yohops.com:9999/', 25 // service: 'http://service-test1.yohops.com:9999/',
  1 +/**
  2 + * 商品详情页部分商品名称重置,防止express内部decodeURIComponent不能解析url出错
  3 + * @author: xuqi<qi.xu@yoho.cn>
  4 + * @date: 2016/8/23
  5 + */
  6 +
  7 +module.exports = function(req, res, next) {
  8 + if (/^\/product\/pro_/.test(req.url)) {
  9 + req.url = req.url.replace(/\/pro_([\d]+)_([\d]+)\/(.*)/, '/pro_$1_$2/yoho-replace.html');
  10 + }
  11 + next();
  12 +};
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 */ 5 */
6 6
7 'use strict'; 7 'use strict';
  8 +const helpers = global.yoho.helpers;
8 9
9 module.exports = () => { 10 module.exports = () => {
10 return (req, res, next) => { 11 return (req, res, next) => {
@@ -31,6 +32,8 @@ module.exports = () => { @@ -31,6 +32,8 @@ module.exports = () => {
31 res.set('Access-Control-Allow-Origin', '*'); 32 res.set('Access-Control-Allow-Origin', '*');
32 } 33 }
33 34
  35 + res.locals.cartUrl = helpers.urlFormat('/cart/index/index');
  36 +
34 next(); 37 next();
35 }; 38 };
36 }; 39 };
1 <div id="suspend-cart" class="suspend-cart"> 1 <div id="suspend-cart" class="suspend-cart">
2 - <a href={{cartUrl}}> 2 + <a href="{{@root.cartUrl}}">
3 <span class="iconfont">&#xe62c;</span> 3 <span class="iconfont">&#xe62c;</span>
4 </a> 4 </a>
5 <span class="cart-count hide">0</span> 5 <span class="cart-count hide">0</span>
6 -</div>  
  6 +</div>
@@ -14,13 +14,13 @@ @@ -14,13 +14,13 @@
14 <a href="{{url}}" class="nav-sub-right">{{text}}</a> 14 <a href="{{url}}" class="nav-sub-right">{{text}}</a>
15 {{/shopPage}} 15 {{/shopPage}}
16 {{#currencyPage}} 16 {{#currencyPage}}
17 - <a href="/home/helpDetail?code=20151230-102233&caption=有货币介绍" class="iconfont nav-home">&#xe639;</a> 17 + <a href="/home/helpDetail?code=20151230-102233&caption=有货币介绍&name=有货币介绍" class="iconfont nav-home">&#xe639;</a>
18 {{/currencyPage}} 18 {{/currencyPage}}
19 {{#currencyDetailPage}} 19 {{#currencyDetailPage}}
20 - <a href="/home/helpDetail?code=20111130-152530&caption=如何使用有货币支付" class="iconfont nav-home">&#xe639;</a> 20 + <a href="/home/helpDetail?code=20111130-152530&caption=如何使用有货币支付&name=如何使用有货币支付" class="iconfont nav-home">&#xe639;</a>
21 {{/currencyDetailPage}} 21 {{/currencyDetailPage}}
22 {{#installmentPage}} 22 {{#installmentPage}}
23 - <a href="/home/helpDetail?code=20151230-102233&caption=有货分期" class="iconfont nav-home">&#xe639;</a> 23 + <a href="/home/helpDetail?code=20151230-102233&caption=有货分期&name=有货分期" class="iconfont nav-home">&#xe639;</a>
24 {{/installmentPage}} 24 {{/installmentPage}}
25 {{#navPhone}} 25 {{#navPhone}}
26 <a href="{{.}}" class="iconfont nav-home">&#xe641;</a> 26 <a href="{{.}}" class="iconfont nav-home">&#xe641;</a>
1 { 1 {
2 "name": "m-yohobuy-node", 2 "name": "m-yohobuy-node",
3 - "version": "5.0.6", 3 + "version": "5.0.8",
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": {
@@ -78,6 +78,10 @@ $categoryContainer.on('touchend', function(e) { @@ -78,6 +78,10 @@ $categoryContainer.on('touchend', function(e) {
78 $subLevel.not('.hide').addClass('hide'); 78 $subLevel.not('.hide').addClass('hide');
79 $subLevel.eq(index).removeClass('hide'); 79 $subLevel.eq(index).removeClass('hide');
80 } 80 }
  81 +
  82 + if ($this.find('a').attr('href')) {
  83 + location.href = $this.find('a').attr('href');
  84 + }
81 }); 85 });
82 86
83 $categoryContainer.find('.primary-level').on('touchstart touchend touchcancel', 'li', function() { 87 $categoryContainer.find('.primary-level').on('touchstart touchend touchcancel', 'li', function() {
@@ -120,7 +120,7 @@ function rePosFooter() { @@ -120,7 +120,7 @@ function rePosFooter() {
120 120
121 winH = Math.min($(window).height(), window.screen.availHeight); 121 winH = Math.min($(window).height(), window.screen.availHeight);
122 122
123 - if ($('body').height() <= winH - parseInt($footer.css('height'), 0)) { 123 + if ($('body').height() <= winH) {
124 $footer.addClass('bottom'); 124 $footer.addClass('bottom');
125 } else { 125 } else {
126 $footer.removeClass('bottom'); 126 $footer.removeClass('bottom');
@@ -193,6 +193,7 @@ function bindAddressListEvent(html) { @@ -193,6 +193,7 @@ function bindAddressListEvent(html) {
193 if (window.localStorage && window.localStorage.getItem) { 193 if (window.localStorage && window.localStorage.getItem) {
194 chinaAddressList = window.localStorage.getItem('chinaAddressList'); 194 chinaAddressList = window.localStorage.getItem('chinaAddressList');
195 } 195 }
  196 +
196 if (chinaAddressList) { 197 if (chinaAddressList) {
197 bindAddressListEvent(chinaAddressList); 198 bindAddressListEvent(chinaAddressList);
198 } else { 199 } else {
@@ -201,12 +202,14 @@ if (chinaAddressList) { @@ -201,12 +202,14 @@ if (chinaAddressList) {
201 $.ajax({ 202 $.ajax({
202 method: 'GET', 203 method: 'GET',
203 url: '/home/locationList', 204 url: '/home/locationList',
204 - timeout: 60000 205 + timeout: 60000,
  206 + cache: true
205 }).then(function(html) { 207 }).then(function(html) {
206 bindAddressListEvent(html); 208 bindAddressListEvent(html);
207 - if (window.localStorage && window.localStorage.setItem) {  
208 - window.localStorage.setItem('chinaAddressList', html);  
209 - } 209 +
  210 + // if (window.localStorage && window.localStorage.setItem) {
  211 + // window.localStorage.setItem('chinaAddressList', html);
  212 + // }
210 }).fail(function() { 213 }).fail(function() {
211 tip.show('获取省市区列表失败'); 214 tip.show('获取省市区列表失败');
212 }); 215 });
@@ -94,6 +94,10 @@ function setSubClassify($this) { @@ -94,6 +94,10 @@ function setSubClassify($this) {
94 $shower.removeClass('default'); 94 $shower.removeClass('default');
95 } 95 }
96 96
  97 + if (hCbFn) {
  98 + hCbFn();
  99 + }
  100 +
97 return $sub; 101 return $sub;
98 } 102 }
99 103
@@ -135,8 +139,8 @@ function initFilter(opt) { @@ -135,8 +139,8 @@ function initFilter(opt) {
135 var $this = $(e.target), 139 var $this = $(e.target),
136 $cur; 140 $cur;
137 141
138 - //这行不能注释,iphone下会出现穿透  
139 - e.preventDefault();//防止透点 142 + // 这行不能注释,iphone下会出现穿透
  143 + e.preventDefault();// 防止透点
140 144
141 if ($this.closest('.filter-body').length > 0) { 145 if ($this.closest('.filter-body').length > 0) {
142 $cur = $this.closest('.sub-item'); 146 $cur = $this.closest('.sub-item');
@@ -33,6 +33,8 @@ var now = new Date(), @@ -33,6 +33,8 @@ var now = new Date(),
33 month = now.getMonth() + 1, 33 month = now.getMonth() + 1,
34 date = now.getDate(); 34 date = now.getDate();
35 35
  36 +require('../../common/footer');
  37 +
36 var $listNav = $('#list-nav'), 38 var $listNav = $('#list-nav'),
37 39
38 // 导航数据信息 40 // 导航数据信息
@@ -221,7 +223,7 @@ function search(opt) { @@ -221,7 +223,7 @@ function search(opt) {
221 break; 223 break;
222 } 224 }
223 225
224 - if (data === ' ') { 226 + if (data === ' ' || data === '') {
225 nav.end = true; 227 nav.end = true;
226 if (nav.reload) { 228 if (nav.reload) {
227 $container.html(noResult); 229 $container.html(noResult);
@@ -89,7 +89,7 @@ ellipsis.init(); @@ -89,7 +89,7 @@ ellipsis.init();
89 tip.show('网络断开连接了~'); 89 tip.show('网络断开连接了~');
90 } 90 }
91 }); 91 });
92 - } else if ($('.shopId').val().length > 0){ 92 + } else if ($('.shopId').val().length > 0) {
93 $.ajax({ 93 $.ajax({
94 url: '/product/index/baseShopFav', 94 url: '/product/index/baseShopFav',
95 data: { 95 data: {
@@ -192,7 +192,7 @@ function getQueryString(name) { @@ -192,7 +192,7 @@ function getQueryString(name) {
192 shopId = getQueryString('shop_id'); 192 shopId = getQueryString('shop_id');
193 sort = getQueryString('sort'); 193 sort = getQueryString('sort');
194 outlets = getQueryString('outlets'); 194 outlets = getQueryString('outlets');
195 -age_level = getQueryString('ageLevel'); 195 +age_level = getQueryString('age_level');
196 app_type = getQueryString('app_type'); 196 app_type = getQueryString('app_type');
197 msort = getQueryString('msort'); 197 msort = getQueryString('msort');
198 misort = getQueryString('misort'); 198 misort = getQueryString('misort');
@@ -218,7 +218,6 @@ function search(opt) { @@ -218,7 +218,6 @@ function search(opt) {
218 } 218 }
219 219
220 if (opt) { 220 if (opt) {
221 -  
222 // 筛选项变更则重置reload为true 221 // 筛选项变更则重置reload为true
223 for (att in navInfo) { 222 for (att in navInfo) {
224 if (navInfo.hasOwnProperty(att)) { 223 if (navInfo.hasOwnProperty(att)) {
@@ -255,7 +254,7 @@ function search(opt) { @@ -255,7 +254,7 @@ function search(opt) {
255 color: opt.id 254 color: opt.id
256 }; 255 };
257 break; 256 break;
258 - case 'age_level': 257 + case 'ageLevel':
259 ext = { 258 ext = {
260 age_level: opt.id 259 age_level: opt.id
261 }; 260 };
@@ -35,8 +35,8 @@ var $subNav = $('.home-sub-nav'), @@ -35,8 +35,8 @@ var $subNav = $('.home-sub-nav'),
35 appVersion = $('input[name="app_version"]').val(), 35 appVersion = $('input[name="app_version"]').val(),
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();  
39 -uid = $('input[name="uid"]').val(); 38 + favId = $('input[name="favId"]').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>';
@@ -223,7 +223,7 @@ @@ -223,7 +223,7 @@
223 height: auto; 223 height: auto;
224 color: #fff; 224 color: #fff;
225 line-height: 40px; 225 line-height: 40px;
226 - font-size: 14px; 226 + font-size: 14PX;
227 } 227 }
228 } 228 }
229 } 229 }
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 30
31 .price { 31 .price {
32 margin: 0.3rem 0; 32 margin: 0.3rem 0;
33 - font-size: 16px; 33 + font-size: 16PX;
34 } 34 }
35 35
36 .sale-price { 36 .sale-price {
@@ -107,7 +107,7 @@ @@ -107,7 +107,7 @@
107 font-size: 24px; 107 font-size: 24px;
108 border-bottom: 1px solid #e0e0e0; 108 border-bottom: 1px solid #e0e0e0;
109 padding-bottom: 20px; 109 padding-bottom: 20px;
110 - height: 120px; 110 + height: 140px;
111 overflow: hidden; 111 overflow: hidden;
112 position: relative; 112 position: relative;
113 113
@@ -288,7 +288,7 @@ @@ -288,7 +288,7 @@
288 margin: 0 30px; 288 margin: 0 30px;
289 289
290 .swiper-slide { 290 .swiper-slide {
291 - width: 225px; 291 + width: 255px;
292 height: 100%; 292 height: 100%;
293 float: left; 293 float: left;
294 padding-right: 30px; 294 padding-right: 30px;
@@ -307,6 +307,7 @@ @@ -307,6 +307,7 @@
307 .num { 307 .num {
308 color: #e0e0e0; 308 color: #e0e0e0;
309 float: right; 309 float: right;
  310 + font-size: 16PX;
310 } 311 }
311 } 312 }
312 } 313 }
@@ -124,14 +124,13 @@ @@ -124,14 +124,13 @@
124 .create-new-suggest { 124 .create-new-suggest {
125 display: block; 125 display: block;
126 width: 100%; 126 width: 100%;
127 - height: 88px; 127 + height: 150px;
128 line-height: 88px; 128 line-height: 88px;
129 text-align: center; 129 text-align: center;
130 font-size: 30px; 130 font-size: 30px;
131 border-top: 30px solid #f0f0f0; 131 border-top: 30px solid #f0f0f0;
132 border-bottom: 30px solid #f0f0f0; 132 border-bottom: 30px solid #f0f0f0;
133 position: relative; 133 position: relative;
134 - height: 88px;  
135 134
136 .list-item { 135 .list-item {
137 padding: 0 35px; 136 padding: 0 35px;
@@ -135,27 +135,35 @@ exports.processProductList = (list, options) => { @@ -135,27 +135,35 @@ exports.processProductList = (list, options) => {
135 } 135 }
136 136
137 if (options.showTags) { 137 if (options.showTags) {
138 - product.tags = {};  
139 -  
140 - product.tags.isNew = options.showNew && product.isNew === 'Y'; // 新品  
141 - product.tags.isDiscount = options.showSale && product.isDiscount === 'Y'; // 在售  
142 - product.tags.isLimited = product.isLimited === 'Y'; // 限量  
143 - product.tags.isYohood = product.isYohood === 'Y'; // YOHOOD  
144 - product.tags.midYear = product.midYear === 'Y'; // 年中  
145 - product.tags.yearEnd = product.yearEnd === 'Y'; // 年末  
146 - product.tags.isAdvance = product.isAdvance === 'Y'; // 再到着  
147 -  
148 - // 打折与即将售完组合显示打折  
149 - if (product.isSoonSoldOut && product.tags.isDiscount) {  
150 - product.tags.isNew = false;  
151 - } else if (product.tags.isDiscount &&  
152 - (product.tags.isNew || product.tags.isLimited || product.tags.isYohood || product.tags.isAdvance)) {  
153 - // 打折与其它组合则隐藏打折  
154 - product.tags.isDiscount = false;  
155 - } else if (product.tags.isYohood && product.tags.isNew) {  
156 - // YOHOOD和新品组合显示YOHOOD  
157 - product.tags.isNew = false;  
158 - } 138 + let tags = {};
  139 +
  140 + _.forEach(product.tags, tag => {
  141 + tags[_.camelCase(tag)] = true;
  142 + });
  143 + product.tags = tags;
  144 +
  145 + // 商品标签不再自行处理,直接使用接口返回的 is_yohood,is_new,is_discount,is_limited,is_soon_sold_out,mid-year,year-end
  146 + // product.tags = {};
  147 +
  148 + // product.tags.isNew = options.showNew && product.isNew === 'Y'; // 新品
  149 + // product.tags.isDiscount = options.showSale && product.isDiscount === 'Y'; // 在售
  150 + // product.tags.isLimited = product.isLimited === 'Y'; // 限量
  151 + // product.tags.isYohood = product.isYohood === 'Y'; // YOHOOD
  152 + // product.tags.midYear = product.midYear === 'Y'; // 年中
  153 + // product.tags.yearEnd = product.yearEnd === 'Y'; // 年末
  154 + // product.tags.isAdvance = product.isAdvance === 'Y'; // 再到着
  155 +
  156 + // // 打折与即将售完组合显示打折
  157 + // if (product.isSoonSoldOut && product.tags.isDiscount) {
  158 + // product.tags.isNew = false;
  159 + // } else if (product.tags.isDiscount &&
  160 + // (product.tags.isNew || product.tags.isLimited || product.tags.isYohood || product.tags.isAdvance)) {
  161 + // // 打折与其它组合则隐藏打折
  162 + // product.tags.isDiscount = false;
  163 + // } else if (product.tags.isYohood && product.tags.isNew) {
  164 + // // YOHOOD和新品组合显示YOHOOD
  165 + // product.tags.isNew = false;
  166 + // }
159 } 167 }
160 168
161 pruductList.push(product); 169 pruductList.push(product);