Authored by 陈峰

push

@@ -143,6 +143,7 @@ typings/ @@ -143,6 +143,7 @@ typings/
143 ### YOHO ### 143 ### YOHO ###
144 dist 144 dist
145 public/build/bundle/* 145 public/build/bundle/*
  146 +public/build/dll/*
146 public/build/dist/* 147 public/build/dist/*
147 public/css/* 148 public/css/*
148 public/bundle/* 149 public/bundle/*
@@ -27,6 +27,7 @@ const pkg = require('./package.json'); @@ -27,6 +27,7 @@ const pkg = require('./package.json');
27 const cookieSession = require('client-sessions'); 27 const cookieSession = require('client-sessions');
28 const memcachedSession = require('yoho-express-session'); 28 const memcachedSession = require('yoho-express-session');
29 const memcached = require('connect-memcached'); 29 const memcached = require('connect-memcached');
  30 +const hbsEvent = require('./config/hbsevent');
30 const MemcachedStore = memcached(memcachedSession); 31 const MemcachedStore = memcached(memcachedSession);
31 const _ = require('lodash'); 32 const _ = require('lodash');
32 33
@@ -58,6 +59,8 @@ app.set('etag', false); @@ -58,6 +59,8 @@ app.set('etag', false);
58 59
59 app.enable('trust proxy'); 60 app.enable('trust proxy');
60 61
  62 +app.disable('x-powered-by');
  63 +
61 const safeStringify = require('fast-safe-stringify'); 64 const safeStringify = require('fast-safe-stringify');
62 65
63 // 循环对象检测 66 // 循环对象检测
@@ -95,7 +98,8 @@ app.use(global.yoho.hbs({ @@ -95,7 +98,8 @@ app.use(global.yoho.hbs({
95 layoutsDir: path.join(__dirname, 'doraemon/views'), 98 layoutsDir: path.join(__dirname, 'doraemon/views'),
96 partialsDir: path.join(__dirname, 'doraemon/views/partial'), 99 partialsDir: path.join(__dirname, 'doraemon/views/partial'),
97 views: path.join(__dirname, 'doraemon/views'), 100 views: path.join(__dirname, 'doraemon/views'),
98 - helpers: _.assign(global.yoho.helpers, require('./utils/helpers')) 101 + helpers: _.assign(global.yoho.helpers, require('./utils/helpers')),
  102 + cb: hbsEvent.cb
99 })); 103 }));
100 104
101 105
@@ -229,4 +233,15 @@ try { @@ -229,4 +233,15 @@ try {
229 // listener 233 // listener
230 app.listen(config.port, function() { 234 app.listen(config.port, function() {
231 logger.info('yohobuy start'); 235 logger.info('yohobuy start');
  236 + hbsEvent.event.on('hbs-complete', () => {
  237 + logger.info('hbs-all-complete');
  238 + if (!process.env.NODE_ENV || process.env.NODE_ENV === 'dev') {
  239 + let {devHost, port} = require('./config/devtools');
  240 +
  241 + require('request-promise')({
  242 + url: `http://${devHost}:${port}/event?action=reload`
  243 + }).then(() => {}, () =>{});
  244 + }
  245 + });
232 }); 246 });
  247 +
@@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
6 6
7 var express = require('express'), 7 var express = require('express'),
8 path = require('path'), 8 path = require('path'),
9 - helpers = require(path.join(global.utils, 'helpers')); 9 + helpers = require(path.join(global.utils, 'helpers')),
  10 + hbsEvent = require('../../config/hbsevent');
10 11
11 var app = express(); 12 var app = express();
12 13
@@ -17,13 +18,17 @@ app.on('mount', function(parent) { @@ -17,13 +18,17 @@ app.on('mount', function(parent) {
17 delete parent.locals.settings; // 不继承父 App 的设置 18 delete parent.locals.settings; // 不继承父 App 的设置
18 Object.assign(app.locals, parent.locals); 19 Object.assign(app.locals, parent.locals);
19 }); 20 });
  21 +
  22 +app.disable('x-powered-by');
  23 +
20 app.use(global.yoho.hbs({ 24 app.use(global.yoho.hbs({
21 extname: '.hbs', 25 extname: '.hbs',
22 defaultLayout: 'layout', 26 defaultLayout: 'layout',
23 layoutsDir: doraemon, 27 layoutsDir: doraemon,
24 partialsDir: path.join(__dirname, 'views/partial'), 28 partialsDir: path.join(__dirname, 'views/partial'),
25 views: path.join(__dirname, 'views/action'), 29 views: path.join(__dirname, 'views/action'),
26 - helpers: Object.assign({}, global.yoho.helpers, helpers) 30 + helpers: Object.assign({}, global.yoho.helpers, helpers),
  31 + cb: hbsEvent.cb
27 })); 32 }));
28 33
29 // router 34 // router
@@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
6 6
7 var express = require('express'), 7 var express = require('express'),
8 path = require('path'), 8 path = require('path'),
9 - helpers = require(path.join(global.utils, 'helpers')); 9 + helpers = require(path.join(global.utils, 'helpers')),
  10 + hbsEvent = require('../../config/hbsevent');
10 11
11 var app = express(); 12 var app = express();
12 13
@@ -17,13 +18,17 @@ app.on('mount', function(parent) { @@ -17,13 +18,17 @@ app.on('mount', function(parent) {
17 delete parent.locals.settings; // 不继承父 App 的设置 18 delete parent.locals.settings; // 不继承父 App 的设置
18 Object.assign(app.locals, parent.locals); 19 Object.assign(app.locals, parent.locals);
19 }); 20 });
  21 +
  22 +app.disable('x-powered-by');
  23 +
20 app.use(global.yoho.hbs({ 24 app.use(global.yoho.hbs({
21 extname: '.hbs', 25 extname: '.hbs',
22 defaultLayout: 'layout', 26 defaultLayout: 'layout',
23 layoutsDir: doraemon, 27 layoutsDir: doraemon,
24 partialsDir: path.join(__dirname, 'views/partial'), 28 partialsDir: path.join(__dirname, 'views/partial'),
25 views: path.join(__dirname, 'views/action'), 29 views: path.join(__dirname, 'views/action'),
26 - helpers: Object.assign({}, global.yoho.helpers, helpers) 30 + helpers: Object.assign({}, global.yoho.helpers, helpers),
  31 + cb: hbsEvent.cb
27 })); 32 }));
28 33
29 // router 34 // router
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 </div> 10 </div>
11 </div> 11 </div>
12 <div class="invite-code invitation"> 12 <div class="invite-code invitation">
13 - <div class="title">方法二:使用邀请码</div> 13 + <div class="title">方法二:使用潮流口令</div>
14 <div class="code-content"> 14 <div class="code-content">
15 <div class="invite-content"> 15 <div class="invite-content">
16 <span class="code trend-code">{{#if trendWord}}{{trendWord}}{{else}}{{inviteCode}}{{/if}}</span> 16 <span class="code trend-code">{{#if trendWord}}{{trendWord}}{{else}}{{inviteCode}}{{/if}}</span>
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <div class="title">方法三:使用邀请链接</div> 26 <div class="title">方法三:使用邀请链接</div>
27 <div class="code-content"> 27 <div class="code-content">
28 <div class="invite-content"> 28 <div class="invite-content">
29 - <span class="code">{{shareUrl}}</span> 29 + <span class="code{{#unless isApp}} code-len{{/unless}}">{{shareUrl}}</span>
30 {{#if isApp}} 30 {{#if isApp}}
31 <span class="share button">分享</span> 31 <span class="share button">分享</span>
32 <a class="copy button" href='//m.yohobuy.com/?openby:yohobuy={"action":"go.copy","params":{"text":"{{copyUrl}}","message":"复制成功"}}'>复制</a> 32 <a class="copy button" href='//m.yohobuy.com/?openby:yohobuy={"action":"go.copy","params":{"text":"{{copyUrl}}","message":"复制成功"}}'>复制</a>
@@ -15,6 +15,8 @@ app.on('mount', function(parent) { @@ -15,6 +15,8 @@ app.on('mount', function(parent) {
15 Object.assign(app.locals, parent.locals); 15 Object.assign(app.locals, parent.locals);
16 }); 16 });
17 17
  18 +app.disable('x-powered-by');
  19 +
18 // router 20 // router
19 app.use(require('./router')); 21 app.use(require('./router'));
20 22
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 */ 5 */
6 6
7 var express = require('express'), 7 var express = require('express'),
8 - path = require('path'); 8 + path = require('path'),
  9 + hbsEvent = require('../../config/hbsevent');
9 10
10 var app = express(); 11 var app = express();
11 12
@@ -17,13 +18,16 @@ app.on('mount', function(parent) { @@ -17,13 +18,16 @@ app.on('mount', function(parent) {
17 Object.assign(app.locals, parent.locals); 18 Object.assign(app.locals, parent.locals);
18 }); 19 });
19 20
  21 +app.disable('x-powered-by');
  22 +
20 app.use(global.yoho.hbs({ 23 app.use(global.yoho.hbs({
21 extname: '.hbs', 24 extname: '.hbs',
22 defaultLayout: 'layout', 25 defaultLayout: 'layout',
23 layoutsDir: doraemon, 26 layoutsDir: doraemon,
24 partialsDir: path.join(__dirname, 'views/partial'), 27 partialsDir: path.join(__dirname, 'views/partial'),
25 views: path.join(__dirname, 'views/action'), 28 views: path.join(__dirname, 'views/action'),
26 - helpers: global.yoho.helpers 29 + helpers: global.yoho.helpers,
  30 + cb: hbsEvent.cb
27 })); 31 }));
28 32
29 // router 33 // router
@@ -5,7 +5,9 @@ @@ -5,7 +5,9 @@
5 */ 5 */
6 6
7 var express = require('express'), 7 var express = require('express'),
8 - path = require('path'); 8 + path = require('path'),
  9 + hbsEvent = require('../../config/hbsevent');
  10 +
9 11
10 var app = express(); 12 var app = express();
11 13
@@ -18,13 +20,16 @@ app.on('mount', function(parent) { @@ -18,13 +20,16 @@ app.on('mount', function(parent) {
18 Object.assign(app.locals, parent.locals); 20 Object.assign(app.locals, parent.locals);
19 }); 21 });
20 22
  23 +app.disable('x-powered-by');
  24 +
21 app.use(global.yoho.hbs({ 25 app.use(global.yoho.hbs({
22 extname: '.hbs', 26 extname: '.hbs',
23 defaultLayout: 'layout', 27 defaultLayout: 'layout',
24 layoutsDir: doraemon, 28 layoutsDir: doraemon,
25 partialsDir: path.join(__dirname, 'views/partial'), 29 partialsDir: path.join(__dirname, 'views/partial'),
26 views: path.join(__dirname, 'views/action'), 30 views: path.join(__dirname, 'views/action'),
27 - helpers: global.yoho.helpers 31 + helpers: global.yoho.helpers,
  32 + cb: hbsEvent.cb
28 })); 33 }));
29 34
30 // router 35 // router
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 */ 5 */
6 6
7 var express = require('express'), 7 var express = require('express'),
8 - path = require('path'); 8 + path = require('path'),
  9 + hbsEvent = require('../../config/hbsevent');
9 10
10 var app = express(); 11 var app = express();
11 12
@@ -17,13 +18,16 @@ app.on('mount', function(parent) { @@ -17,13 +18,16 @@ app.on('mount', function(parent) {
17 Object.assign(app.locals, parent.locals); 18 Object.assign(app.locals, parent.locals);
18 }); 19 });
19 20
  21 +app.disable('x-powered-by');
  22 +
20 app.use(global.yoho.hbs({ 23 app.use(global.yoho.hbs({
21 extname: '.hbs', 24 extname: '.hbs',
22 defaultLayout: 'layout', 25 defaultLayout: 'layout',
23 layoutsDir: doraemon, 26 layoutsDir: doraemon,
24 partialsDir: path.join(__dirname, './views/partial'), 27 partialsDir: path.join(__dirname, './views/partial'),
25 views: path.join(__dirname, 'views/action'), 28 views: path.join(__dirname, 'views/action'),
26 - helpers: global.yoho.helpers 29 + helpers: global.yoho.helpers,
  30 + cb: hbsEvent.cb
27 })); 31 }));
28 32
29 // router 33 // router
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 */ 5 */
6 6
7 var express = require('express'), 7 var express = require('express'),
8 - path = require('path'); 8 + path = require('path'),
  9 + hbsEvent = require('../../config/hbsevent');
9 10
10 var app = express(); 11 var app = express();
11 12
@@ -17,13 +18,16 @@ app.on('mount', function(parent) { @@ -17,13 +18,16 @@ app.on('mount', function(parent) {
17 Object.assign(app.locals, parent.locals); 18 Object.assign(app.locals, parent.locals);
18 }); 19 });
19 20
  21 +app.disable('x-powered-by');
  22 +
20 app.use(global.yoho.hbs({ 23 app.use(global.yoho.hbs({
21 extname: '.hbs', 24 extname: '.hbs',
22 defaultLayout: 'layout', 25 defaultLayout: 'layout',
23 layoutsDir: doraemon, 26 layoutsDir: doraemon,
24 partialsDir: path.join(__dirname, './views/partial'), 27 partialsDir: path.join(__dirname, './views/partial'),
25 views: path.join(__dirname, 'views/action'), 28 views: path.join(__dirname, 'views/action'),
26 - helpers: global.yoho.helpers 29 + helpers: global.yoho.helpers,
  30 + cb: hbsEvent.cb
27 })); 31 }));
28 32
29 // router 33 // router
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 */ 5 */
6 6
7 var express = require('express'), 7 var express = require('express'),
8 - path = require('path'); 8 + path = require('path'),
  9 + hbsEvent = require('../../config/hbsevent');
9 10
10 var app = express(); 11 var app = express();
11 12
@@ -17,13 +18,16 @@ app.on('mount', function(parent) { @@ -17,13 +18,16 @@ app.on('mount', function(parent) {
17 Object.assign(app.locals, parent.locals); 18 Object.assign(app.locals, parent.locals);
18 }); 19 });
19 20
  21 +app.disable('x-powered-by');
  22 +
20 app.use(global.yoho.hbs({ 23 app.use(global.yoho.hbs({
21 extname: '.hbs', 24 extname: '.hbs',
22 defaultLayout: 'mip', 25 defaultLayout: 'mip',
23 layoutsDir: doraemon, 26 layoutsDir: doraemon,
24 partialsDir: [path.join(__dirname, 'views/partial')], 27 partialsDir: [path.join(__dirname, 'views/partial')],
25 views: path.join(__dirname, 'views/action'), 28 views: path.join(__dirname, 'views/action'),
26 - helpers: global.yoho.helpers 29 + helpers: global.yoho.helpers,
  30 + cb: hbsEvent.cb
27 })); 31 }));
28 32
29 app.locals.layout = 'mip'; 33 app.locals.layout = 'mip';
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 var express = require('express'), 7 var express = require('express'),
8 - path = require('path'); 8 + path = require('path'),
  9 + hbsEvent = require('../../config/hbsevent');
9 10
10 var passport = require('passport'); 11 var passport = require('passport');
11 12
@@ -19,13 +20,16 @@ app.on('mount', function(parent) { @@ -19,13 +20,16 @@ app.on('mount', function(parent) {
19 Object.assign(app.locals, parent.locals); 20 Object.assign(app.locals, parent.locals);
20 }); 21 });
21 22
  23 +app.disable('x-powered-by');
  24 +
22 app.use(global.yoho.hbs({ 25 app.use(global.yoho.hbs({
23 extname: '.hbs', 26 extname: '.hbs',
24 defaultLayout: 'layout', 27 defaultLayout: 'layout',
25 layoutsDir: doraemon, 28 layoutsDir: doraemon,
26 partialsDir: path.join(__dirname, 'views/partial'), 29 partialsDir: path.join(__dirname, 'views/partial'),
27 views: path.join(__dirname, 'views/action'), 30 views: path.join(__dirname, 'views/action'),
28 - helpers: global.yoho.helpers 31 + helpers: global.yoho.helpers,
  32 + cb: hbsEvent.cb
29 })); 33 }));
30 34
31 require('./auth'); 35 require('./auth');
@@ -35,7 +35,7 @@ const shop = { @@ -35,7 +35,7 @@ const shop = {
35 return shop.brand(req, res, next); // 品牌列表,有品牌ID就直接展示为品牌 35 return shop.brand(req, res, next); // 品牌列表,有品牌ID就直接展示为品牌
36 } 36 }
37 37
38 - return co(function*() { 38 + return co(function* () {
39 if (shopId) { 39 if (shopId) {
40 let shopInfoApi = (yield shopModel.getShopInfo(shopId, uid)) || {}; 40 let shopInfoApi = (yield shopModel.getShopInfo(shopId, uid)) || {};
41 let shopInfo = _.get(shopInfoApi, 'data', {}); 41 let shopInfo = _.get(shopInfoApi, 'data', {});
@@ -97,7 +97,7 @@ const shop = { @@ -97,7 +97,7 @@ const shop = {
97 let uid = req.user.uid; 97 let uid = req.user.uid;
98 98
99 if (!brandId) { 99 if (!brandId) {
100 - return res.json({code: 404}); 100 + return res.json({ code: 404 });
101 } 101 }
102 return shopModel.getBrandIntro(brandId, uid).then(result => { 102 return shopModel.getBrandIntro(brandId, uid).then(result => {
103 res.json(result); 103 res.json(result);
@@ -112,7 +112,7 @@ const shop = { @@ -112,7 +112,7 @@ const shop = {
112 let isApp = req.query.app_version || req.query.appVersion || false; 112 let isApp = req.query.app_version || req.query.appVersion || false;
113 113
114 return searchModel.searchProductBySkn(skns).then(hotList => { 114 return searchModel.searchProductBySkn(skns).then(hotList => {
115 - hotList = productProcess.processProductList(hotList, {isApp: isApp}); 115 + hotList = productProcess.processProductList(hotList, { isApp: isApp });
116 _.forEach(hotList, (value, key) => { 116 _.forEach(hotList, (value, key) => {
117 hotList[key].tags = {}; 117 hotList[key].tags = {};
118 hotList[key].is_soon_sold_out = false; 118 hotList[key].is_soon_sold_out = false;
@@ -202,13 +202,13 @@ const shop = { @@ -202,13 +202,13 @@ const shop = {
202 let goodsListBySkn = yield searchModel.searchProductBySkn(decoratorsAll.skns); 202 let goodsListBySkn = yield searchModel.searchProductBySkn(decoratorsAll.skns);
203 let decorators = shopPrcs.pushGoodsInfo(decoratorsAll.decorators, goodsListBySkn); 203 let decorators = shopPrcs.pushGoodsInfo(decoratorsAll.decorators, goodsListBySkn);
204 204
205 - shopInfo.shop_intro_link = helpers.urlFormat('/product/index/intro', {shop_id: shopId}); 205 + shopInfo.shop_intro_link = helpers.urlFormat('/product/index/intro', { shop_id: shopId });
206 206
207 res.render('newshop/shop-reds', { 207 res.render('newshop/shop-reds', {
208 title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货', 208 title: shopInfo.shop_name + '|' + shopInfo.shop_name + '潮流服装服饰-Yoho!Buy有货',
209 keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' + shopInfo.shop_name + '潮流服装服饰', 209 keywords: shopInfo.shop_name + ',' + shopInfo.shop_name + '服装服饰,' + shopInfo.shop_name + '潮流服装服饰',
210 description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name + 210 description: shopInfo.shop_name + '|Yoho!Buy有货' + shopInfo.shop_name +
211 - '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。', 211 + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
212 pageHeader: _.assign({ 212 pageHeader: _.assign({
213 shopPage: { 213 shopPage: {
214 text: '分类', 214 text: '分类',
@@ -224,7 +224,7 @@ const shop = { @@ -224,7 +224,7 @@ const shop = {
224 title: '全部商品' 224 title: '全部商品'
225 }, 'list'), 225 }, 'list'),
226 appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","is_red_shop":"1","shop_id":"' + 226 appPath: 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","is_red_shop":"1","shop_id":"' +
227 - shopId + '","shop_name":"' + shopInfo.shop_name + '"}}', 227 + shopId + '","shop_name":"' + shopInfo.shop_name + '"}}',
228 shopHeadHide: true, 228 shopHeadHide: true,
229 shopPage: true, 229 shopPage: true,
230 width750: true, 230 width750: true,
@@ -270,6 +270,9 @@ const shop = { @@ -270,6 +270,9 @@ const shop = {
270 } 270 }
271 } 271 }
272 272
  273 + let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shop","params":{"shop_template_type":"1","shop_id":"' +
  274 + shopId + '","shop_name":"' + shopInfo.shop_name + '"}}';
  275 +
273 res.render('newshop/shop-list', { 276 res.render('newshop/shop-list', {
274 module: 'product', 277 module: 'product',
275 page: 'shop-list', 278 page: 'shop-list',
@@ -284,6 +287,7 @@ const shop = { @@ -284,6 +287,7 @@ const shop = {
284 shopId: shopId, 287 shopId: shopId,
285 shopInfo: shopInfo, 288 shopInfo: shopInfo,
286 goodsList: goodsList, 289 goodsList: goodsList,
  290 + appPath: appPath,
287 shopPage: true, 291 shopPage: true,
288 _noLazy: true, 292 _noLazy: true,
289 localCss: true, 293 localCss: true,
@@ -6,7 +6,8 @@ @@ -6,7 +6,8 @@
6 'use strict'; 6 'use strict';
7 7
8 var express = require('express'), 8 var express = require('express'),
9 - path = require('path'); 9 + path = require('path'),
  10 + hbsEvent = require('../../config/hbsevent');
10 11
11 var app = express(); 12 var app = express();
12 13
@@ -18,13 +19,16 @@ app.on('mount', function(parent) { @@ -18,13 +19,16 @@ app.on('mount', function(parent) {
18 Object.assign(app.locals, parent.locals); 19 Object.assign(app.locals, parent.locals);
19 }); 20 });
20 21
  22 +app.disable('x-powered-by');
  23 +
21 app.use(global.yoho.hbs({ 24 app.use(global.yoho.hbs({
22 extname: '.hbs', 25 extname: '.hbs',
23 defaultLayout: 'layout', 26 defaultLayout: 'layout',
24 layoutsDir: doraemon, 27 layoutsDir: doraemon,
25 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], 28 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
26 views: path.join(__dirname, 'views/action'), 29 views: path.join(__dirname, 'views/action'),
27 - helpers: global.yoho.helpers 30 + helpers: global.yoho.helpers,
  31 + cb: hbsEvent.cb
28 })); 32 }));
29 33
30 // router 34 // router
1 <div class="good-list-page yoho-page"> 1 <div class="good-list-page yoho-page">
2 <!-- 基础店铺页面 --> 2 <!-- 基础店铺页面 -->
3 {{# shopInfo}} 3 {{# shopInfo}}
4 - <div id="brand-header" class="brand-header" data-id={{shops_id}} data-isbaseshop="{{isBaseShop}}">  
5 - <img src={{image2 banner q=60}}>  
6 - <a class="btn-intro" id="shopIntroBtn" href="javascript:void(0);"> 4 + <div id="brand-header" class="brand-header" data-id={{shops_id}} data-isbaseshop="{{isBaseShop}}">
  5 + <img src="{{image2 banner w=750 h=176 q=60}}">
  6 + <a class="btn-intro" id="shopIntroBtn" href="javascript:void(0);">
7 店铺介绍 7 店铺介绍
8 </a> 8 </a>
9 - <a id="collectShop" class="btn-col" href="javascript:void(0);"> 9 + <a id="collectShop" class="btn-col" href="javascript:void(0);">
10 <span class="iconfont">&#xe622;</span> 10 <span class="iconfont">&#xe622;</span>
11 <span class="txt"></span> 11 <span class="txt"></span>
12 </a> 12 </a>
13 - </div>  
14 - <div id="introBox" class="brand-intro-box hide">  
15 - <div id="shopIntro" class="brand-intro">  
16 - <h2>店铺介绍</h2>  
17 - <div class="con">  
18 - {{{shop_intro}}}  
19 - </div>  
20 - <p class="fo">  
21 - <span class="iconfont">&#xe629;</span>  
22 - 100%品牌授权正品  
23 - </p>  
24 - <span id="closeIntroBtn" class="iconfont close-intro">&#xe623;</span> 13 + </div>
  14 + <div id="introBox" class="brand-intro-box hide">
  15 + <div id="shopIntro" class="brand-intro">
  16 + <h2>店铺介绍</h2>
  17 + <div class="con">
  18 + {{{shop_intro}}}
25 </div> 19 </div>
  20 + <p class="fo">
  21 + <span class="iconfont">&#xe629;</span> 100%品牌授权正品
  22 + </p>
  23 + <span id="closeIntroBtn" class="iconfont close-intro">&#xe623;</span>
26 </div> 24 </div>
  25 + </div>
27 {{/ shopInfo}} 26 {{/ shopInfo}}
28 27
29 <!-- 优惠卷 --> 28 <!-- 优惠卷 -->
@@ -34,15 +33,12 @@ @@ -34,15 +33,12 @@
34 <!-- /基础店铺页面 --> 33 <!-- /基础店铺页面 -->
35 {{!--筛选tab--}} 34 {{!--筛选tab--}}
36 <div class="filter-box"> 35 <div class="filter-box">
37 - {{> product/filter-tab-new}}  
38 - {{> common/filter}} 36 + {{> product/filter-tab-new}} {{> common/filter}}
39 </div> 37 </div>
40 38
41 <div id="goods-container" class="goods-container"> 39 <div id="goods-container" class="goods-container">
42 <div class="default-goods container clearfix"> 40 <div class="default-goods container clearfix">
43 - {{#goodsList}}  
44 - {{> common/goods}}  
45 - {{/goodsList}} 41 + {{#goodsList}} {{> common/goods}} {{/goodsList}}
46 </div> 42 </div>
47 </div> 43 </div>
48 44
@@ -5,7 +5,8 @@ @@ -5,7 +5,8 @@
5 */ 5 */
6 6
7 var express = require('express'), 7 var express = require('express'),
8 - path = require('path'); 8 + path = require('path'),
  9 + hbsEvent = require('../../config/hbsevent');
9 10
10 var app = express(); 11 var app = express();
11 12
@@ -17,13 +18,16 @@ app.on('mount', function(parent) { @@ -17,13 +18,16 @@ app.on('mount', function(parent) {
17 Object.assign(app.locals, parent.locals); 18 Object.assign(app.locals, parent.locals);
18 }); 19 });
19 20
  21 +app.disable('x-powered-by');
  22 +
20 app.use(global.yoho.hbs({ 23 app.use(global.yoho.hbs({
21 extname: '.hbs', 24 extname: '.hbs',
22 defaultLayout: 'layout', 25 defaultLayout: 'layout',
23 layoutsDir: doraemon, 26 layoutsDir: doraemon,
24 partialsDir: [path.join(__dirname, 'views/partial')], 27 partialsDir: [path.join(__dirname, 'views/partial')],
25 views: path.join(__dirname, 'views/action'), 28 views: path.join(__dirname, 'views/action'),
26 - helpers: global.yoho.helpers 29 + helpers: global.yoho.helpers,
  30 + cb: hbsEvent.cb
27 })); 31 }));
28 32
29 33
@@ -11,8 +11,8 @@ const isProduction = process.env.NODE_ENV === 'production'; @@ -11,8 +11,8 @@ const isProduction = process.env.NODE_ENV === 'production';
11 const isTest = process.env.NODE_ENV === 'test'; 11 const isTest = process.env.NODE_ENV === 'test';
12 12
13 const domains = { 13 const domains = {
14 - api: 'http://api-test3.yohops.com:9999/',  
15 - service: 'http://service-test3.yohops.com:9999/', 14 + api: 'http://api.yoho.cn/',
  15 + service: 'http://service.yoho.cn/',
16 singleApi: 'http://api-test3.yohops.com:9999/', 16 singleApi: 'http://api-test3.yohops.com:9999/',
17 global: 'http://global-test-soa.yohops.com:9999', 17 global: 'http://global-test-soa.yohops.com:9999',
18 liveApi: 'http://testapi.live.yohops.com:9999/', 18 liveApi: 'http://testapi.live.yohops.com:9999/',
  1 +const fs = require('fs');
  2 +let devHost = '127.0.0.1';
  3 +
  4 +try {
  5 + let buf = fs.readFileSync('.devhost');
  6 +
  7 + devHost = JSON.parse(buf.toString()).host;
  8 +} catch (e) {} //eslint-disable-line
  9 +
  10 +
  11 +module.exports = {
  12 + devHost,
  13 + port: 5001
  14 +};
  1 +/**
  2 + * hbs预编译回调事件
  3 + * @author: chenfeng<feng.chen@yoho.cn>
  4 + * @date: 2017/08/14
  5 + */
  6 +const EventEmitter = require('events');
  7 +const event = new EventEmitter();
  8 +
  9 +let hbsEvent = {
  10 + cbTick: 0,
  11 + cbComTick: 0,
  12 + event
  13 +};
  14 +
  15 +Object.defineProperty(hbsEvent, 'cb', {
  16 + get() {
  17 + hbsEvent.cbTick++;
  18 + return this._cb;
  19 + },
  20 + set(val) {
  21 + this._cb = val;
  22 + }
  23 +});
  24 +
  25 +hbsEvent.cb = () => {
  26 + hbsEvent.cbComTick++;
  27 + if (hbsEvent.cbTick <= hbsEvent.cbComTick) {
  28 + event.emit('hbs-complete');
  29 + }
  30 +};
  31 +module.exports = hbsEvent;
1 -'use strict';  
2 -  
3 -const fs = require('fs');  
4 -let devHost = '127.0.0.1';  
5 -  
6 -fs.readFile('.devhost', (err, buf)=> {  
7 - if (!err) {  
8 - devHost = JSON.parse(buf.toString()).host;  
9 - }  
10 -}); 1 +const devHost = require('../../config/devtools');
11 2
12 module.exports = () => { 3 module.exports = () => {
13 return (req, res, next) => { 4 return (req, res, next) => {
14 - Object.assign(res.locals, {  
15 - devHost: devHost  
16 - }); 5 + Object.assign(res.locals, devHost);
17 6
18 next(); 7 next();
19 }; 8 };
@@ -36,48 +36,48 @@ module.exports = () => { @@ -36,48 +36,48 @@ module.exports = () => {
36 sessionKey 36 sessionKey
37 }; 37 };
38 } 38 }
39 - }  
40 - if (!req.user.uid &&  
41 - req.cookies.app_uid &&  
42 - req.cookies.app_uid !== '0' &&  
43 - req.cookies.app_session_key &&  
44 - req.cookies.app_version &&  
45 - req.cookies.app_client_type) {  
46 - // 调用接口传参时切勿使用toString获得字符串  
47 - req.user.uid = {  
48 - toString: () => {  
49 - return _.parseInt(req.cookies.app_uid);  
50 - },  
51 - sessionKey: req.cookies.app_session_key,  
52 - appVersion: req.query.app_version || req.cookies.app_version || config.appVersion,  
53 - appSessionType: req.cookies.app_client_type  
54 - };  
55 - }  
56 -  
57 - if (!req.user.uid &&  
58 - (req.query.uid || ( 39 + } else {
  40 + if (!req.user.uid &&
59 req.cookies.app_uid && 41 req.cookies.app_uid &&
60 req.cookies.app_uid !== '0' && 42 req.cookies.app_uid !== '0' &&
  43 + req.cookies.app_session_key &&
61 req.cookies.app_version && 44 req.cookies.app_version &&
62 - req.cookies.app_client_type  
63 - ))  
64 - ) {  
65 - let appUid = req.query.uid || req.cookies.app_uid;  
66 - let appVersion = req.query.app_version || req.cookies.app_version || config.appVersion;  
67 - let appSessionType = req.query.client_type || req.cookies.app_client_type; 45 + req.cookies.app_client_type) {
  46 + // 调用接口传参时切勿使用toString获得字符串
  47 + req.user.uid = {
  48 + toString: () => {
  49 + return _.parseInt(req.cookies.app_uid);
  50 + },
  51 + sessionKey: req.cookies.app_session_key,
  52 + appVersion: req.query.app_version || req.cookies.app_version || config.appVersion,
  53 + appSessionType: req.cookies.app_client_type
  54 + };
  55 + }
68 56
69 - req.query.uid = {  
70 - toString: () => {  
71 - return _.parseInt(appUid);  
72 - },  
73 - appVersion: appVersion,  
74 - appSessionType: appSessionType  
75 - };  
76 - res.cookie('app_uid', appUid.toString());  
77 - res.cookie('app_version', appVersion);  
78 - res.cookie('app_client_type', appSessionType);  
79 - } 57 + if (!req.user.uid &&
  58 + (req.query.uid || (
  59 + req.cookies.app_uid &&
  60 + req.cookies.app_uid !== '0' &&
  61 + req.cookies.app_version &&
  62 + req.cookies.app_client_type
  63 + ))
  64 + ) {
  65 + let appUid = req.query.uid || req.cookies.app_uid;
  66 + let appVersion = req.query.app_version || req.cookies.app_version || config.appVersion;
  67 + let appSessionType = req.query.client_type || req.cookies.app_client_type;
80 68
  69 + req.query.uid = {
  70 + toString: () => {
  71 + return _.parseInt(appUid);
  72 + },
  73 + appVersion: appVersion,
  74 + appSessionType: appSessionType
  75 + };
  76 + res.cookie('app_uid', appUid.toString());
  77 + res.cookie('app_version', appVersion);
  78 + res.cookie('app_client_type', appSessionType);
  79 + }
  80 + }
81 81
82 next(); 82 next();
83 }; 83 };
@@ -40,7 +40,21 @@ @@ -40,7 +40,21 @@
40 </script> 40 </script>
41 {{/if}} 41 {{/if}}
42 42
43 - {{#unless devEnv}} 43 + {{#if devEnv}}
  44 + {{#if localCss }}
  45 + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/common.css?t={{startTime}}">
  46 + {{/if}}
  47 +
  48 + {{#if isFeature}}
  49 + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/feature.css?t={{startTime}}">
  50 + {{else}}
  51 + {{#ifor localCss vue}}
  52 + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/{{module}}.{{page}}.css?t={{startTime}}">
  53 + {{^}}
  54 + <link rel="stylesheet" media="all" href="//{{devHost}}:5001/index.css?t={{startTime}}">
  55 + {{/ifor}}
  56 + {{/if}}
  57 + {{else}}
44 {{#if localCss }} 58 {{#if localCss }}
45 <link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/common.css?t={{startTime}}"> 59 <link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/common.css?t={{startTime}}">
46 {{/if}} 60 {{/if}}
@@ -54,7 +68,7 @@ @@ -54,7 +68,7 @@
54 <link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/index.css?t={{startTime}}"> 68 <link rel="stylesheet" media="all" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/index.css?t={{startTime}}">
55 {{/ifor}} 69 {{/ifor}}
56 {{/if}} 70 {{/if}}
57 - {{/unless}} 71 + {{/if}}
58 <link rel="apple-touch-icon-precomposed" href="http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png"> 72 <link rel="apple-touch-icon-precomposed" href="http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png">
59 <link rel="apple-touch-startup-image" sizes="640x920" href="http://static.yohobuy.com/m/v1/img/startup/startup-retina.png" media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)"> 73 <link rel="apple-touch-startup-image" sizes="640x920" href="http://static.yohobuy.com/m/v1/img/startup/startup-retina.png" media="screen and (max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)">
60 <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)"> 74 <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)">
@@ -103,14 +117,6 @@ @@ -103,14 +117,6 @@
103 <script>var STATIC_RESOURCE_PATH = '//{{devHost}}:5001';</script> 117 <script>var STATIC_RESOURCE_PATH = '//{{devHost}}:5001';</script>
104 118
105 <script src="//{{devHost}}:5001/libs.js"></script> 119 <script src="//{{devHost}}:5001/libs.js"></script>
106 - {{!--开发环境的CSS需要hot reload, 所以使用 JS 方式加载--}}  
107 - {{#if localCss}}  
108 - <script src="//{{devHost}}:5001/common.js"></script>  
109 - {{else}}  
110 - <script src="//{{devHost}}:5001/index.js"></script>  
111 - {{/if}} {{#if isFeature}}  
112 - <script src="//{{devHost}}:5001/feature.js"></script>  
113 - {{/if}}  
114 <script src="//{{devHost}}:5001/{{module}}.{{page}}.js"></script> 120 <script src="//{{devHost}}:5001/{{module}}.{{page}}.js"></script>
115 {{^}} 121 {{^}}
116 <script>var STATIC_RESOURCE_PATH = '//cdn.yoho.cn/m-yohobuy-node/assets';</script> 122 <script>var STATIC_RESOURCE_PATH = '//cdn.yoho.cn/m-yohobuy-node/assets';</script>
@@ -10,7 +10,8 @@ @@ -10,7 +10,8 @@
10 "scripts": { 10 "scripts": {
11 "start": "NODE_ENV=\"production\" node app.js", 11 "start": "NODE_ENV=\"production\" node app.js",
12 "dev": "nodemon -e js,hbs -i public/ app.js", 12 "dev": "nodemon -e js,hbs -i public/ app.js",
13 - "static": "webpack-dev-server --config ./public/build/webpack.dev.config.js", 13 + "static": "node ./public/build/dev-server.js",
  14 + "build:dll": "webpack --config ./public/build/webpack.dll.indexcss.config.js",
14 "build": "webpack --config ./public/build/webpack.prod.config.js", 15 "build": "webpack --config ./public/build/webpack.prod.config.js",
15 "debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js", 16 "debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
16 "lint-js": "lint-js", 17 "lint-js": "lint-js",
@@ -72,7 +73,7 @@ @@ -72,7 +73,7 @@
72 "xml2js": "^0.4.17", 73 "xml2js": "^0.4.17",
73 "yoho-express-session": "^2.0.0", 74 "yoho-express-session": "^2.0.0",
74 "yoho-md5": "^2.0.0", 75 "yoho-md5": "^2.0.0",
75 - "yoho-node-lib": "=0.2.28", 76 + "yoho-node-lib": "=0.2.29",
76 "yoho-zookeeper": "^1.0.8" 77 "yoho-zookeeper": "^1.0.8"
77 }, 78 },
78 "devDependencies": { 79 "devDependencies": {
@@ -87,10 +88,13 @@ @@ -87,10 +88,13 @@
87 "eslint-loader": "^1.9.0", 88 "eslint-loader": "^1.9.0",
88 "eslint-plugin-html": "^3.1.1", 89 "eslint-plugin-html": "^3.1.1",
89 "extract-text-webpack-plugin": "^3.0.0", 90 "extract-text-webpack-plugin": "^3.0.0",
  91 + "friendly-errors-webpack-plugin": "^1.6.1",
90 "handlebars-loader": "^1.5.0", 92 "handlebars-loader": "^1.5.0",
91 "happypack": "^3.1.0", 93 "happypack": "^3.1.0",
92 "husky": "^0.14.3", 94 "husky": "^0.14.3",
  95 + "ignore-file-loader": "^1.0.0",
93 "nodemon": "^1.11.0", 96 "nodemon": "^1.11.0",
  97 + "opn": "^5.1.0",
94 "postcss-assets": "^4.2.0", 98 "postcss-assets": "^4.2.0",
95 "postcss-calc": "^6.0.0", 99 "postcss-calc": "^6.0.0",
96 "postcss-center": "^1.0.0", 100 "postcss-center": "^1.0.0",
@@ -118,7 +122,11 @@ @@ -118,7 +122,11 @@
118 "vue-loader": "^13.0.4", 122 "vue-loader": "^13.0.4",
119 "vue-template-compiler": "^2.4.2", 123 "vue-template-compiler": "^2.4.2",
120 "webpack": "^3.5.2", 124 "webpack": "^3.5.2",
  125 + "webpack-bundle-analyzer": "^2.9.0",
  126 + "webpack-dev-middleware": "^1.12.0",
121 "webpack-dev-server": "^2.7.1", 127 "webpack-dev-server": "^2.7.1",
  128 + "webpack-hot-middleware": "^2.18.2",
  129 + "webpack-merge": "^4.1.0",
122 "webpack-uglify-parallel": "^0.1.3", 130 "webpack-uglify-parallel": "^0.1.3",
123 "yoho-cookie": "^1.2.0", 131 "yoho-cookie": "^1.2.0",
124 "yoho-fastclick": "^1.0.6", 132 "yoho-fastclick": "^1.0.6",
@@ -130,6 +138,7 @@ @@ -130,6 +138,7 @@
130 "yoho-lint": "^1.0.1", 138 "yoho-lint": "^1.0.1",
131 "yoho-mlellipsis": "0.0.3", 139 "yoho-mlellipsis": "0.0.3",
132 "yoho-qs": "^1.0.1", 140 "yoho-qs": "^1.0.1",
  141 + "store": "^2.0.12",
133 "yoho-swiper": "^3.3.1", 142 "yoho-swiper": "^3.3.1",
134 "yoho-swiper2": "0.0.5" 143 "yoho-swiper2": "0.0.5"
135 } 144 }
  1 +const hotClient = require('webpack-hot-middleware/client?dynamicPublicPath=true&path=__webpack_hmr&noInfo=true&reload=true'); // eslint-disable-line
  2 +
  3 +hotClient.subscribeAll(event => {
  4 + if (event.action === 'built') {
  5 + document.querySelectorAll('link[href][rel=stylesheet]').forEach((link) => {
  6 + fetch(link.href).then((res) => {
  7 + res.text().then(text => {
  8 + let head = document.getElementsByTagName('head')[0];
  9 + let style;
  10 +
  11 + style = document.getElementById(link.href);
  12 + if (!style) {
  13 + style = document.createElement('style');
  14 + style.type = 'text/css';
  15 + style.id = link.href;
  16 + style.appendChild(document.createTextNode(text));
  17 + } else {
  18 + style.textContent = text;
  19 + }
  20 +
  21 + head.appendChild(style);
  22 + });
  23 + });
  24 + });
  25 + }
  26 +});
  1 +const express = require('express');
  2 +const webpack = require('webpack');
  3 +const compression = require('compression');
  4 +const webpackDevMiddleware = require('webpack-dev-middleware');
  5 +const webpackHotMiddleware = require('webpack-hot-middleware');
  6 +const webpackConfig = require('./webpack.dev.config.js');
  7 +const path = require('path');
  8 +
  9 +const compiler = webpack(webpackConfig);
  10 +
  11 +const devMiddleware = webpackDevMiddleware(compiler, {
  12 + publicPath: webpackConfig.output.publicPath,
  13 + quiet: true,
  14 + headers: {
  15 + 'Access-Control-Allow-Origin': '*'
  16 + }
  17 +});
  18 +const hotMiddleware = webpackHotMiddleware(compiler, {
  19 + log: () => {}
  20 +});
  21 +
  22 +const app = express();
  23 +
  24 +app.use(devMiddleware);
  25 +app.use(hotMiddleware);
  26 +
  27 +app.use((req, res, next) => {
  28 + res.set('Access-Control-Allow-Origin', '*');
  29 + next();
  30 +});
  31 +
  32 +app.use('/',
  33 + express.static(path.join(__dirname, '../')),
  34 + express.static(path.join(__dirname, './bundle/')),
  35 + express.static(path.join(__dirname, './dll/')));
  36 +
  37 +app.use('/event', (req, res) => {
  38 + if (req.query.action === 'reload') {
  39 + hotMiddleware.publish({
  40 + action: 'reload'
  41 + });
  42 + }
  43 + res.json({
  44 + action: req.query.action,
  45 + message: 'ok'
  46 + });
  47 +});
  48 +
  49 +app.use(compression());
  50 +app.listen(5001, () => {
  51 + console.log('dev start 5001');
  52 +});
  1 +const path = require('path');
  2 +const ExtractTextPlugin = require('extract-text-webpack-plugin');
  3 +const postcssConfig = require('./postcss.config.js');
  4 +
  5 +const cssLoader = (env, type) => {
  6 + let loaders = [{
  7 + loader: 'css-loader',
  8 + options: {
  9 + url: false,
  10 + sourceMap: env === 'dev'
  11 + }
  12 + }];
  13 +
  14 + if (type === 'css') {
  15 + loaders.push({
  16 + loader: 'postcss-loader',
  17 + options: {
  18 + plugins: postcssConfig.postcssPlugin(env),
  19 + parser: 'postcss-scss'
  20 + }
  21 + });
  22 + }
  23 +
  24 + // if (env === 'dev') {
  25 + // loaders.unshift({
  26 + // loader: 'style-loader'
  27 + // });
  28 + // return loaders;
  29 + // }
  30 +
  31 + return ExtractTextPlugin.extract({
  32 + fallback: type === 'css' ? 'style-loader' : 'vue-style-loader',
  33 + use: loaders
  34 + });
  35 +};
  36 +
  37 +const hbsLoader = {
  38 + loader: 'handlebars-loader',
  39 + options: {
  40 + helperDirs: [
  41 + path.join(__dirname, '../js/common/helpers')
  42 + ],
  43 + partialDirs: [
  44 + path.join(__dirname, '../../doraemon/views/partial')
  45 + ]
  46 + }
  47 +};
  48 +
  49 +module.exports = {
  50 + cssLoader,
  51 + hbsLoader
  52 +};
@@ -12,61 +12,17 @@ const shelljs = require('shelljs'); @@ -12,61 +12,17 @@ const shelljs = require('shelljs');
12 const _ = require('lodash'); 12 const _ = require('lodash');
13 const webpack = require('webpack'); 13 const webpack = require('webpack');
14 const HappyPack = require('happypack'); 14 const HappyPack = require('happypack');
15 -const ExtractTextPlugin = require('extract-text-webpack-plugin'); 15 +const { cssLoader, hbsLoader } = require('./utils.js');
16 const postcssConfig = require('./postcss.config.js'); 16 const postcssConfig = require('./postcss.config.js');
17 17
18 const happyThreadPool = HappyPack.ThreadPool({ // eslint-disable-line 18 const happyThreadPool = HappyPack.ThreadPool({ // eslint-disable-line
19 size: os.cpus().length 19 size: os.cpus().length
20 }); 20 });
21 21
22 -const hbsLoader = {  
23 - loader: 'handlebars-loader',  
24 - options: {  
25 - helperDirs: [  
26 - path.join(__dirname, '../js/common/helpers')  
27 - ],  
28 - partialDirs: [  
29 - path.join(__dirname, '../../doraemon/views/partial')  
30 - ]  
31 - }  
32 -};  
33 -  
34 -const cssLoader = (env, type) => {  
35 - let loaders = [{  
36 - loader: 'css-loader',  
37 - options: {  
38 - url: false,  
39 - sourceMap: env === 'dev'  
40 - }  
41 - }];  
42 -  
43 - if (type === 'css') {  
44 - loaders.push({  
45 - loader: 'postcss-loader',  
46 - options: {  
47 - plugins: postcssConfig.postcssPlugin(env),  
48 - parser: 'postcss-scss'  
49 - }  
50 - });  
51 - }  
52 -  
53 - if (env === 'dev') {  
54 - loaders.unshift({  
55 - loader: 'style-loader'  
56 - });  
57 - return loaders;  
58 - }  
59 -  
60 - return ExtractTextPlugin.extract({  
61 - fallback: type === 'css' ? 'style-loader' : 'vue-style-loader',  
62 - use: loaders  
63 - });  
64 -};  
65 22
66 const getEntries = () => { 23 const getEntries = () => {
67 const entries = { 24 const entries = {
68 libs: ['babel-polyfill', 'yoho-jquery', path.join(__dirname, '../js/global.js')], 25 libs: ['babel-polyfill', 'yoho-jquery', path.join(__dirname, '../js/global.js')],
69 - index: path.join(__dirname, '../scss/index.css'),  
70 common: path.join(__dirname, '../scss/common.css'), 26 common: path.join(__dirname, '../scss/common.css'),
71 feature: path.join(__dirname, '../scss/feature.css') 27 feature: path.join(__dirname, '../scss/feature.css')
72 }; 28 };
1 -'use strict';  
2 -  
3 -const path = require('path');  
4 -const _ = require('lodash');  
5 const webpack = require('webpack'); 1 const webpack = require('webpack');
6 -const StyleLintPlugin = require('stylelint-webpack-plugin'); 2 +const path = require('path');
  3 +const merge = require('webpack-merge');
  4 +const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
  5 +const ExtractTextPlugin = require('extract-text-webpack-plugin');
7 const devInfo = require('./dev-info.js'); 6 const devInfo = require('./dev-info.js');
8 let baseConfig = require('./webpack.base.config.js'); 7 let baseConfig = require('./webpack.base.config.js');
9 8
10 baseConfig = baseConfig('dev'); 9 baseConfig = baseConfig('dev');
11 10
12 -_.mergeWith(baseConfig, {  
13 - devtool: '#inline-source-map', 11 +Object.keys(baseConfig.entry).forEach(function(name) {
  12 + baseConfig.entry[name] = [path.join(__dirname, './dev-client.js')].concat(baseConfig.entry[name]);
  13 +});
  14 +
  15 +module.exports = merge(baseConfig, {
  16 + devtool: '#cheap-module-source-map',
14 output: { 17 output: {
15 publicPath: devInfo.publicPath 18 publicPath: devInfo.publicPath
16 }, 19 },
17 - module: {  
18 - rules: [{  
19 - enforce: 'pre',  
20 - test: /(\.js|\.vue)$/,  
21 - exclude: /node_modules/,  
22 - loader: 'eslint-loader',  
23 - options: {  
24 - cache: true,  
25 - configFile: './.eslintrc',  
26 - formatter: require('eslint/lib/formatters/codeframe')  
27 - }  
28 - }]  
29 - },  
30 - devServer: {  
31 - host: devInfo.host,  
32 - port: devInfo.port,  
33 - publicPath: devInfo.publicPath,  
34 - contentBase: [path.join(__dirname, './bundle/'), path.join(__dirname, '../')],  
35 - hot: true,  
36 - inline: true,  
37 - compress: true,  
38 - stats: {  
39 - colors: true,  
40 - children: false,  
41 - chunks: false,  
42 - assetsSort: 'size',  
43 - },  
44 - headers: {  
45 - 'Access-Control-Allow-Origin': '*'  
46 - }  
47 - },  
48 plugins: [ 20 plugins: [
49 - new StyleLintPlugin({  
50 - files: ['public/scss/**/*.css', 'public/vue/**/*.vue'],  
51 - syntax: 'scss'  
52 - }),  
53 - new webpack.HotModuleReplacementPlugin() 21 + new ExtractTextPlugin('[name].css'),
  22 + new webpack.HotModuleReplacementPlugin(),
  23 + new FriendlyErrorsPlugin(),
54 ] 24 ]
55 -}, function customizer(objValue, srcValue) {  
56 - if (_.isArray(objValue)) {  
57 - return objValue.concat(srcValue);  
58 - }  
59 }); 25 });
60 -  
61 -delete baseConfig.extends;  
62 -  
63 -module.exports = baseConfig;  
  1 +const webpack = require('webpack');
  2 +const path = require('path');
  3 +const {cssLoader} = require('./utils.js');
  4 +const ExtractTextPlugin = require('extract-text-webpack-plugin');
  5 +
  6 +let webpackConfig = {
  7 + entry: {
  8 + index: [path.join(__dirname, '../scss/index.css')]
  9 + },
  10 + output: {
  11 + path: path.join(__dirname, './dll'), // absolute path
  12 + filename: '[name].js'
  13 + },
  14 + module: {
  15 + rules: [{
  16 + test: /\.css$/,
  17 + use: cssLoader('pro', 'css')
  18 + }]
  19 + },
  20 + plugins: [
  21 + new ExtractTextPlugin('[name].css'),
  22 + new webpack.DefinePlugin({
  23 + 'process.env': {
  24 + NODE_ENV: '"production"'
  25 + }
  26 + })
  27 + ]
  28 +};
  29 +
  30 +module.exports = webpackConfig;
@@ -3,8 +3,8 @@ @@ -3,8 +3,8 @@
3 const os = require('os'); 3 const os = require('os');
4 const path = require('path'); 4 const path = require('path');
5 const shelljs = require('shelljs'); 5 const shelljs = require('shelljs');
6 -const _ = require('lodash');  
7 const webpack = require('webpack'); 6 const webpack = require('webpack');
  7 +const merge = require('webpack-merge');
8 const UglifyJsParallelPlugin = require('webpack-uglify-parallel'); 8 const UglifyJsParallelPlugin = require('webpack-uglify-parallel');
9 const ExtractTextPlugin = require('extract-text-webpack-plugin'); 9 const ExtractTextPlugin = require('extract-text-webpack-plugin');
10 const config = require('../../package.json'); 10 const config = require('../../package.json');
@@ -15,10 +15,11 @@ let baseConfig = require('./webpack.base.config.js'); @@ -15,10 +15,11 @@ let baseConfig = require('./webpack.base.config.js');
15 shelljs.mkdir('-p', distDir); 15 shelljs.mkdir('-p', distDir);
16 shelljs.cp('-R', path.join(__dirname, '../img/'), distDir); 16 shelljs.cp('-R', path.join(__dirname, '../img/'), distDir);
17 shelljs.cp('-R', path.join(__dirname, '../font/'), distDir); 17 shelljs.cp('-R', path.join(__dirname, '../font/'), distDir);
  18 +shelljs.cp('-R', path.join(__dirname, './dll/*'), distDir);
18 19
19 baseConfig = baseConfig('pro'); 20 baseConfig = baseConfig('pro');
20 21
21 -_.mergeWith(baseConfig, { 22 +module.exports = merge(baseConfig, {
22 output: { 23 output: {
23 path: distDir 24 path: distDir
24 }, 25 },
@@ -37,10 +38,4 @@ _.mergeWith(baseConfig, { @@ -37,10 +38,4 @@ _.mergeWith(baseConfig, {
37 comments: false 38 comments: false
38 }) 39 })
39 ] 40 ]
40 -}, function customizer(objValue, srcValue) {  
41 - if (_.isArray(objValue)) {  
42 - return objValue.concat(srcValue);  
43 - }  
44 }); 41 });
45 -  
46 -module.exports = baseConfig;  
No preview for this file type
No preview for this file type
No preview for this file type
1 {{#inviteShare}} 1 {{#inviteShare}}
2 <div class="invite-share"> 2 <div class="invite-share">
3 - <span class="close-invite">×</span> 3 + <span class="close-invite iconfont">&#xe72d;</span>
4 <img class="head-ico" src="{{image headIco 75 75}}"> 4 <img class="head-ico" src="{{image headIco 75 75}}">
5 <span class="invite-name">"{{nickname}}"邀请你来有货玩潮流</span> 5 <span class="invite-name">"{{nickname}}"邀请你来有货玩潮流</span>
6 <p class="invite-trend">{{#if trendWord}}# {{trendWord}} #{{else}}{{inviteCode}}{{/if}}</p> 6 <p class="invite-trend">{{#if trendWord}}# {{trendWord}} #{{else}}{{inviteCode}}{{/if}}</p>
1 -require('index.css'); 1 +// require('index.css');
2 const Vue = require('vue'); 2 const Vue = require('vue');
3 const Logistics = require('home/refund/logistics.vue'); 3 const Logistics = require('home/refund/logistics.vue');
4 const LogisticsCompany = require('home/refund/logistics-company.vue'); 4 const LogisticsCompany = require('home/refund/logistics-company.vue');
  1 +const store = require('store');
  2 +const expirePlugin = require('store/plugins/expire');
  3 +
  4 +store.addPlugin(expirePlugin);
  5 +
  6 +module.exports = {
  7 + get: (...params) => {
  8 + store.enabled = false; // 暂时屏蔽
  9 + return store.enabled ? store.get(...params) : false;
  10 + },
  11 +
  12 + set: (...params) => {
  13 + store.enabled = false; // 暂时屏蔽
  14 + return store.enabled ? store.set(...params, new Date().getTime() + 180000) : false;
  15 + }
  16 +};
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 const filter = require('plugin/filter'); 11 const filter = require('plugin/filter');
12 const noResultHbs = require('product/search/no-result-new.hbs'); 12 const noResultHbs = require('product/search/no-result-new.hbs');
13 const lazyLoad = require('yoho-jquery-lazyload'); 13 const lazyLoad = require('yoho-jquery-lazyload');
  14 +const cacheStore = require('./cache-store');
14 15
15 class ProductListWithFilter { 16 class ProductListWithFilter {
16 constructor(filterParams, searchUrl, extra) { 17 constructor(filterParams, searchUrl, extra) {
@@ -101,6 +102,42 @@ class ProductListWithFilter { @@ -101,6 +102,42 @@ class ProductListWithFilter {
101 }); 102 });
102 } 103 }
103 104
  105 + dataRender(result) {
  106 +
  107 + // 去掉正在加载
  108 + $('.search-divide').remove();
  109 +
  110 + let noResult = !result || result.length < 1 || (result.list && result.list.length < 1);
  111 +
  112 + // 没有结果输出没有结果页面
  113 + if (noResult) {
  114 + if (this.isScrollLoad) {
  115 + this.view.container.after(() => {
  116 + return '<div class="search-divide">没有更多内容了...</div>';
  117 + });
  118 + } else {
  119 + this.view.container.html(noResultHbs());
  120 + }
  121 +
  122 + if (this.nav) {
  123 + this.nav.end = true;
  124 + }
  125 +
  126 + this.onSearching = false;
  127 + return false;
  128 + }
  129 +
  130 + if (this.isScrollLoad) {
  131 + this.view.container.append(result);
  132 + } else {
  133 + this.view.container.html(result);
  134 + }
  135 +
  136 + lazyLoad(this.view.container.find('img[class=lazy]').not('img[src]'));
  137 +
  138 + this.onSearching = false;
  139 + }
  140 +
104 /** 141 /**
105 * 获取商品列表 142 * 获取商品列表
106 */ 143 */
@@ -128,6 +165,8 @@ class ProductListWithFilter { @@ -128,6 +165,8 @@ class ProductListWithFilter {
128 } 165 }
129 166
130 if (!this.onSearching) { 167 if (!this.onSearching) {
  168 + let catchKey = this.searchUrl + '?' + $.param(this.defaultOpt);
  169 +
131 this.onSearching = true; 170 this.onSearching = true;
132 171
133 $.ajax({ 172 $.ajax({
@@ -138,46 +177,24 @@ class ProductListWithFilter { @@ -138,46 +177,24 @@ class ProductListWithFilter {
138 withCredentials: true 177 withCredentials: true
139 }, 178 },
140 beforeSend: () => { 179 beforeSend: () => {
  180 + let cacheData = cacheStore.get(catchKey);
  181 +
  182 + if (cacheData) {
  183 + this.dataRender(cacheData);
  184 + return false;
  185 + }
  186 +
141 if ($('.no-result-new').length > 0) { 187 if ($('.no-result-new').length > 0) {
142 $('.no-result-new').remove(); 188 $('.no-result-new').remove();
143 } 189 }
  190 +
144 this.view.container.after(() => { 191 this.view.container.after(() => {
145 return '<div class="search-divide">正在加载...</div>'; 192 return '<div class="search-divide">正在加载...</div>';
146 }); 193 });
147 }, 194 },
148 success: (result) => { 195 success: (result) => {
149 - // 去掉正在加载  
150 - $('.search-divide').remove();  
151 -  
152 - let noResult = !result || result.length < 1 || (result.list && result.list.length < 1);  
153 -  
154 - // 没有结果输出没有结果页面  
155 - if (noResult) {  
156 - if (this.isScrollLoad) {  
157 - this.view.container.after(() => {  
158 - return '<div class="search-divide">没有更多内容了...</div>';  
159 - });  
160 - } else {  
161 - this.view.container.html(noResultHbs());  
162 - }  
163 -  
164 - if (this.nav) {  
165 - this.nav.end = true;  
166 - }  
167 -  
168 - this.onSearching = false;  
169 - return false;  
170 - }  
171 -  
172 - if (this.isScrollLoad) {  
173 - this.view.container.append(result);  
174 - } else {  
175 - this.view.container.html(result);  
176 - }  
177 -  
178 - lazyLoad(this.view.container.find('img[class=lazy]').not('img[src]'));  
179 -  
180 - this.onSearching = false; 196 + cacheStore.set(catchKey, result);
  197 + this.dataRender(result);
181 }, 198 },
182 error: () => { 199 error: () => {
183 let $divide = $('.search-divide'); 200 let $divide = $('.search-divide');
@@ -74,6 +74,10 @@ @@ -74,6 +74,10 @@
74 overflow: hidden; 74 overflow: hidden;
75 } 75 }
76 76
  77 + .code-len {
  78 + width: 444px;
  79 + }
  80 +
77 .button { 81 .button {
78 height: 68px; 82 height: 68px;
79 width: 120px; 83 width: 120px;
@@ -8,17 +8,16 @@ @@ -8,17 +8,16 @@
8 position: relative; 8 position: relative;
9 9
10 .close-invite { 10 .close-invite {
11 - width: 34px; 11 + width: 38px;
12 height: 34px; 12 height: 34px;
13 position: absolute; 13 position: absolute;
14 top: 50%; 14 top: 50%;
15 left: 8px; 15 left: 8px;
16 display: block; 16 display: block;
17 - border-radius: 34px;  
18 - border: 1px solid #fff;  
19 text-align: center; 17 text-align: center;
20 line-height: 34px; 18 line-height: 34px;
21 transform: translateY(-50%); 19 transform: translateY(-50%);
  20 + font-size: 28px;
22 } 21 }
23 22
24 .head-ico { 23 .head-ico {
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-03-23 11:02:31 3 * @Date: 2017-03-23 11:02:31
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-08-02 11:11:07 5 + * @Last Modified time: 2017-08-11 11:40:02
6 */ 6 */
7 /* 红人店铺数据处理 */ 7 /* 红人店铺数据处理 */
8 8
@@ -279,7 +279,7 @@ const floor = (decoratorsData) => { @@ -279,7 +279,7 @@ const floor = (decoratorsData) => {
279 */ 279 */
280 const shopIntro = (params) => { 280 const shopIntro = (params) => {
281 if (params) { 281 if (params) {
282 - params.shop_intro_link = helpers.urlFormat('/product/index/intro', {shop_id: params.shops_id}); 282 + params.shop_intro_link = helpers.urlFormat('/product/index/intro', { shop_id: params.shops_id });
283 } 283 }
284 284
285 return params; 285 return params;
@@ -380,7 +380,8 @@ const getShopBanner = (shopDecoratorList) => { @@ -380,7 +380,8 @@ const getShopBanner = (shopDecoratorList) => {
380 380
381 // 店铺banner 381 // 店铺banner
382 if (floorData.shopTopBannerApp) { 382 if (floorData.shopTopBannerApp) {
383 - banner = resData[0].shopSrc; 383 + banner = resData[0].shopSrc +
  384 + '?imageMogr2/auto-orient/strip/thumbnail/x{height}/crop/{width}x{height}';
384 } 385 }
385 }); 386 });
386 387
This diff could not be displayed because it is too large.