Authored by 周少峰

Merge branch 'master' into feature/brands

@@ -127,7 +127,7 @@ exports.brand = (req, res, next) => { @@ -127,7 +127,7 @@ exports.brand = (req, res, next) => {
127 * @return {[type]} [description] 127 * @return {[type]} [description]
128 */ 128 */
129 exports.brandAbout = (req, res, next) => { 129 exports.brandAbout = (req, res, next) => {
130 - let brandDomain = req.params.brandDomain; 130 + let brandDomain = req.query.domain;
131 let shopId = req.query.shopId; 131 let shopId = req.query.shopId;
132 132
133 if (!brandDomain) { 133 if (!brandDomain) {
@@ -9,8 +9,6 @@ @@ -9,8 +9,6 @@
9 const mRoot = '../models'; 9 const mRoot = '../models';
10 const sale = require(`${mRoot}/sale`); // sale model 10 const sale = require(`${mRoot}/sale`); // sale model
11 11
12 -const _ = require('lodash');  
13 -  
14 /** 12 /**
15 * sale 首页 13 * sale 首页
16 * @param {[type]} req [description] 14 * @param {[type]} req [description]
@@ -152,9 +150,6 @@ exports.special = (req, res, next) => { @@ -152,9 +150,6 @@ exports.special = (req, res, next) => {
152 return next(); 150 return next();
153 } 151 }
154 152
155 - _.omit(params, 'specialsale_id');  
156 - params.productPool = specialId;  
157 -  
158 sale.getSaleSpecialData(specialId, params, req.yoho.channel).then(result => { 153 sale.getSaleSpecialData(specialId, params, req.yoho.channel).then(result => {
159 res.render('sale/special', result); 154 res.render('sale/special', result);
160 }).catch(next); 155 }).catch(next);
@@ -442,6 +442,7 @@ const getShopAbout = (shopId, uid, channel) => { @@ -442,6 +442,7 @@ const getShopAbout = (shopId, uid, channel) => {
442 442
443 Object.assign(decorator.shopTopBannerBase, { 443 Object.assign(decorator.shopTopBannerBase, {
444 shopId: shopId, 444 shopId: shopId,
  445 + bannerHeight: 150,
445 shopHome: `/?shopId=${shopId}`, 446 shopHome: `/?shopId=${shopId}`,
446 shopIntro: `/about?shopId=${shopId}`, 447 shopIntro: `/about?shopId=${shopId}`,
447 coled: _.get(result, '[2].data.is_favorite', 'N') === 'Y' 448 coled: _.get(result, '[2].data.is_favorite', 'N') === 'Y'
@@ -491,7 +492,7 @@ const getAdnav = (params) => { @@ -491,7 +492,7 @@ const getAdnav = (params) => {
491 492
492 if (result[1].code === 200 && result[1].data) { 493 if (result[1].code === 200 && result[1].data) {
493 dest.picTitle = brandFolderSeries; 494 dest.picTitle = brandFolderSeries;
494 - Object.assign(dest.list, searchHandler.handleFolderData(result[0].data)); 495 + Object.assign(dest.list, searchHandler.handleSeriesData(result[1].data));
495 } 496 }
496 497
497 498
@@ -896,6 +897,7 @@ const getBaseShopData = (params, extra, channel, shopId) => { @@ -896,6 +897,7 @@ const getBaseShopData = (params, extra, channel, shopId) => {
896 897
897 Object.assign(decorator.shopTopBannerBase, { 898 Object.assign(decorator.shopTopBannerBase, {
898 shopId: shopId, 899 shopId: shopId,
  900 + bannerHeight: 150,
899 shopHome: `/?shopId=${shopId}`, 901 shopHome: `/?shopId=${shopId}`,
900 shopIntro: `/about?shopId=${shopId}`, 902 shopIntro: `/about?shopId=${shopId}`,
901 coled: _.get(result[2], 'data.is_favorite', 'N') === 'Y' 903 coled: _.get(result[2], 'data.is_favorite', 'N') === 'Y'
@@ -904,6 +906,7 @@ const getBaseShopData = (params, extra, channel, shopId) => { @@ -904,6 +906,7 @@ const getBaseShopData = (params, extra, channel, shopId) => {
904 _.unset(resData, 'brand.brandBanner'); 906 _.unset(resData, 'brand.brandBanner');
905 907
906 if (decorator.signboard) { 908 if (decorator.signboard) {
  909 + _.unset(resData, 'brand.node');
907 _.set(resData, 'brand.signboard', decorator.signboard); 910 _.set(resData, 'brand.signboard', decorator.signboard);
908 } 911 }
909 } 912 }
@@ -731,9 +731,9 @@ exports.handlePagerData = (total, params) => { @@ -731,9 +731,9 @@ exports.handlePagerData = (total, params) => {
731 pages: [] 731 pages: []
732 }; 732 };
733 733
734 - let currentPage = parseInt((_.isEmpty(params.page) ? 1 : params.page), 10); // 当前页  
735 - let perPageCount = parseInt((_.isEmpty(params.limit) ? 60 : params.limit), 10); // 每页商品数  
736 - let totalPage = parseInt(total / perPageCount, 10) + 1; // 总页数 734 + let currentPage = parseInt(_.get(params, 'page', 1), 10); // 当前页
  735 + let perPageCount = parseInt(_.get(params, 'limit', 60), 10); // 每页商品数
  736 + let totalPage = Math.ceil(total / perPageCount); // 总页数
737 737
738 if (currentPage === 1) { 738 if (currentPage === 1) {
739 // 当前页为 1,一定没有上一页 739 // 当前页为 1,一定没有上一页
@@ -773,11 +773,14 @@ exports.handlePagerData = (total, params) => { @@ -773,11 +773,14 @@ exports.handlePagerData = (total, params) => {
773 } 773 }
774 } else if (currentPage > totalPage - 2) { 774 } else if (currentPage > totalPage - 2) {
775 for (let i = totalPage; i >= totalPage - 4; i--) { 775 for (let i = totalPage; i >= totalPage - 4; i--) {
776 - pages.push({  
777 - url: handleFilterUrl(params, {page: i}),  
778 - num: i,  
779 - cur: currentPage === i  
780 - }); 776 +
  777 + if (i > 0) {
  778 + pages.push({
  779 + url: handleFilterUrl(params, {page: i}),
  780 + num: i,
  781 + cur: currentPage === i
  782 + });
  783 + }
781 } 784 }
782 pages = _.sortBy(pages, ['num']); 785 pages = _.sortBy(pages, ['num']);
783 } 786 }
@@ -795,7 +798,7 @@ exports.handlePagerData = (total, params) => { @@ -795,7 +798,7 @@ exports.handlePagerData = (total, params) => {
795 num: '...' 798 num: '...'
796 }); 799 });
797 } 800 }
798 - if (currentPage < totalPage - 2) { 801 + if (currentPage < totalPage - 2 && totalPage > 5) {
799 nextPages.push({ 802 nextPages.push({
800 num: '...' 803 num: '...'
801 }); 804 });
@@ -1249,7 +1249,7 @@ exports.handleBrandBanner = (data) => { @@ -1249,7 +1249,7 @@ exports.handleBrandBanner = (data) => {
1249 }; 1249 };
1250 1250
1251 /** 1251 /**
1252 - * 处理品牌系列 1252 + * 处理品牌系列folder_id
1253 * @type {[type]} 1253 * @type {[type]}
1254 */ 1254 */
1255 exports.handleFolderData = (data) => { 1255 exports.handleFolderData = (data) => {
@@ -1266,6 +1266,23 @@ exports.handleFolderData = (data) => { @@ -1266,6 +1266,23 @@ exports.handleFolderData = (data) => {
1266 }; 1266 };
1267 1267
1268 /** 1268 /**
  1269 + * 处理品牌系列series
  1270 + * @type {[type]}
  1271 + */
  1272 +exports.handleSeriesData = (data) => {
  1273 + let dest = [];
  1274 +
  1275 + _.forEach(data, (value) => {
  1276 + dest.push({
  1277 + href: '?series=' + value.id,
  1278 + src: value.series_banner
  1279 + });
  1280 + });
  1281 +
  1282 + return dest;
  1283 +};
  1284 +
  1285 +/**
1269 * 筛选类链接处理的对外接口 1286 * 筛选类链接处理的对外接口
1270 * @type {[type]} 1287 * @type {[type]}
1271 */ 1288 */
@@ -61,7 +61,8 @@ @@ -61,7 +61,8 @@
61 "uuid": "^2.0.2", 61 "uuid": "^2.0.2",
62 "winston": "^2.2.0", 62 "winston": "^2.2.0",
63 "winston-daily-rotate-file": "^1.1.4", 63 "winston-daily-rotate-file": "^1.1.4",
64 - "yoho-node-lib": "0.0.52" 64 + "yoho-express-session": "^1.14.1",
  65 + "yoho-node-lib": "0.1.19"
65 }, 66 },
66 "devDependencies": { 67 "devDependencies": {
67 "autoprefixer": "^6.3.6", 68 "autoprefixer": "^6.3.6",
No preview for this file type
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > 2 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3 <svg xmlns="http://www.w3.org/2000/svg"> 3 <svg xmlns="http://www.w3.org/2000/svg">
4 <metadata> 4 <metadata>
5 -Created by FontForge 20120731 at Tue Oct 11 18:05:14 2016 5 +Created by FontForge 20120731 at Wed Oct 19 11:59:28 2016
6 By admin 6 By admin
7 </metadata> 7 </metadata>
8 <defs> 8 <defs>
@@ -16,10 +16,10 @@ Created by FontForge 20120731 at Tue Oct 11 18:05:14 2016 @@ -16,10 +16,10 @@ Created by FontForge 20120731 at Tue Oct 11 18:05:14 2016
16 ascent="896" 16 ascent="896"
17 descent="-128" 17 descent="-128"
18 x-height="792" 18 x-height="792"
19 - bbox="0 -212 1158 896" 19 + bbox="-0.75 -212 1160 896.75"
20 underline-thickness="50" 20 underline-thickness="50"
21 underline-position="-100" 21 underline-position="-100"
22 - unicode-range="U+0078-E62C" 22 + unicode-range="U+0078-E637"
23 /> 23 />
24 <missing-glyph horiz-adv-x="374" 24 <missing-glyph horiz-adv-x="374"
25 d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> 25 d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
@@ -155,5 +155,32 @@ d="M562 224h109v-111h-109v111zM889 224h109v-111h-109v111zM562 113h109v-110h-109v @@ -155,5 +155,32 @@ d="M562 224h109v-111h-109v111zM889 224h109v-111h-109v111zM562 113h109v-110h-109v
155 h222v-111h-222v111zM889 334h109v-111h-109v111zM780 113h109v-111h-109v111zM562 2h218v-110h-218v110zM889 2h109v-110h-109v110z" /> 155 h222v-111h-222v111zM889 334h109v-111h-109v111zM780 113h109v-111h-109v111zM562 2h218v-110h-218v110zM889 2h109v-110h-109v110z" />
156 <glyph glyph-name="uniE62C" unicode="&#xe62c;" 156 <glyph glyph-name="uniE62C" unicode="&#xe62c;"
157 d="M512 769q-104 0 -192.5 -51.5t-140 -140t-51.5 -193t51.5 -193t140 -140t192.5 -51.5t192.5 51.5t140 140t51.5 193t-51.5 193t-140 140t-192.5 51.5zM660 181h-50v175h-196v-175h-50v395h50v-179h196v179h50v-395z" /> 157 d="M512 769q-104 0 -192.5 -51.5t-140 -140t-51.5 -193t51.5 -193t140 -140t192.5 -51.5t192.5 51.5t140 140t51.5 193t-51.5 193t-140 140t-192.5 51.5zM660 181h-50v175h-196v-175h-50v395h50v-179h196v179h50v-395z" />
  158 + <glyph glyph-name="uniE62D" unicode="&#xe62d;" horiz-adv-x="1000"
  159 +d="M751 766q21 -20 34 -33t19.5 -22.5t8.5 -16t2 -10.5v-13h-119q-8 0 -14 6t-10 14t-6 16.5t-2 12.5v100h3q6 0 13 -2t15.5 -8t22 -16t33.5 -28zM614 720q0 -16 5 -33.5t15 -32t26 -24t38 -9.5h117v-451q0 -24 -9.5 -42t-24.5 -31t-33.5 -20t-35.5 -7h-394q-15 0 -33 8.5
  160 +t-33.5 23t-26 33t-10.5 38.5v543q0 17 7.5 35t21 33.5t30 25.5t35.5 10h305v-100zM664 221q21 0 35.5 14.5t14.5 35.5t-14.5 35.5t-35.5 14.5h-299q-21 0 -35.5 -14.5t-14.5 -35.5t14.5 -35.5t35.5 -14.5h299zM714 470q0 21 -14.5 36t-35.5 15h-299q-21 0 -35.5 -15
  161 +t-14.5 -36t14.5 -35t35.5 -14h299q21 0 35.5 14t14.5 35zM714 470z" />
  162 + <glyph glyph-name="uniE62E" unicode="&#xe62e;"
  163 +d="M154 770v-646h146l-14 -208l240 208h344v646h-716zM752 260h-134v159h-192v-159h-134v382h134v-148h192v148h134v-382z" />
  164 + <glyph glyph-name="uniE62F" unicode="&#xe62f;"
  165 +d="M866.5 747.5q-97.5 97.5 -228 132t-261.5 0t-228.5 -132t-132 -228.5t0 -261.5t132 -228t228.5 -132t261.5 0t228 132t132 228t0 261.5t-132 228.5zM798 199l-101 -101l-187 186l-186 -186l-101 101l186 186l-186 187l101 101l186 -186l187 186l101 -101l-186 -187z" />
  166 + <glyph glyph-name="uniE630" unicode="&#xe630;" horiz-adv-x="1025"
  167 +d="M1024 480v338q0 32 -23 55t-55 23h-331h-14q-55 0 -76 -21l-506 -506q-19 -19 -19 -46t19 -45l387 -387q18 -19 45 -19t46 19l506 506q10 10 15 25.5t5.5 26.5t0.5 31zM764 549q-36 0 -61.5 25.5t-25.5 61.5t25.5 61t61.5 25t61 -25t25 -61t-25 -61.5t-61 -25.5z" />
  168 + <glyph glyph-name="uniE631" unicode="&#xe631;"
  169 +d="M0 812v-1024h1024v1024h-1024zM983 -171h-942v942h942v-942zM288 280h448q9 0 15 6t6 14t-6 14t-15 6h-448q-9 0 -15 -6t-6 -14t6 -14t15 -6z" />
  170 + <glyph glyph-name="uniE632" unicode="&#xe632;"
  171 +d="M0 812v-1024h1024v1024h-1024zM983 -171h-942v942h942v-942zM288 280h204v-204q0 -9 6 -15t14 -6t14 6t6 15v204h204q9 0 15 6t6 14t-6 14t-15 6h-204v204q0 9 -6 15t-14 6t-14 -6t-6 -15v-204h-204q-9 0 -15 -6t-6 -14t6 -14t15 -6z" />
  172 + <glyph glyph-name="uniE633" unicode="&#xe633;"
  173 +d="M127 769v-770h770v770h-770zM555 170h-86v86h86v-86zM555 298h-86v257h86v-257z" />
  174 + <glyph glyph-name="uniE634" unicode="&#xe634;" horiz-adv-x="1025"
  175 +d="M491 6q9 -10 21.5 -10t21.5 10l357 407q9 10 5.5 17.5t-17.5 7.5h-133q-14 0 -23.5 9.5t-9.5 22.5v261q0 13 -10 22.5t-24 9.5h-333q-14 0 -24 -9.5t-10 -22.5v-261q0 -13 -9.5 -22.5t-23.5 -9.5h-133q-14 0 -17.5 -7.5t5.5 -17.5z" />
  176 + <glyph glyph-name="uniE635" unicode="&#xe635;"
  177 +d="M958 758q0 30 -21 51.5t-51 21.5h-749q-30 0 -51 -21.5t-21 -51.5v-748q0 -30 21 -51t51 -21h749q30 0 51 21t21 51v748zM778 454l-267 -267q-14 -14 -34 -14t-34 14l-168 168q-14 14 -14 34t14 34.5t34 14.5t34 -15l134 -133l233 232q14 14 34 14t34 -14t14 -34t-14 -34
  178 +z" />
  179 + <glyph glyph-name="uniE636" unicode="&#xe636;" horiz-adv-x="1163"
  180 +d="M295 196q67 0 114 -47t47 -113.5t-47 -114t-114 -47.5t-114 47.5t-47 114t47 113.5t114 47zM917.5 196q66.5 0 113.5 -47t47 -113.5t-47 -114t-113.5 -47.5t-114 47.5t-47.5 114t47.5 113.5t114 47zM400 894v-99h-210v0l-187 -294v-372h95q27 56 80 90.5t117 34.5
  181 +t117 -34.5t80 -90.5h228q27 56 80 90.5t117.5 34.5t117.5 -34.5t79 -90.5h46v765h-760zM400 452h-283l159 250l124 1v-251v0zM893 701l-131 -276l-63 31l101 206h-105v68h198v-29v0z" />
  182 + <glyph glyph-name="uniE637" unicode="&#xe637;"
  183 +d="M1020 810q0 34 -24 58t-59 24h-851q-34 0 -58.5 -24t-24.5 -58v-852q0 -34 24.5 -58t58.5 -24h851q35 0 59 24t24 58v852zM815 464l-304 -304q-16 -16 -38.5 -16t-38.5 16l-191 191q-17 16 -17 39t16.5 39t39 16t38.5 -16l153 -152l264 264q16 16 39 16t39 -16t16 -38.5
  184 +t-16 -38.5z" />
158 </font> 185 </font>
159 </defs></svg> 186 </defs></svg>
No preview for this file type
No preview for this file type
@@ -417,7 +417,7 @@ @@ -417,7 +417,7 @@
417 417
418 .search-btn { 418 .search-btn {
419 background: resolve('layout/search.png') no-repeat center center; 419 background: resolve('layout/search.png') no-repeat center center;
420 - width: 80px; 420 + width: 78px;
421 height: 28px; 421 height: 28px;
422 float: right; 422 float: right;
423 border: none; 423 border: none;