Authored by htoooth

Merge remote-tracking branch 'origin/release/1.0' into release/1.0

@@ -13,7 +13,7 @@ const brand = require('../models/brand'); @@ -13,7 +13,7 @@ const brand = require('../models/brand');
13 * @param res 13 * @param res
14 */ 14 */
15 const index = (req, res, next) => { 15 const index = (req, res, next) => {
16 - let channel = req.cookies._Channel || 'men'; 16 + let channel = req.yoho.channel || 'men';
17 let contentCode = ''; 17 let contentCode = '';
18 let name = ''; 18 let name = '';
19 19
@@ -8,13 +8,13 @@ @@ -8,13 +8,13 @@
8 <img class="lazy-img" data-original="{{#if smallImg}}{{image src 218 490}}{{^}}{{image src 327 490}}{{/if}}" alt="{{alt}}"> 8 <img class="lazy-img" data-original="{{#if smallImg}}{{image src 218 490}}{{^}}{{image src 327 490}}{{/if}}" alt="{{alt}}">
9 </a> 9 </a>
10 <div class="brand-name"> 10 <div class="brand-name">
11 - <a href="{{url}}"> 11 + <a href="{{url}}" target="_blank">
12 <span class="bottom">{{title}}</span> 12 <span class="bottom">{{title}}</span>
13 </a> 13 </a>
14 </div> 14 </div>
15 {{^}} 15 {{^}}
16 <div class="brand-name"> 16 <div class="brand-name">
17 - <a href="{{url}}"> 17 + <a href="{{url}}" target="_blank">
18 <span class="top">{{title}}</span> 18 <span class="top">{{title}}</span>
19 </a> 19 </a>
20 </div> 20 </div>
@@ -19,11 +19,22 @@ const index = (req, res, next) => { @@ -19,11 +19,22 @@ const index = (req, res, next) => {
19 let pageNum = req.query.page || 1; 19 let pageNum = req.query.page || 1;
20 let limit = req.query.limit || 20; 20 let limit = req.query.limit || 20;
21 let appType = 1; 21 let appType = 1;
  22 + let udid = md5(req.ip);
  23 + let channel = req.cookies._Channel || 'men';
  24 + let gender = '';
  25 +
  26 + if (channel === 'men') {
  27 + gender = '1,3';
  28 + } else if (channel === 'women') {
  29 + gender = '2,3';
  30 + } else {
  31 + gender = '3,3';
  32 + }
  33 +
  34 + console.log(gender);
22 35
23 - // let gender = req.query.brand || 1; 36 + editorialModel.getIndexData(pageNum, limit, appType, udid, gender).then((result) => {
24 37
25 - editorialModel.getIndexData(pageNum, limit, appType).then((result) => {  
26 - // console.log(result.msg)  
27 res.display('index', { 38 res.display('index', {
28 module: 'editorial', 39 module: 'editorial',
29 page: 'index', 40 page: 'index',
@@ -67,8 +78,9 @@ const list = (req, res) => { @@ -67,8 +78,9 @@ const list = (req, res) => {
67 let limit = req.query.limit || 20; 78 let limit = req.query.limit || 20;
68 let tag = req.query.query; 79 let tag = req.query.query;
69 let authorId = req.query.authorId; 80 let authorId = req.query.authorId;
  81 + let udid = md5(req.ip);
70 82
71 - editorialModel.getListData(pageNum, limit, tag, authorId).then((result) => { 83 + editorialModel.getListData(pageNum, limit, tag, authorId, udid).then((result) => {
72 84
73 res.display('list', { 85 res.display('list', {
74 module: 'editorial', 86 module: 'editorial',
@@ -116,10 +128,11 @@ const list = (req, res) => { @@ -116,10 +128,11 @@ const list = (req, res) => {
116 */ 128 */
117 const detail = (req, res, next) => { 129 const detail = (req, res, next) => {
118 let id = req.params.id; 130 let id = req.params.id;
  131 + let appType = 1;
119 132
120 // let clientType = 'pc'; 133 // let clientType = 'pc';
121 134
122 - editorialModel.getDetailData(id).then((result) => { 135 + editorialModel.getDetailData(id, appType).then((result) => {
123 res.display('detail', { 136 res.display('detail', {
124 module: 'editorial', 137 module: 'editorial',
125 page: 'detail', 138 page: 'detail',
@@ -35,8 +35,6 @@ const _processListData = (list) => { @@ -35,8 +35,6 @@ const _processListData = (list) => {
35 total: list.total 35 total: list.total
36 }); 36 });
37 37
38 - // console.log(list)  
39 -  
40 _.forEach(list.list.artList, (data) => { 38 _.forEach(list.list.artList, (data) => {
41 39
42 if (data.author) { 40 if (data.author) {
@@ -49,10 +47,11 @@ const _processListData = (list) => { @@ -49,10 +47,11 @@ const _processListData = (list) => {
49 data.publishTime = data.publishTime.replace(/日/g, ''); 47 data.publishTime = data.publishTime.replace(/日/g, '');
50 48
51 data.isPraise = data.isPraise === 'Y'; 49 data.isPraise = data.isPraise === 'Y';
52 -  
53 }); 50 });
54 listData.tabs = list.list.artList; 51 listData.tabs = list.list.artList;
55 52
  53 + // console.log(listData)
  54 +
56 return listData; 55 return listData;
57 }; 56 };
58 57
@@ -65,13 +64,16 @@ const _processListData = (list) => { @@ -65,13 +64,16 @@ const _processListData = (list) => {
65 * @param limit 64 * @param limit
66 * @returns {*} 65 * @returns {*}
67 */ 66 */
68 -const getIndexData = (pageNum, limit, appType) => { 67 +const getIndexData = (pageNum, limit, appType, udid, gender) => {
69 return serviceAPI.get('guang/api/*/article/getList', { 68 return serviceAPI.get('guang/api/*/article/getList', {
70 page: pageNum, 69 page: pageNum,
71 limit: limit, 70 limit: limit,
72 - app_type: appType 71 + app_type: appType,
  72 + udid: udid,
  73 + gender: gender
73 }).then((result) => { 74 }).then((result) => {
74 if (result && result.code === 200) { 75 if (result && result.code === 200) {
  76 + // console.log(result)
75 return _processListData(result.data); 77 return _processListData(result.data);
76 } else { 78 } else {
77 logger.error('Information page list data return code is not 200'); 79 logger.error('Information page list data return code is not 200');
@@ -88,10 +90,11 @@ const getIndexData = (pageNum, limit, appType) => { @@ -88,10 +90,11 @@ const getIndexData = (pageNum, limit, appType) => {
88 * @param authorId 90 * @param authorId
89 * @returns {*} 91 * @returns {*}
90 */ 92 */
91 -const getListData = (pageNum, limit, tag, authorId) => { 93 +const getListData = (pageNum, limit, tag, authorId, udid) => {
92 let param = { 94 let param = {
93 page: pageNum, 95 page: pageNum,
94 - limit: limit 96 + limit: limit,
  97 + udid: udid
95 }; 98 };
96 99
97 if (tag) { 100 if (tag) {
@@ -188,8 +191,8 @@ const _processHeadData = (list) => { @@ -188,8 +191,8 @@ const _processHeadData = (list) => {
188 } 191 }
189 }); 192 });
190 193
191 - newData.headData.time = newData.headData.time.replace(/-/g, '/');  
192 - newData.headData.time = newData.headData.time.replace(':00', '', 2); 194 + // newData.headData.time = newData.headData.time.replace(/-/g, '/');
  195 + // newData.headData.time = newData.headData.time.replace(':00', '', 2);
193 196
194 let id = newData.headData.authorId; 197 let id = newData.headData.authorId;
195 198
@@ -341,9 +344,10 @@ const _processContentData = (list) => { @@ -341,9 +344,10 @@ const _processContentData = (list) => {
341 * @param id 344 * @param id
342 * @returns {*} 345 * @returns {*}
343 */ 346 */
344 -const _getHeadData = (id) => { 347 +const _getHeadData = (id, appType) => {
345 return serviceAPI.get('/guang/api/*/article/getArticleBaseInfo', { 348 return serviceAPI.get('/guang/api/*/article/getArticleBaseInfo', {
346 - id: id 349 + id: id,
  350 + app_type: appType
347 }).then((result) => { 351 }).then((result) => {
348 if (result && result.code === 200) { 352 if (result && result.code === 200) {
349 return result.data; 353 return result.data;
@@ -400,6 +404,10 @@ const _getCommentsData = (id) => { @@ -400,6 +404,10 @@ const _getCommentsData = (id) => {
400 article_id: id 404 article_id: id
401 }).then((result) => { 405 }).then((result) => {
402 if (result && result.code === 200) { 406 if (result && result.code === 200) {
  407 + _.forEach(result.data.list, function(data) {
  408 + data.create_time = data.create_time.replace(/月/g, '/');
  409 + data.create_time = data.create_time.replace(/日/g, '');
  410 + });
403 return camelCase(result.data); 411 return camelCase(result.data);
404 } else { 412 } else {
405 logger.error('Review data return code is not 200'); 413 logger.error('Review data return code is not 200');
@@ -433,12 +441,15 @@ const _getRelateBrand = (id) => { @@ -433,12 +441,15 @@ const _getRelateBrand = (id) => {
433 }); 441 });
434 }; 442 };
435 443
436 -const _getArticlePre = (id) => { 444 +const _getArticlePre = (id, appType) => {
437 return serviceAPI.get('guang/api/*/article/getArticlePre', { 445 return serviceAPI.get('guang/api/*/article/getArticlePre', {
438 - id: id 446 + id: id,
  447 + app_type: appType
439 }).then((result) => { 448 }).then((result) => {
440 if (result && result.code === 200) { 449 if (result && result.code === 200) {
441 - // console.log(result); 450 + // console.log(1)
  451 + // let id = result.data.articleIdPre;
  452 + // _getHeadData(id, appType);
442 return result; 453 return result;
443 } else { 454 } else {
444 logger.error('上一篇不是200'); 455 logger.error('上一篇不是200');
@@ -554,13 +565,13 @@ const shareData = () => { @@ -554,13 +565,13 @@ const shareData = () => {
554 * @param id 565 * @param id
555 * @returns {*} 566 * @returns {*}
556 */ 567 */
557 -const getDetailData = (id) => { 568 +const getDetailData = (id, appType) => {
558 return co(function *() { 569 return co(function *() {
559 - let result = yield Promise.all([_getHeadData(id), 570 + let result = yield Promise.all([_getHeadData(id, appType),
560 _getArticleData(id), 571 _getArticleData(id),
561 _getContentData(id), 572 _getContentData(id),
562 _getCommentsData(id), 573 _getCommentsData(id),
563 - _getArticlePre(id), 574 + _getArticlePre(id, appType),
564 _getRelateBrand(id)]); 575 _getRelateBrand(id)]);
565 let res = yield _processHeadData([result[0], result[1], result[3]]); 576 let res = yield _processHeadData([result[0], result[1], result[3]]);
566 577
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <div class="content">{{intro}}</div> 8 <div class="content">{{intro}}</div>
9 <div class="msg-app"> 9 <div class="msg-app">
10 <span class="like-comment"> 10 <span class="like-comment">
11 - <i class="iconfont like-icon{{#if isPraise}}liked{{/if}}">&#xe60e;</i> 11 + <i class="iconfont like-icon {{#if isPraise}}liked{{/if}}">&#xe60e;</i>
12 <b class="like-num">{{praiseNum}}</b> 12 <b class="like-num">{{praiseNum}}</b>
13 </span> 13 </span>
14 </div> 14 </div>
@@ -94,12 +94,12 @@ const index = (req, res, next) => { @@ -94,12 +94,12 @@ const index = (req, res, next) => {
94 } 94 }
95 }); 95 });
96 _.forEach(result.date.selectMonth, function(x) { 96 _.forEach(result.date.selectMonth, function(x) {
97 - if (x.value === a[1]) { 97 + if (parseInt(x.value, 10) === parseInt(a[1], 10)) {
98 x.isSelected = 'selected'; 98 x.isSelected = 'selected';
99 } 99 }
100 }); 100 });
101 _.forEach(result.date.selectDay, function(x) { 101 _.forEach(result.date.selectDay, function(x) {
102 - if (x.value === a[2]) { 102 + if (parseInt(x.value, 10) === parseInt(a[2], 10)) {
103 x.isSelected = 'selected'; 103 x.isSelected = 'selected';
104 } 104 }
105 }); 105 });
@@ -247,6 +247,8 @@ const _getUserOrder = (uid, type, page) => { @@ -247,6 +247,8 @@ const _getUserOrder = (uid, type, page) => {
247 type: type, 247 type: type,
248 page: page, 248 page: page,
249 limit: pageSize 249 limit: pageSize
  250 + }, {
  251 + cache: true
250 }).then(result => { 252 }).then(result => {
251 let orderList = []; 253 let orderList = [];
252 let total = false; 254 let total = false;
@@ -457,7 +459,7 @@ const getOrderData = (uid, type, page) => { @@ -457,7 +459,7 @@ const getOrderData = (uid, type, page) => {
457 type: type 459 type: type
458 }; 460 };
459 461
460 - const empty = emptyObject[type]; 462 + const empty = emptyObject[type || 1];
461 463
462 navBar.tabs[typeActiveIndexMap[type]].isActive = true; 464 navBar.tabs[typeActiveIndexMap[type]].isActive = true;
463 465
@@ -541,7 +543,7 @@ const getOrderDetail = (uid, code) => { @@ -541,7 +543,7 @@ const getOrderDetail = (uid, code) => {
541 543
542 detail.paymentTypeStr = paymentTypeStr[detail.paymentType]; 544 detail.paymentTypeStr = paymentTypeStr[detail.paymentType];
543 545
544 - detail.address = detail.area + detail.address; 546 + detail.allAddress = detail.area + detail.address;
545 547
546 detail.expressInfo = express; 548 detail.expressInfo = express;
547 detail.expressInfo.addressList = _convertAddress(express.expressDetail, detail.createTime); 549 detail.expressInfo.addressList = _convertAddress(express.expressDetail, detail.createTime);
1 <div class="user-info info-box" data-area="{{areaCode}}"> 1 <div class="user-info info-box" data-area="{{areaCode}}">
2 <h4 class="status-title">收货人信息</h4> 2 <h4 class="status-title">收货人信息</h4>
3 <p class="text user-name-sel" data-name="{{userName}}">收货人:{{userName}}</p> 3 <p class="text user-name-sel" data-name="{{userName}}">收货人:{{userName}}</p>
4 - <p class="text user-addr-sel" data-address="{{address}}">收货地址:{{address}}</p> 4 + <p class="text user-addr-sel" data-address="{{address}}">收货地址:{{allAddress}}</p>
5 <p class="text user-mo-sel" data-mobile="{{mobile}}">联系电话:{{mobile}}</p> 5 <p class="text user-mo-sel" data-mobile="{{mobile}}">联系电话:{{mobile}}</p>
6 <p class="text user-ph-sel hide" data-phone="{{phone}}">联系电话:{{phone}}</p> 6 <p class="text user-ph-sel hide" data-phone="{{phone}}">联系电话:{{phone}}</p>
7 </div> 7 </div>
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </div> 33 </div>
34 <div class="form-group"> 34 <div class="form-group">
35 <label class="label-name">手机:</label> 35 <label class="label-name">手机:</label>
36 - {{#if info.verify_mobile}} 36 + {{#if info.mobile}}
37 <input id="mobile" class="input no-edit" value="{{info.mobile}}"> 37 <input id="mobile" class="input no-edit" value="{{info.mobile}}">
38 <a class="blue operation" href="{{stepUrl}}/modifyMobile">修改</a> 38 <a class="blue operation" href="{{stepUrl}}/modifyMobile">修改</a>
39 {{else}} 39 {{else}}
@@ -17,6 +17,7 @@ const Query = { @@ -17,6 +17,7 @@ const Query = {
17 index: (req, res, next) => { 17 index: (req, res, next) => {
18 let q = req.query; 18 let q = req.query;
19 let query = q.query || ''; 19 let query = q.query || '';
  20 + let channel = req.cookies._Channel || req.query._Channel || 'men';
20 21
21 q.page = parseInt(q.page || 1, 10); 22 q.page = parseInt(q.page || 1, 10);
22 q.order = q.order || 's_n_desc'; 23 q.order = q.order || 's_n_desc';
@@ -36,7 +37,7 @@ const Query = { @@ -36,7 +37,7 @@ const Query = {
36 37
37 if (result && result.code === 200 && result.data) { 38 if (result && result.code === 200 && result.data) {
38 let data = camelCase(result.data); 39 let data = camelCase(result.data);
39 - let nav = [DataHelper.getChannelNav()]; 40 + let nav = [DataHelper.getChannelNav(channel)];
40 41
41 nav.push({ 42 nav.push({
42 name: query ? `"${query}" ${data.total}个结果` : `共${data.total}个结果` 43 name: query ? `"${query}" ${data.total}个结果` : `共${data.total}个结果`
@@ -150,7 +150,7 @@ const shop = { @@ -150,7 +150,7 @@ const shop = {
150 }; 150 };
151 151
152 res.display('shop-list', _.assign(data, { 152 res.display('shop-list', _.assign(data, {
153 - products: DataHelper.handleProductList(ret.productList, q), 153 + products: DataHelper.handleProductList(ret.productList, q, false),
154 order: q.order 154 order: q.order
155 })); 155 }));
156 } else { 156 } else {
@@ -407,7 +407,9 @@ const helpers = { @@ -407,7 +407,9 @@ const helpers = {
407 * @param list 407 * @param list
408 * @returns {*} 408 * @returns {*}
409 */ 409 */
410 - handleProductList(list, q) { 410 + handleProductList(list, q, showBrand) {
  411 + showBrand = typeof showBrand === 'undefined' ? true : showBrand;
  412 +
411 if (_.isArray(list)) { 413 if (_.isArray(list)) {
412 list.forEach(g => { 414 list.forEach(g => {
413 let goodsList = g.goodsList; 415 let goodsList = g.goodsList;
@@ -426,6 +428,7 @@ const helpers = { @@ -426,6 +428,7 @@ const helpers = {
426 } 428 }
427 g.salesPrice = g.salesPrice || g.marketPrice; 429 g.salesPrice = g.salesPrice || g.marketPrice;
428 g.defaultImages = defaultImages; 430 g.defaultImages = defaultImages;
  431 + g.showBrand = showBrand;
429 if (g.salesPrice === g.marketPrice) { 432 if (g.salesPrice === g.marketPrice) {
430 delete g.marketPrice; 433 delete g.marketPrice;
431 } 434 }
@@ -36,6 +36,19 @@ function _paramHanlde(obj) { @@ -36,6 +36,19 @@ function _paramHanlde(obj) {
36 obj.standard_value_id = standards[1]; 36 obj.standard_value_id = standards[1];
37 } 37 }
38 38
  39 + if (obj.channel) {
  40 + switch (obj.channel) {
  41 + case 'men':
  42 + obj.gender = '1,3';
  43 + break;
  44 + case 'women':
  45 + obj.gender = '2,3';
  46 + break;
  47 + default:
  48 + break;
  49 + }
  50 + }
  51 +
39 return obj; 52 return obj;
40 } 53 }
41 54
@@ -135,7 +135,7 @@ const ShopService = { @@ -135,7 +135,7 @@ const ShopService = {
135 info.shopId = shopId; 135 info.shopId = shopId;
136 info.name = shopIntro.shopName; 136 info.name = shopIntro.shopName;
137 info.info = shopIntro.shopIntro; 137 info.info = shopIntro.shopIntro;
138 - info.btnName = '店铺介绍'; 138 + info.btnName = '品牌介绍';
139 info.isFavorite = shopIntro.isFavorite === 'Y'; 139 info.isFavorite = shopIntro.isFavorite === 'Y';
140 140
141 let shopData = yield Promise.all([ShopService.getShopDecorator(shopId), 141 let shopData = yield Promise.all([ShopService.getShopDecorator(shopId),
@@ -6,9 +6,11 @@ @@ -6,9 +6,11 @@
6 <img class="lazy" data-original="{{image defaultImages 263 344}}" width="263" height="344" alt=""> 6 <img class="lazy" data-original="{{image defaultImages 263 344}}" width="263" height="344" alt="">
7 </a> 7 </a>
8 </div> 8 </div>
  9 + {{#if showBrand}}
9 <div class="goods-brand"> 10 <div class="goods-brand">
10 <a href="/product/shop/{{brandDomain}}" target="_self">{{brandName}}</a> 11 <a href="/product/shop/{{brandDomain}}" target="_self">{{brandName}}</a>
11 </div> 12 </div>
  13 + {{/if}}
12 <div class="goods-name"> 14 <div class="goods-name">
13 <a href="{{url}}" target="_blank">{{productName}}</a> 15 <a href="{{url}}" target="_blank">{{productName}}</a>
14 </div> 16 </div>
@@ -46,7 +46,7 @@ const addToCart = (options) => { @@ -46,7 +46,7 @@ const addToCart = (options) => {
46 46
47 if (shoppingKey) { 47 if (shoppingKey) {
48 _.merge(params, { 48 _.merge(params, {
49 - shoppingKey: shoppingKey 49 + shopping_key: shoppingKey
50 }); 50 });
51 } 51 }
52 52
@@ -91,6 +91,10 @@ $('.yoho-group a').hover(function() { @@ -91,6 +91,10 @@ $('.yoho-group a').hover(function() {
91 $(this).text(data.en); 91 $(this).text(data.en);
92 }); 92 });
93 93
  94 +$('.tag-bag').hover(function() {
  95 + refreshBag();
  96 +});
  97 +
94 $bagGoodsList.on('click', '.del-good-btn', function() { 98 $bagGoodsList.on('click', '.del-good-btn', function() {
95 var $this = $(this), 99 var $this = $(this),
96 data = $this.data(); 100 data = $this.data();
@@ -172,7 +176,7 @@ $searchKey.keyup(function(e) { @@ -172,7 +176,7 @@ $searchKey.keyup(function(e) {
172 }); 176 });
173 177
174 // ie8输入框提示特殊处理 178 // ie8输入框提示特殊处理
175 -if ($.browser && $.browser.msie && parseInt($.browser.version, 10) === 8) { 179 +if (!!window.ActiveXObject && !!document.documentMode) {
176 $searchKey.focus(function() { 180 $searchKey.focus(function() {
177 var key = $searchKey.val(); 181 var key = $searchKey.val();
178 182
@@ -185,7 +189,7 @@ if ($.browser && $.browser.msie && parseInt($.browser.version, 10) === 8) { @@ -185,7 +189,7 @@ if ($.browser && $.browser.msie && parseInt($.browser.version, 10) === 8) {
185 if ($.trim(key) === '') { 189 if ($.trim(key) === '') {
186 $searchKey.val('search').css('color', '#aaa'); 190 $searchKey.val('search').css('color', '#aaa');
187 } 191 }
188 - }); 192 + }).val('search').css('color', '#aaa');
189 } 193 }
190 194
191 $clearInput.click(function() { 195 $clearInput.click(function() {
@@ -39,17 +39,18 @@ var Bll = { @@ -39,17 +39,18 @@ var Bll = {
39 var birthdayForm = $('#birthday'); 39 var birthdayForm = $('#birthday');
40 var nickForm = $('#nick_name'); 40 var nickForm = $('#nick_name');
41 var realNameForm = $('#username'); 41 var realNameForm = $('#username');
42 - var addressForm = $('.form-group-address'); 42 +
  43 + // var addressForm = $('.form-group-address');
43 var flag = true; 44 var flag = true;
44 45
45 !regBirth.test(info.birthday) ? birthdayForm.next().show() : birthdayForm.next().hide(); 46 !regBirth.test(info.birthday) ? birthdayForm.next().show() : birthdayForm.next().hide();
46 !regName.test(info.nick_name) ? nickForm.next().show() : nickForm.next().hide(); 47 !regName.test(info.nick_name) ? nickForm.next().show() : nickForm.next().hide();
47 !regRealName.test(info.username) ? realNameForm.next().show() : realNameForm.next().hide(); 48 !regRealName.test(info.username) ? realNameForm.next().show() : realNameForm.next().hide();
48 - typeof (info.area_code) === 'undefined' ?  
49 - addressForm.css('margin-bottom', '20px').find('.error-tips').show() :  
50 - addressForm.css('margin-bottom', '70px').find('.error-tips').hide();  
51 - if (!regBirth.test(info.birthday) || !regName.test(info.nick_name) || !regRealName.test(info.username) ||  
52 - typeof (info.area_code) === 'undefined') { 49 +
  50 + // typeof (info.area_code) === 'undefined' ?
  51 + // addressForm.css('margin-bottom', '20px').find('.error-tips').show() :
  52 + // addressForm.css('margin-bottom', '70px').find('.error-tips').hide();
  53 + if (!regBirth.test(info.birthday) || !regName.test(info.nick_name) || !regRealName.test(info.username)) {
53 flag = false; 54 flag = false;
54 } 55 }
55 return flag; 56 return flag;
@@ -31,6 +31,8 @@ var disableSMSBtn = function() { @@ -31,6 +31,8 @@ var disableSMSBtn = function() {
31 var validatePhoneNumLocal = function(phoneNum) { 31 var validatePhoneNumLocal = function(phoneNum) {
32 var length = phoneNum.length; 32 var length = phoneNum.length;
33 33
  34 + phoneNum = parseInt(phoneNum, 10);
  35 +
34 if (length === 0) { 36 if (length === 0) {
35 new _alert('请输入手机号码!').show(); 37 new _alert('请输入手机号码!').show();
36 return false; 38 return false;
@@ -253,14 +253,15 @@ $('#keep-shopping').click(function() { @@ -253,14 +253,15 @@ $('#keep-shopping').click(function() {
253 253
254 $('#brand-fav').click(function() { 254 $('#brand-fav').click(function() {
255 var $this = $(this), 255 var $this = $(this),
256 - info = $this.data(),  
257 - param = {}; 256 + param = {
  257 + brandId: $this.data('id'),
  258 + type: 'add'
  259 + };
258 260
259 - if (!info.id) { 261 + if (!param.brandId) {
260 return; 262 return;
261 } 263 }
262 264
263 - param.brandId = info.id;  
264 if ($this.hasClass('coll')) { 265 if ($this.hasClass('coll')) {
265 param.type = 'cancel'; 266 param.type = 'cancel';
266 } 267 }
@@ -366,6 +366,11 @@ Cart = { @@ -366,6 +366,11 @@ Cart = {
366 var newProductSku; 366 var newProductSku;
367 var oldProductSku; 367 var oldProductSku;
368 368
  369 + // 如果已经有选尺寸颜色的面板显示,则不重复加载
  370 + if (editTarget.find('.edit-color-size').length > 0) {
  371 + return;
  372 + }
  373 +
369 $.ajax({ 374 $.ajax({
370 type: 'GET', 375 type: 'GET',
371 url: '/product/item/getProductInfo', 376 url: '/product/item/getProductInfo',
@@ -403,13 +408,20 @@ Cart = { @@ -403,13 +408,20 @@ Cart = {
403 defaultColor: defaultColor, 408 defaultColor: defaultColor,
404 defaultSize: defaultSize, 409 defaultSize: defaultSize,
405 defaultImg: defaultImg 410 defaultImg: defaultImg
406 - })  
407 - ); 411 + }));
408 412
409 oldProductSku = editTarget.find('.current-sizes .current').attr('data-sku'); 413 oldProductSku = editTarget.find('.current-sizes .current').attr('data-sku');
410 414
411 - editTarget.delegate('#confirm', 'click', function(e) { 415 + // rebind events(Tips依赖接口数据,so 不能delegate)
  416 + editTarget.find('#confirm').click(function(e) {
412 e.preventDefault(); 417 e.preventDefault();
  418 +
  419 + // 没有重新选择颜色-尺码,则不用重新请求显示
  420 + if (!newProductSku || newProductSku === oldProductSku) {
  421 + editTarget.find('.edit-color-size').remove();
  422 + return false;
  423 + }
  424 +
413 Util.ajax({ 425 Util.ajax({
414 url: '/shopping/cart/updateProduct', 426 url: '/shopping/cart/updateProduct',
415 type: 'PUT', 427 type: 'PUT',
@@ -428,15 +440,21 @@ Cart = { @@ -428,15 +440,21 @@ Cart = {
428 } 440 }
429 }); 441 });
430 return false; 442 return false;
431 - }).delegate('#cancel', 'click', function(e) { 443 + });
  444 +
  445 + editTarget.find('#cancel').click(function(e) {
432 e.preventDefault(); 446 e.preventDefault();
433 editTarget.find('.edit-color-size').remove(); 447 editTarget.find('.edit-color-size').remove();
434 setEditable(); 448 setEditable();
435 return false; 449 return false;
436 - }).delegate('.edit-color-size', 'click', function(e) { 450 + });
  451 +
  452 + editTarget.find('.edit-color-size').click(function(e) {
437 e.preventDefault(); 453 e.preventDefault();
438 return false; 454 return false;
439 - }).delegate('.color-item', 'click', function(e) { 455 + });
  456 +
  457 + editTarget.find('.color-item').click(function(e) {
440 e.preventDefault(); 458 e.preventDefault();
441 selectColor = $(this); 459 selectColor = $(this);
442 if (!selectColor.hasClass('current-color')) { 460 if (!selectColor.hasClass('current-color')) {
@@ -452,7 +470,15 @@ Cart = { @@ -452,7 +470,15 @@ Cart = {
452 .find('.selected-color').text(selectColor.attr('data-title')); 470 .find('.selected-color').text(selectColor.attr('data-title'));
453 } 471 }
454 return false; 472 return false;
455 - }).delegate('.current-sizes .size-item', 'click', function() { 473 + });
  474 +
  475 + editTarget.find('.current-sizes .size-item').click(function() {
  476 + var $this = $(this);
  477 +
  478 + if ($this.hasClass('current')) {
  479 + return;
  480 + }
  481 +
456 $(this).addClass('current').siblings('.current').removeClass('current'); 482 $(this).addClass('current').siblings('.current').removeClass('current');
457 newProductSku = $(this).attr('data-sku'); 483 newProductSku = $(this).attr('data-sku');
458 }); 484 });
@@ -48,54 +48,7 @@ var Util = { @@ -48,54 +48,7 @@ var Util = {
48 * @params { Function } callback 购物车刷新后回调 48 * @params { Function } callback 购物车刷新后回调
49 */ 49 */
50 refreshCart: function(data, callback) { 50 refreshCart: function(data, callback) {
51 - // var template;  
52 -  
53 - if (!data.hasGoods) {  
54 - $('#cart_content').html(emptyCartTpl);  
55 - return;  
56 - }  
57 -  
58 - // // helpers start  
59 - // hbs.registerHelper('multiple', function(num1, num2) {  
60 - // num1 = typeof num1 === 'number' ? num1 : parseFloat(num1, 10);  
61 - // num2 = typeof num2 === 'number' ? num2 : parseFloat(num2, 10);  
62 -  
63 - // if (num1 && num2) {  
64 - // return num1 * num2;  
65 - // }  
66 - // });  
67 -  
68 - // hbs.registerHelper('isEqual', function(v1, v2, options) {  
69 - // if (v1 === v2) {  
70 - // return options.fn(this);  
71 - // }  
72 - // return options.inverse(this);  
73 - // });  
74 -  
75 - // hbs.registerHelper('round', function(num, fixedNum) {  
76 - // num = typeof num === 'number' ? num : parseFloat(num, 10);  
77 - // return num.toFixed(fixedNum);  
78 - // });  
79 -  
80 - // hbs.registerHelper('showStorage', function(leftNumber) {  
81 - // leftNumber = typeof num1 === 'number' ? leftNumber : parseFloat(leftNumber, 10);  
82 -  
83 - // if (leftNumber <= 3 && leftNumber >= 0) {  
84 - // return '仅剩' + leftNumber + '件';  
85 - // } else if (leftNumber < 0) {  
86 - // return '库存不足';  
87 - // }  
88 - // });  
89 -  
90 - // hbs.registerHelper('image', function(url, width, height, mode) {  
91 - // mode = parseInt(mode, 10) ? mode : 2;  
92 - // url = url || '';  
93 - // return url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode);  
94 - // });  
95 -  
96 - // helpers end  
97 - // template = hbs.compile($('#cart-content-tpl').html());  
98 - $('#cart_content').html(cartTpl(data)); 51 + $('#cart_content').html(data.hasGoods ? cartTpl(data) : emptyCartTpl);
99 52
100 if (callback) { 53 if (callback) {
101 return callback(); 54 return callback();
@@ -411,12 +411,12 @@ @@ -411,12 +411,12 @@
411 } 411 }
412 412
413 .word-count-tip { 413 .word-count-tip {
414 - display: inline-block; 414 + display: block;
415 height: 48px; 415 height: 48px;
416 line-height: 48px; 416 line-height: 48px;
417 -  
418 font-size: 12px; 417 font-size: 12px;
419 color: #c8c8c8; 418 color: #c8c8c8;
  419 + float: right;
420 420
421 .exceed-count { 421 .exceed-count {
422 color: #f00; 422 color: #f00;
@@ -425,7 +425,7 @@ @@ -425,7 +425,7 @@
425 425
426 .publish-btn { 426 .publish-btn {
427 margin-top: 10px; 427 margin-top: 10px;
428 - float: right; 428 + float: left;
429 width: 100px; 429 width: 100px;
430 height: 30px; 430 height: 30px;
431 line-height: 33px; 431 line-height: 33px;
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 } 29 }
30 30
31 .no-edit { 31 .no-edit {
32 - width: 80px; 32 + width: 100px;
33 border: none; 33 border: none;
34 } 34 }
35 35
@@ -311,7 +311,7 @@ @@ -311,7 +311,7 @@
311 } 311 }
312 } 312 }
313 .goods-name { 313 .goods-name {
314 - padding: 5px; 314 + padding: 10px;
315 width: 265px; 315 width: 265px;
316 overflow: hidden; 316 overflow: hidden;
317 text-overflow: ellipsis; 317 text-overflow: ellipsis;
@@ -319,7 +319,7 @@ @@ -319,7 +319,7 @@
319 } 319 }
320 320
321 .goods-price { 321 .goods-price {
322 - padding: 15px; 322 + padding: 10px;
323 font-size: 16px; 323 font-size: 16px;
324 font-weight: 700; 324 font-weight: 700;
325 325
@@ -120,6 +120,11 @@ $hoverColor: #379ed6; @@ -120,6 +120,11 @@ $hoverColor: #379ed6;
120 } 120 }
121 } 121 }
122 122
  123 + .pro-name > a {
  124 + height: 100%;
  125 + display: block;
  126 + }
  127 +
123 .price { 128 .price {
124 display: inline-block; 129 display: inline-block;
125 padding: 59px 0; 130 padding: 59px 0;
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 <div class="input-row necessary"> 15 <div class="input-row necessary">
16 <span class="asterisk">*</span> 16 <span class="asterisk">*</span>
17 <label for="user-address">详细地址:</label> 17 <label for="user-address">详细地址:</label>
18 - <input class="input validate" class="long" type="text" id="user-address" placeholder="街道名称或小区名称" value={{address}}> 18 + <input class="input validate" class="long" type="text" id="user-address" placeholder="街道名称或小区名称" value="{{address}}">
19 </div> 19 </div>
20 <div class="input-row necessary"> 20 <div class="input-row necessary">
21 <span class="asterisk">*</span> 21 <span class="asterisk">*</span>