Authored by zhangxiaoru

hotrankCss

@@ -8,11 +8,13 @@ const co = require('bluebird').coroutine; @@ -8,11 +8,13 @@ const co = require('bluebird').coroutine;
8 8
9 9
10 function humanNum_wan(num) { 10 function humanNum_wan(num) {
11 - if (num > 9999) {  
12 - num = (num / 10000).toFixed(2) + '万'  
13 - }  
14 -  
15 return num; 11 return num;
  12 +
  13 + // if (num > 9999) {
  14 + // num = (num / 10000).toFixed(2) + '万'
  15 + // }
  16 +
  17 + // return num;
16 } 18 }
17 19
18 exports.beforeIn = (req, res, next) => { 20 exports.beforeIn = (req, res, next) => {
@@ -87,7 +89,7 @@ exports.crazyWheel = (req, res, next) => { @@ -87,7 +89,7 @@ exports.crazyWheel = (req, res, next) => {
87 } 89 }
88 90
89 vipDayModel.getJoinNum(1).then(result => { 91 vipDayModel.getJoinNum(1).then(result => {
90 - let joins = result && result.data || 0; 92 + let joins = result && result.data || 0;
91 93
92 res.render('vip_day/crazy_wheel', { 94 res.render('vip_day/crazy_wheel', {
93 title: '疯狂大转盘', 95 title: '疯狂大转盘',
@@ -111,7 +113,7 @@ exports.crazyLuck = (req, res, next) => { @@ -111,7 +113,7 @@ exports.crazyLuck = (req, res, next) => {
111 let joinNum = yield vipDayModel.getJoinNum(2); 113 let joinNum = yield vipDayModel.getJoinNum(2);
112 114
113 coins = (coins && coins.data && coins.data.total) || 0; 115 coins = (coins && coins.data && coins.data.total) || 0;
114 - joinNum = (joinNum && joinNum.data) || 0 116 + joinNum = (joinNum && joinNum.data) || 0;
115 117
116 res.render('vip_day/crazy_luck', { 118 res.render('vip_day/crazy_luck', {
117 title: '拼手气', 119 title: '拼手气',
@@ -24,10 +24,12 @@ const _baseShop = (req, res, shopInfo, shopId) => { @@ -24,10 +24,12 @@ const _baseShop = (req, res, shopInfo, shopId) => {
24 pageHeader: headerModel.setNav({ 24 pageHeader: headerModel.setNav({
25 navTitle: result.shopName 25 navTitle: result.shopName
26 }), 26 }),
27 - title: result.shopName,  
28 goodList: result, 27 goodList: result,
29 showDownloadApp: true, 28 showDownloadApp: true,
30 pageFooter: true, 29 pageFooter: true,
  30 + title: shopInfo.shopName + '|' + shopInfo.shopName + '潮流服装服饰-Yoho!Buy有货',
  31 + keywords: shopInfo.shopName + ',' + shopInfo.shopName + '服装服饰,' + shopInfo.shopName + '潮流服装服饰',
  32 + description: shopInfo.shopName + '|Yoho!Buy有货' + shopInfo.shopName + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
31 shopId: shopId, 33 shopId: shopId,
32 }); 34 });
33 }); 35 });
@@ -101,6 +103,12 @@ const _shop = (req, res, shopId) => { @@ -101,6 +103,12 @@ const _shop = (req, res, shopId) => {
101 shopHeadHide: true, 103 shopHeadHide: true,
102 gender: req.query.gender, 104 gender: req.query.gender,
103 channel: req.query.channel, 105 channel: req.query.channel,
  106 + pageHeader: headerModel.setNav({
  107 + navTitle: result.storeName
  108 + }),
  109 + title: result.storeName + '|' + result.storeName + '潮流服装服饰-Yoho!Buy有货',
  110 + keywords: result.storeName + ',' + result.storeName + '服装服饰,' + result.storeName + '潮流服装服饰',
  111 + description: result.storeName + '|Yoho!Buy有货' + result.storeName + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
104 shopId: shopId, 112 shopId: shopId,
105 }); 113 });
106 } 114 }
@@ -181,7 +189,6 @@ const brand = (req, res, next) => { @@ -181,7 +189,6 @@ const brand = (req, res, next) => {
181 } 189 }
182 190
183 listModel.getBrandLogoByDomain(domain).then((result) => { 191 listModel.getBrandLogoByDomain(domain).then((result) => {
184 -  
185 brandLogo = result; 192 brandLogo = result;
186 193
187 title = brandLogo.name; 194 title = brandLogo.name;
@@ -222,7 +229,7 @@ const brand = (req, res, next) => { @@ -222,7 +229,7 @@ const brand = (req, res, next) => {
222 }, resData[0]); 229 }, resData[0]);
223 }); 230 });
224 } 231 }
225 - }).then((brandHome) => { 232 + }).then(brandHome => {
226 params.brandHome = brandHome; 233 params.brandHome = brandHome;
227 234
228 res.render('search/goods-list', { 235 res.render('search/goods-list', {
@@ -234,6 +241,9 @@ const brand = (req, res, next) => { @@ -234,6 +241,9 @@ const brand = (req, res, next) => {
234 goodList: params, 241 goodList: params,
235 showDownloadApp: true, 242 showDownloadApp: true,
236 pageFooter: true, 243 pageFooter: true,
  244 + title: title + '|' + title + '潮流服装服饰-Yoho!Buy有货',
  245 + keywords: title + ',' + title + '服装服饰,' + title + '潮流服装服饰',
  246 + description: title + '|Yoho!Buy有货' + title + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。',
237 domain: req.query.domain, 247 domain: req.query.domain,
238 }); 248 });
239 }); 249 });
@@ -292,7 +302,7 @@ const shopIntro = (req, res, next) => { @@ -292,7 +302,7 @@ const shopIntro = (req, res, next) => {
292 * opt 操作标识("ok":表示收藏,"cancel":表示取消收藏) 302 * opt 操作标识("ok":表示收藏,"cancel":表示取消收藏)
293 */ 303 */
294 const favoriteBrand = (req, res, next) => { 304 const favoriteBrand = (req, res, next) => {
295 - res.setHeader('Access-Control-Allow-Origin', req.protocol + '://' + req.headers.host); 305 + res.setHeader('Access-Control-Allow-Origin', req.protocol + '://' + req.headers.origin);
296 res.setHeader('Access-Control-Allow-Credentials', 'true'); 306 res.setHeader('Access-Control-Allow-Credentials', 'true');
297 307
298 let id = req.query.id; 308 let id = req.query.id;
@@ -157,6 +157,13 @@ const search = (req, res, next) => { @@ -157,6 +157,13 @@ const search = (req, res, next) => {
157 157
158 let params = Object.assign({}, req.query); 158 let params = Object.assign({}, req.query);
159 159
  160 + if (params.query) {
  161 + let activity = _.get(searchModel.searchKeyActivity(params.query), 'data.urlobj.appUrl', '');
  162 +
  163 + if (activity) {
  164 + res.redirect(activity);
  165 + }
  166 + }
160 searchModel.getSearchData(params).then((result) => { 167 searchModel.getSearchData(params).then((result) => {
161 res.render('search/page', { 168 res.render('search/page', {
162 layout: false, 169 layout: false,
@@ -22,7 +22,7 @@ app.on('mount', function(parent) { @@ -22,7 +22,7 @@ app.on('mount', function(parent) {
22 app.set('views', path.join(__dirname, 'views/action')); 22 app.set('views', path.join(__dirname, 'views/action'));
23 app.engine('.hbs', hbs({ 23 app.engine('.hbs', hbs({
24 extname: '.hbs', 24 extname: '.hbs',
25 - defaultLayout: 'layout', 25 + defaultLayout: 'shop-layout',
26 layoutsDir: doraemon, 26 layoutsDir: doraemon,
27 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], 27 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
28 helpers: global.yoho.helpers 28 helpers: global.yoho.helpers
@@ -396,9 +396,11 @@ const getBaseShopData = (params, shopInfo) => { @@ -396,9 +396,11 @@ const getBaseShopData = (params, shopInfo) => {
396 cartUrl: helpers.urlFormat('/cart/index/index') 396 cartUrl: helpers.urlFormat('/cart/index/index')
397 }; 397 };
398 398
  399 + let shopId = params.shop_id || shopInfo.shopsId;
  400 +
399 return api.all([ 401 return api.all([
400 - _getShopDecorator(params.shop_id),  
401 - getShopBrands(params.shop_id) 402 + _getShopDecorator(shopId),
  403 + getShopBrands(shopId)
402 ]).then(result => { 404 ]).then(result => {
403 405
404 if (result[0] && _.has(result[0], 'list')) { 406 if (result[0] && _.has(result[0], 'list')) {
@@ -410,7 +412,7 @@ const getBaseShopData = (params, shopInfo) => { @@ -410,7 +412,7 @@ const getBaseShopData = (params, shopInfo) => {
410 baseShopHome: { 412 baseShopHome: {
411 appVersion: _.get(params, 'app_version', ''), 413 appVersion: _.get(params, 'app_version', ''),
412 isBaseShop: true, 414 isBaseShop: true,
413 - id: params.shop_id, 415 + id: shopId,
414 intro: shopInfo.shopIntro, 416 intro: shopInfo.shopIntro,
415 collected: shopInfo.isFavorite === 'Y', 417 collected: shopInfo.isFavorite === 'Y',
416 banner: _.get(banner[0], 'shopSrc', '') 418 banner: _.get(banner[0], 'shopSrc', '')
@@ -422,7 +424,7 @@ const getBaseShopData = (params, shopInfo) => { @@ -422,7 +424,7 @@ const getBaseShopData = (params, shopInfo) => {
422 424
423 if (params.multBrandShopType === '2') { 425 if (params.multBrandShopType === '2') {
424 // 转义店铺 426 // 转义店铺
425 - finalResult.shop_id = params.shop_id; 427 + finalResult.shop_id = shopId;
426 } else { 428 } else {
427 finalResult.brand = result[1]; 429 finalResult.brand = result[1];
428 } 430 }
@@ -195,6 +195,11 @@ const getSearchIndex = () => { @@ -195,6 +195,11 @@ const getSearchIndex = () => {
195 }); 195 });
196 }; 196 };
197 197
  198 +/**
  199 + * 获取联想词
  200 + * @param params
  201 + * @returns {*|Promise.<TResult>}
  202 + */
198 const getFuzzyDatas = (params) => { 203 const getFuzzyDatas = (params) => {
199 return api.get('', { 204 return api.get('', {
200 method: 'app.search.fuzzy', 205 method: 'app.search.fuzzy',
@@ -209,11 +214,30 @@ const getFuzzyDatas = (params) => { @@ -209,11 +214,30 @@ const getFuzzyDatas = (params) => {
209 }); 214 });
210 }; 215 };
211 216
  217 +/**
  218 + * 查询关键词是否正参加活动
  219 + * @param params
  220 + * @returns {*|Promise.<TResult>}
  221 + */
  222 +const searchKeyActivity = (params) => {
  223 + return api.get('', {
  224 + method: 'app.search.word',
  225 + query: params
  226 + }, {code: 200}).then(result => {
  227 + if (result.data) {
  228 + return result.data;
  229 + } else {
  230 + return {};
  231 + }
  232 + });
  233 +};
  234 +
212 module.exports = { 235 module.exports = {
213 getSearchData, 236 getSearchData,
214 getFilterData, 237 getFilterData,
215 getAllBrandNames, 238 getAllBrandNames,
216 getClassNames, 239 getClassNames,
217 getSearchIndex, 240 getSearchIndex,
218 - getFuzzyDatas 241 + getFuzzyDatas,
  242 + searchKeyActivity
219 }; 243 };
@@ -33,7 +33,7 @@ const list = require(`${cRoot}/list`); @@ -33,7 +33,7 @@ const list = require(`${cRoot}/list`);
33 // 新品到着 controller 33 // 新品到着 controller
34 const news = require(`${cRoot}/new`); 34 const news = require(`${cRoot}/new`);
35 35
36 -//热销排行榜 36 +// 热销排行榜
37 const newsale = require(`${cRoot}/newsale`); 37 const newsale = require(`${cRoot}/newsale`);
38 38
39 // recom 39 // recom
@@ -22,15 +22,16 @@ module.exports = () => { @@ -22,15 +22,16 @@ module.exports = () => {
22 } 22 }
23 break; 23 break;
24 case 'search': // search 24 case 'search': // search
25 - if (req.path === '/' && _.keys(req.query).length) { 25 + if (req.path === '/') {
26 26
27 // 有查询关键字 27 // 有查询关键字
28 - req.url = `/product/search/list?${querystring.stringify(req.query)}`;  
29 - } else {  
30 -  
31 - // 无查询关键字  
32 - req.url = `/product/search/index?${querystring.stringify(req.query)}`; 28 + if (_.keys(req.query).length) {
  29 + req.url = `/product/search/list?${querystring.stringify(req.query)}`;
  30 + } else {
  31 + req.url = `/product/search/index?${querystring.stringify(req.query)}`;
  32 + }
33 } 33 }
  34 +
34 if (req.path === '/search') { 35 if (req.path === '/search') {
35 req.url = `/product/search/index?${querystring.stringify(req.query)}`; 36 req.url = `/product/search/index?${querystring.stringify(req.query)}`;
36 } 37 }
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta charset="utf-8">
  5 + <title>{{title}}</title>
  6 + <meta name="keywords" content="{{keywords}}">
  7 + <meta name="description" content="{{description}}">
  8 + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  9 + <meta http-equiv="cleartype" content="on">
  10 + <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  11 + <meta content="telephone=no" name="format-detection" />
  12 + <meta content="email=no" name="format-detection" />
  13 + <link rel="dns-prefetch" href="//cdn.yoho.cn">
  14 + <link rel="dns-prefetch" href="//static.yohobuy.com">
  15 + <link rel="dns-prefetch" href="//img12.static.yhbimg.com">
  16 + <link rel="dns-prefetch" href="//img13.static.yhbimg.com">
  17 + <script type="text/javascript">
  18 + (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
  19 + </script>
  20 + {{#if devEnv}}
  21 + <link rel="stylesheet" href="//localhost:5001/css/shop.css">
  22 + {{^}}
  23 + <link rel="stylesheet" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/shop.css">
  24 + {{/if}}
  25 + <link rel="apple-touch-icon-precomposed" href="http://static.yohobuy.com/m/v1/img/touch/apple-touch-icon-144x144-precomposed-new.png">
  26 + <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)">
  27 + <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)">
  28 + </head>
  29 + <body {{#if isPassportPage}}class=passport-body{{/if}} {{#if isStarIndexPage}} class="star-index-bg"{{/if}} {{#if isStarDetailPage}}class="star-class-body"{{/if}}>
  30 + <div class="main-wrap">
  31 + {{#if systemUpdate}}
  32 + {{> updata}}
  33 + {{/if}}
  34 +
  35 + {{#unless shopHeadHide}}
  36 + {{> header}}
  37 + {{/unless}}
  38 + {{{body}}}
  39 + {{> footer}}
  40 + </div>
  41 +
  42 + {{> download-app}}
  43 + {{#wechatShare}}
  44 + <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
  45 + {{/wechatShare}}
  46 + {{#if devEnv}}
  47 + <script src="//localhost:5001/libs.js"></script>
  48 + <script src="//localhost:5001/{{module}}.{{page}}.js"></script>
  49 + {{^}}
  50 + <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/libs.js"></script>
  51 + <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script>
  52 + {{/if}}
  53 + {{#unless devEnv}}
  54 + {{> analysis}}
  55 + {{/unless}}
  56 + </body>
  57 +</html>
@@ -142,7 +142,7 @@ gulp.task('dist', ['ge'], () => { @@ -142,7 +142,7 @@ gulp.task('dist', ['ge'], () => {
142 142
143 // postcss compile in dev 143 // postcss compile in dev
144 gulp.task('postcss-dev', () => { 144 gulp.task('postcss-dev', () => {
145 - return gulp.src('scss/index.css') 145 + return gulp.src(['scss/index.css', 'scss/shop.css'])
146 .pipe(sourcemaps.init()) 146 .pipe(sourcemaps.init())
147 .pipe(postcss(postcssPlugin(env.dev))) 147 .pipe(postcss(postcssPlugin(env.dev)))
148 .pipe(sourcemaps.write('.')) 148 .pipe(sourcemaps.write('.'))
@@ -171,7 +171,7 @@ gulp.task('font', () => { @@ -171,7 +171,7 @@ gulp.task('font', () => {
171 171
172 // postcss compile in pro 172 // postcss compile in pro
173 gulp.task('postcss', ['assets'], () => { 173 gulp.task('postcss', ['assets'], () => {
174 - return gulp.src('scss/index.css') 174 + return gulp.src(['scss/index.css', 'scss/shop.css'])
175 .pipe(postcss(postcssPlugin(env.pro))) 175 .pipe(postcss(postcssPlugin(env.pro)))
176 .pipe(cssnano({ 176 .pipe(cssnano({
177 safe: true 177 safe: true

38.5 KB | W: | H:

29.6 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
@@ -617,9 +617,9 @@ if ($brandHeader.length > 0) { @@ -617,9 +617,9 @@ if ($brandHeader.length > 0) {
617 opt: opt, 617 opt: opt,
618 type: $brandHeader.data('isbaseshop') ? 'shop' : 'brand' 618 type: $brandHeader.data('isbaseshop') ? 'shop' : 'brand'
619 }, 619 },
620 - xhrFields: {  
621 - withCredentials: true  
622 - }, 620 + xhrFields: {
  621 + withCredentials: true
  622 +},
623 success: function(data) { 623 success: function(data) {
624 if (data.code === 200) { 624 if (data.code === 200) {
625 $this.toggleClass('coled'); 625 $this.toggleClass('coled');
@@ -218,7 +218,7 @@ function getParam(req) { @@ -218,7 +218,7 @@ function getParam(req) {
218 function newData(callback) { 218 function newData(callback) {
219 var req = {}; 219 var req = {};
220 220
221 - req.url = location.protocol + '//m.yohobuy.com/index/search/search'; 221 + req.url = location.protocol + '//m.yohobuy.com/product/search/search';
222 req.data = { 222 req.data = {
223 type: 'new', 223 type: 'new',
224 order: '1', 224 order: '1',
@@ -231,7 +231,7 @@ function newData(callback) { @@ -231,7 +231,7 @@ function newData(callback) {
231 req.callBack = function(data) { 231 req.callBack = function(data) {
232 $('#new-arrival').append(data); 232 $('#new-arrival').append(data);
233 navInfo.new.page++; 233 navInfo.new.page++;
234 - myScroll.refresh(); 234 + myScroll && myScroll.refresh();
235 lazyLoad($('#new-arrival .lazy')); 235 lazyLoad($('#new-arrival .lazy'));
236 scH = $('#scroller').outerHeight(); 236 scH = $('#scroller').outerHeight();
237 searching = false; 237 searching = false;
@@ -243,7 +243,7 @@ function newData(callback) { @@ -243,7 +243,7 @@ function newData(callback) {
243 function hotData(callback) { 243 function hotData(callback) {
244 var req = {}; 244 var req = {};
245 245
246 - req.url = location.protocol + '//m.yohobuy.com/index/search/search'; 246 + req.url = location.protocol + '//m.yohobuy.com/product/search/search';
247 req.data = { 247 req.data = {
248 type: 'hot', 248 type: 'hot',
249 order: '1', 249 order: '1',
@@ -256,8 +256,7 @@ function hotData(callback) { @@ -256,8 +256,7 @@ function hotData(callback) {
256 req.callBack = function(data) { 256 req.callBack = function(data) {
257 $('#popularity').append(data); 257 $('#popularity').append(data);
258 navInfo.hot.page++; 258 navInfo.hot.page++;
259 -  
260 - // myScroll.refresh(); 259 + myScroll && myScroll.refresh();
261 lazyLoad($('#popularity .lazy')); 260 lazyLoad($('#popularity .lazy'));
262 scH = $('#scroller').outerHeight(); 261 scH = $('#scroller').outerHeight();
263 searching = false; 262 searching = false;
@@ -303,8 +302,7 @@ function tabChange(dom, index) { @@ -303,8 +302,7 @@ function tabChange(dom, index) {
303 $nav1.removeClass('fixed-top absolute'); 302 $nav1.removeClass('fixed-top absolute');
304 $nav2.removeClass('fixed-top absolute'); 303 $nav2.removeClass('fixed-top absolute');
305 } 304 }
306 -  
307 - // myScroll && myScroll.refresh(); 305 + myScroll && myScroll.refresh();
308 scH = $('#scroller').outerHeight(); 306 scH = $('#scroller').outerHeight();
309 if (!$nav1.hasClass('hide')) { 307 if (!$nav1.hasClass('hide')) {
310 myScroll && myScroll.scrollTo(0, 0 - imgH); 308 myScroll && myScroll.scrollTo(0, 0 - imgH);
@@ -371,7 +369,7 @@ function scrollHandler() { @@ -371,7 +369,7 @@ function scrollHandler() {
371 type: 'shop_id', 369 type: 'shop_id',
372 id: shopId, 370 id: shopId,
373 brand: brand, 371 brand: brand,
374 - url: location.protocol + '//m.yohobuy.com/index/search/search', 372 + url: location.protocol + '//m.yohobuy.com/product/search/search',
375 nextPage: true 373 nextPage: true
376 }); 374 });
377 } 375 }
@@ -466,6 +464,8 @@ function scrollHandler() { @@ -466,6 +464,8 @@ function scrollHandler() {
466 }); 464 });
467 } 465 }
468 } 466 }
  467 +
  468 + $('#scroller').trigger('scroll');
469 } 469 }
470 470
471 document.addEventListener('touchmove', function(e) { 471 document.addEventListener('touchmove', function(e) {
@@ -486,9 +486,9 @@ $(window).ready(function() { @@ -486,9 +486,9 @@ $(window).ready(function() {
486 imgH = $('#nav-top').outerHeight(); 486 imgH = $('#nav-top').outerHeight();
487 nav1H = $('#nav').outerHeight(); 487 nav1H = $('#nav').outerHeight();
488 main1H = $('#nav-main').height(); 488 main1H = $('#nav-main').height();
489 - main1oH = $('#nav-main').outerHeight();  
490 - nav2H = $('#list-nav').outerHeight();  
491 - main2oH = $('#goods-container').outerHeight(); 489 + main1oH = $('#nav-main').outerHeight(true);
  490 + nav2H = $('#list-nav').outerHeight(true);
  491 + main2oH = $('#goods-container').outerHeight(true);
492 492
493 493
494 myScroll = new IScroll('#wrapper', { 494 myScroll = new IScroll('#wrapper', {
@@ -519,7 +519,7 @@ $(window).ready(function() { @@ -519,7 +519,7 @@ $(window).ready(function() {
519 519
520 multiSwiper && multiSwiper.startAutoplay(); 520 multiSwiper && multiSwiper.startAutoplay();
521 521
522 - $('#scroller').trigger('scroll'); 522 + // $('#scroller').trigger('scroll');
523 scrollHandler.bind(this)(); 523 scrollHandler.bind(this)();
524 }); 524 });
525 lazyLoad($('img.lazy')); 525 lazyLoad($('img.lazy'));
@@ -541,7 +541,7 @@ function search(opt) { @@ -541,7 +541,7 @@ function search(opt) {
541 } 541 }
542 542
543 if (!opt.url) { 543 if (!opt.url) {
544 - opt.url = location.protocol + '//m.yohobuy.com/index/search/search'; 544 + opt.url = location.protocol + '//m.yohobuy.com/product/search/search';
545 } 545 }
546 546
547 $pre = $listNav.find('.active').eq(0); 547 $pre = $listNav.find('.active').eq(0);
@@ -739,10 +739,11 @@ $subNav.on('touchend touchcancel', function(e) { @@ -739,10 +739,11 @@ $subNav.on('touchend touchcancel', function(e) {
739 739
740 // 筛选面板切换状态 740 // 筛选面板切换状态
741 if ($this.hasClass('active')) { 741 if ($this.hasClass('active')) {
  742 + $this.removeClass('active');
742 filter.hideFilter(); 743 filter.hideFilter();
743 myScroll && myScroll.enable(); 744 myScroll && myScroll.enable();
744 } else { 745 } else {
745 - 746 + $this.addClass('active');
746 myScroll && myScroll.scrollTo(0, -(imgH + main1oH + nav1H)); 747 myScroll && myScroll.scrollTo(0, -(imgH + main1oH + nav1H));
747 748
748 theY = imgH + main1oH + nav1H; 749 theY = imgH + main1oH + nav1H;
@@ -760,6 +761,9 @@ $subNav.on('touchend touchcancel', function(e) { @@ -760,6 +761,9 @@ $subNav.on('touchend touchcancel', function(e) {
760 myScroll && myScroll.disable(); 761 myScroll && myScroll.disable();
761 } 762 }
762 } else { 763 } else {
  764 +
  765 + filter.hideFilter();// 隐藏面板
  766 +
763 if ($this.hasClass('new')) { 767 if ($this.hasClass('new')) {
764 cname = '.new'; 768 cname = '.new';
765 navType = 'newest'; 769 navType = 'newest';
@@ -850,7 +854,7 @@ $subNav.on('touchend touchcancel', function(e) { @@ -850,7 +854,7 @@ $subNav.on('touchend touchcancel', function(e) {
850 type: 'shop_id', 854 type: 'shop_id',
851 id: shopId, 855 id: shopId,
852 brand: brand, 856 brand: brand,
853 - url: location.protocol + '//m.yohobuy.com/index/search/search', 857 + url: location.protocol + '//m.yohobuy.com/product/search/search',
854 nextPage: false 858 nextPage: false
855 }); 859 });
856 } 860 }
@@ -908,7 +912,7 @@ function stopPropagation(e) { @@ -908,7 +912,7 @@ function stopPropagation(e) {
908 } 912 }
909 } 913 }
910 914
911 -$(document).bind('touchstart', function(e) { 915 +$(document).bind('touchstart', function() {
912 $('.sub-group').addClass('hide'); 916 $('.sub-group').addClass('hide');
913 }); 917 });
914 918
@@ -940,9 +944,9 @@ $collect.on('touchstart', function() { @@ -940,9 +944,9 @@ $collect.on('touchstart', function() {
940 opt: opt, 944 opt: opt,
941 type: 'shop' 945 type: 'shop'
942 }, 946 },
943 - xhrFields: {  
944 - withCredentials: true  
945 - }, 947 + xhrFields: {
  948 + withCredentials: true
  949 +},
946 success: function(data) { 950 success: function(data) {
947 var url = ''; 951 var url = '';
948 952
@@ -965,7 +969,7 @@ $collect.on('touchstart', function() { @@ -965,7 +969,7 @@ $collect.on('touchstart', function() {
965 } 969 }
966 970
967 setTimeout(function() { 971 setTimeout(function() {
968 - // myScroll.refresh(); 972 + myScroll && myScroll.refresh();
969 scH = $('#scroller').outerHeight(); 973 scH = $('#scroller').outerHeight();
970 }, 500); 974 }, 500);
971 searching = false; 975 searching = false;
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 * 8 *
9 * 希望能与 微信 JS-SDK 一样方便 9 * 希望能与 微信 JS-SDK 一样方便
10 */ 10 */
  11 +var $ = require('yoho-jquery');
11 var tip = require('./plugin/tip'); 12 var tip = require('./plugin/tip');
12 13
13 /* 空方法 */ 14 /* 空方法 */
@@ -16,11 +17,22 @@ var emptyFn = function() { }; @@ -16,11 +17,22 @@ var emptyFn = function() { };
16 /* 提示信息 */ 17 /* 提示信息 */
17 var tipInfo = '暂不支持,请在YOHO!BUY应用中打开'; 18 var tipInfo = '暂不支持,请在YOHO!BUY应用中打开';
18 19
19 -var yoho = { 20 +var qs = window.queryString;
  21 +
  22 +var yoho, $appLink;
  23 +
  24 +$appLink = $('#yoho-app-link');
  25 +
  26 +if (!$appLink.length) {
  27 + $('body').append('<a id="yoho-app-link" href="javascript:;" style="display:none !important;"></a>');
  28 + $appLink = $('#yoho-app-link');
  29 +}
  30 +
  31 +yoho = {
20 /** 32 /**
21 * 判断是否是 APP 33 * 判断是否是 APP
22 */ 34 */
23 - isApp: /YohoBuy/i.test(navigator.userAgent || ''), 35 + isApp: /YohoBuy/i.test(navigator.userAgent || '') || qs.app_version,
24 isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''), 36 isiOS: /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || ''),
25 isAndroid: /Android/i.test(navigator.userAgent || ''), 37 isAndroid: /Android/i.test(navigator.userAgent || ''),
26 38
@@ -73,12 +85,85 @@ var yoho = { @@ -73,12 +85,85 @@ var yoho = {
73 }, 500); 85 }, 500);
74 }, 86 },
75 87
  88 + parseUrl: function(url) {
  89 + var query = {},
  90 + hashs,
  91 + hash,
  92 + i;
  93 +
  94 + url = (url || '').split('?');
  95 + hashs = url[1].split('&');
  96 +
  97 + if (hashs && hashs.length) {
  98 + for (i = 0; i < hashs.length; i++) {
  99 + hash = hashs[i].split('=');
  100 + console.log(hashs[i]);
  101 + query[hash[0]] = hash[1];
  102 + }
  103 + }
  104 +
  105 + return {
  106 + path: url[0],
  107 + query: query
  108 + };
  109 + },
  110 +
76 getUid: function() { 111 getUid: function() {
77 - if (window.queryString.app_version) {  
78 - return window.queryString.uid || 0; 112 + if (yoho.isApp) {
  113 + return qs.uid;
  114 + }
  115 +
  116 + return window.gitUid();
  117 + },
  118 +
  119 + goLogin: function(refer, data) {
  120 + var url;
  121 +
  122 + url = 'http://m.yohobuy.com/signin.html?refer=' + encodeURIComponent(refer);
  123 + refer = yoho.parseUrl(refer || location.href);
  124 +
  125 + if (yoho.isApp) {
  126 + url = url + '&openby:yohobuy=' + (data || JSON.stringify({
  127 + action: 'go.weblogin',
  128 + params: {
  129 + priority: 'N',
  130 + jumpurl: {
  131 + url: refer.path,
  132 + param: refer.query
  133 + }
  134 + }
  135 + }));
  136 + }
  137 +
  138 + $appLink.attr('href', url);
  139 + $appLink[0].click();
  140 + return false;
  141 + },
  142 +
  143 + goH5: function(link, data) {
  144 + var url = link;
  145 +
  146 + if (!link) {
  147 + return;
  148 + }
  149 + link = yoho.parseUrl(link || location.href);
  150 +
  151 + if (yoho.isApp) {
  152 + url = url + '&openby:yohobuy=' + (data || JSON.stringify({
  153 + action: 'go.h5',
  154 + params: {
  155 + islogin: 'N',
  156 + type: 0,
  157 + updateflag: Date.now() + '',
  158 + url: link.path,
  159 + param: link.query
  160 + }
  161 + }));
79 } 162 }
80 163
81 - return window.getUid() || 0; 164 + $appLink.attr('href', url);
  165 + $appLink[0].click();
  166 + return false;
82 } 167 }
83 }; 168 };
84 169
  1 +.hot-category {
  2 + margin: 30px 0 0;
  3 + border-bottom: 1px solid #e0e0e0;
  4 +
  5 + .category-banner {
  6 + height: 198px;
  7 + img {
  8 + display: block;
  9 + width: 100%;
  10 + height: 198px;
  11 + }
  12 + }
  13 + .category-list {
  14 + background: #fff;
  15 +
  16 + li {
  17 + float: left;
  18 + width: 158px;
  19 + height: 158px;
  20 + border-top: 1px solid #e0e0e0;
  21 + border-left: 1px solid #e0e0e0;
  22 + overflow: hidden;
  23 + position: relative;
  24 +
  25 + .img-box {
  26 + width: 100%;
  27 + height: 100%;
  28 + line-height: 154px;
  29 + text-align: center;
  30 + overflow: hidden;
  31 + font-size: 0;
  32 + position: relative;
  33 +
  34 + img {
  35 + vertical-align: middle;
  36 + width: 100%;
  37 + height: 100%;
  38 + max-width: 100%;
  39 + max-height: 100%;
  40 + }
  41 + }
  42 +
  43 + .category-title {
  44 + line-height: 22px;
  45 + color: #aaa;
  46 + font-size: 18px;
  47 + text-align: center;
  48 + }
  49 +
  50 + .img-cover {
  51 + position: absolute;
  52 + height: 42px;
  53 + line-height: 42px;
  54 + text-align: center;
  55 + width: 100%;
  56 + bottom: 0;
  57 + color: #000;
  58 + font-size: 22px;
  59 + }
  60 + }
  61 + }
  62 +}
1 @charset "utf-8"; 1 @charset "utf-8";
  2 +
2 /* base */ 3 /* base */
3 @import "me/index"; 4 @import "me/index";
4 @import "layout/reset"; 5 @import "layout/reset";
@@ -18,7 +19,6 @@ @@ -18,7 +19,6 @@
18 @import "layout/form"; 19 @import "layout/form";
19 @import "common/index"; 20 @import "common/index";
20 @import "channel/index"; 21 @import "channel/index";
21 -@import "product/index";  
22 @import "activity/index"; 22 @import "activity/index";
23 @import "activity/invite"; 23 @import "activity/invite";
24 @import "passport/index"; 24 @import "passport/index";
@@ -26,4 +26,3 @@ @@ -26,4 +26,3 @@
26 @import "cart/chose-panel"; 26 @import "cart/chose-panel";
27 @import "home/index"; 27 @import "home/index";
28 @import "me/index"; 28 @import "me/index";
29 -@import "home/index";  
@@ -6,6 +6,10 @@ @@ -6,6 +6,10 @@
6 right: 0; 6 right: 0;
7 overflow: hidden; 7 overflow: hidden;
8 8
  9 + .nav-main {
  10 + margin-bottom: 30px;
  11 + }
  12 +
9 .branner-top { 13 .branner-top {
10 width: 100%; 14 width: 100%;
11 height: 200px; 15 height: 200px;
@@ -76,33 +80,33 @@ @@ -76,33 +80,33 @@
76 background: #fff; 80 background: #fff;
77 overflow: hidden; 81 overflow: hidden;
78 border-sizing: border-box; 82 border-sizing: border-box;
79 - border-bottom: 1px solid #e1e1e1;  
80 -  
81 - li {  
82 - color: #b1b1b1; 83 + border-bottom: 1px solid #e0e0e0;
  84 + z-index: 2;
  85 +
  86 + li{
83 display: block; 87 display: block;
84 height: 28px; 88 height: 28px;
85 float: left; 89 float: left;
86 line-height: 28px; 90 line-height: 28px;
87 width: 24.7%; 91 width: 24.7%;
88 text-align: center; 92 text-align: center;
89 - border-left: 1px solid #e1e1e1; 93 + border-left: 1px solid #e0e0e0;
90 margin-top: 30px; 94 margin-top: 30px;
91 border-sizing: border-box; 95 border-sizing: border-box;
92 - color: #b1b1b1; 96 + color: #b0b0b0;
93 97
94 &:first-child { 98 &:first-child {
95 border-left: none; 99 border-left: none;
96 } 100 }
97 101
98 a { 102 a {
99 - color: #b1b1b1; 103 + color: #b0b0b0;
100 } 104 }
101 } 105 }
102 106
103 .color { 107 .color {
104 - color: #000;  
105 - } 108 + color: #444;
  109 + }
106 } 110 }
107 111
108 .main { 112 .main {
@@ -116,10 +120,6 @@ @@ -116,10 +120,6 @@
116 margin-bottom: 30px; 120 margin-bottom: 30px;
117 } 121 }
118 122
119 - .hide {  
120 - display: hidden;  
121 - }  
122 -  
123 .coupon { 123 .coupon {
124 width: 100%; 124 width: 100%;
125 padding: 30px 0; 125 padding: 30px 0;
@@ -138,7 +138,7 @@ @@ -138,7 +138,7 @@
138 width: 100%; 138 width: 100%;
139 height: 270px; 139 height: 270px;
140 background: #fff; 140 background: #fff;
141 - border: 1px solid #e1e1e1; 141 + border: 1px solid #e0e0e0;
142 border-top: none; 142 border-top: none;
143 font-size: 20px; 143 font-size: 20px;
144 text-align: center; 144 text-align: center;
@@ -157,15 +157,15 @@ @@ -157,15 +157,15 @@
157 157
158 .brand-img { 158 .brand-img {
159 margin-left: 30px; 159 margin-left: 30px;
160 - width: 30%; 160 + width: 140px;
161 height: 150px; 161 height: 150px;
162 overflow: hidden; 162 overflow: hidden;
163 padding-bottom: 20px; 163 padding-bottom: 20px;
164 float: left; 164 float: left;
165 165
166 p { 166 p {
167 - font-size: 25px;  
168 - color: #b1b1b1; 167 + font-size: 18px;
  168 + color: #b0b0b0;
169 padding-top: 10px; 169 padding-top: 10px;
170 height: 30px; 170 height: 30px;
171 white-space: nowrap; 171 white-space: nowrap;
@@ -174,40 +174,52 @@ @@ -174,40 +174,52 @@
174 } 174 }
175 175
176 img { 176 img {
177 - height: 70%; 177 + height: 120px;
178 } 178 }
179 } 179 }
180 180
181 .spring { 181 .spring {
182 - margin: 0; 182 + margin: 0 15px;
183 overflow: hidden; 183 overflow: hidden;
184 184
185 li { 185 li {
186 width: 50%; 186 width: 50%;
187 - height: 168px; 187 + height: 160px;
188 float: left; 188 float: left;
189 text-align: center; 189 text-align: center;
190 list-style: none; 190 list-style: none;
191 display: list-item; 191 display: list-item;
192 192
193 img { 193 img {
194 - width: 90%; 194 + width: 275px;
  195 + height: inherit;
195 border-radius: 10px; 196 border-radius: 10px;
196 vertical-align: top; 197 vertical-align: top;
197 } 198 }
198 } 199 }
199 } 200 }
200 201
201 - .popularity-title { 202 + .hot-category .floor-header {
  203 + margin: 0;
  204 + }
  205 +
  206 + .popularity-title, .hot-category .floor-header {
202 background: #fff; 207 background: #fff;
203 - border-bottom: 1px solid #e8e8e8; 208 + border-bottom: 1px solid #e0e0e0;
  209 + border-top: 1px solid #e0e0e0;
  210 + color: #444;
204 text-align: center; 211 text-align: center;
205 - line-height: 98px;  
206 - font-size: 32px;  
207 - margin-top: 40px; 212 + height: 100px;
  213 + line-height: 100px;
  214 + font-size: 30px;
  215 + margin-top: 30px;
208 position: relative; 216 position: relative;
209 } 217 }
210 218
  219 + .hot-category .floor-header {
  220 + border-bottom: none;
  221 + }
  222 +
211 .more { 223 .more {
212 position: absolute; 224 position: absolute;
213 right: 30px; 225 right: 30px;
@@ -272,7 +284,7 @@ @@ -272,7 +284,7 @@
272 284
273 .icon { 285 .icon {
274 position: relative; 286 position: relative;
275 - color: #b1b1b1; 287 + color: #b0b0b0;
276 288
277 i { 289 i {
278 position: absolute; 290 position: absolute;
@@ -319,7 +331,7 @@ @@ -319,7 +331,7 @@
319 .discount:after { 331 .discount:after {
320 height: 28px; 332 height: 28px;
321 content: ''; 333 content: '';
322 - border-left: 1px solid #e1e1e1; 334 + border-left: 1px solid #e0e0e0;
323 position: absolute; 335 position: absolute;
324 top: 25px; 336 top: 25px;
325 left: 163px; 337 left: 163px;
@@ -329,11 +341,16 @@ @@ -329,11 +341,16 @@
329 .discount-area { 341 .discount-area {
330 @extend .sale-page; 342 @extend .sale-page;
331 343
  344 + #list-nav {
  345 + border-top: 1px solid #e0e0e0;
  346 + border-bottom: 1px solid #e0e0e0;
  347 + }
  348 +
332 .list-nav li { 349 .list-nav li {
333 display: block; 350 display: block;
334 - height: 78px; 351 + height: 80px;
335 float: left; 352 float: left;
336 - line-height: 78px; 353 + line-height: 80px;
337 width: 24.8%; 354 width: 24.8%;
338 text-align: center; 355 text-align: center;
339 border-sizing: border-box; 356 border-sizing: border-box;
@@ -349,7 +366,7 @@ @@ -349,7 +366,7 @@
349 &.discount:after { 366 &.discount:after {
350 height: 28px; 367 height: 28px;
351 content: ''; 368 content: '';
352 - border-left: 1px solid #e1e1e1; 369 + border-left: 1px solid #e0e0e0;
353 position: absolute; 370 position: absolute;
354 top: 25px; 371 top: 25px;
355 left: 163px; 372 left: 163px;
@@ -358,8 +375,8 @@ @@ -358,8 +375,8 @@
358 375
359 .active { 376 .active {
360 .cur { 377 .cur {
361 - color: #000;  
362 - } 378 + color: #444;
  379 + }
363 } 380 }
364 381
365 .list-nav .icon .up { 382 .list-nav .icon .up {
@@ -393,7 +410,7 @@ @@ -393,7 +410,7 @@
393 line-height: 88px; 410 line-height: 88px;
394 font-size: 28px; 411 font-size: 28px;
395 background: #fff; 412 background: #fff;
396 - border-top: 1px solid #eaeaea; 413 + border-top: 1px solid #e0e0e0;
397 z-index: 2; 414 z-index: 2;
398 415
399 416
@@ -410,7 +427,7 @@ @@ -410,7 +427,7 @@
410 height: 28px; 427 height: 28px;
411 margin-top: 30px; 428 margin-top: 30px;
412 float: right; 429 float: right;
413 - border-right: 1px solid #eaeaea; 430 + border-right: 1px solid #e0e0e0;
414 display: inline-block; 431 display: inline-block;
415 } 432 }
416 } 433 }
@@ -418,24 +435,28 @@ @@ -418,24 +435,28 @@
418 .sub-group { 435 .sub-group {
419 position: absolute; 436 position: absolute;
420 background: #fff; 437 background: #fff;
421 - border: 1px solid #eaeaea; 438 + border: 1px solid #e0e0e0;
422 border-radius: 12px; 439 border-radius: 12px;
423 bottom: 104px; 440 bottom: 104px;
424 width: 40%; 441 width: 40%;
425 margin-left: 5%; 442 margin-left: 5%;
426 443
427 dl { 444 dl {
428 - width: 80%; 445 + padding: 0 30px;
429 margin: 0 auto; 446 margin: 0 auto;
430 } 447 }
431 448
432 dd { 449 dd {
433 line-height: 80px; 450 line-height: 80px;
434 text-align: center; 451 text-align: center;
435 - border-top: 1px solid #eaeaea; 452 + border-top: 1px solid #e0e0e0;
436 white-space: nowrap; 453 white-space: nowrap;
437 overflow: hidden; 454 overflow: hidden;
438 text-overflow: ellipsis; 455 text-overflow: ellipsis;
  456 +
  457 + a {
  458 + color: #444;
  459 + }
439 } 460 }
440 461
441 dd:first-child { 462 dd:first-child {
@@ -446,8 +467,8 @@ @@ -446,8 +467,8 @@
446 .sharp { 467 .sharp {
447 position: absolute; 468 position: absolute;
448 width: 100%; 469 width: 100%;
449 - height: 14px;  
450 - background: resolve("product/sharp.png") no-repeat center center; 470 + height: 10px;
  471 + background: resolve('product/sharp.png') no-repeat center center;
451 } 472 }
452 473
453 .foot-list-3 .sub-group { 474 .foot-list-3 .sub-group {
@@ -501,11 +522,11 @@ @@ -501,11 +522,11 @@
501 text-align: center; 522 text-align: center;
502 width: 100%; 523 width: 100%;
503 height: 100%; 524 height: 100%;
504 - color: #999; 525 + color: #b0b0b0;
505 526
506 /*b { 527 /*b {
507 height: 28px; 528 height: 28px;
508 - border-left: 1px solid #e1e1e1; 529 + border-left: 1px solid #e0e0e0;
509 float: right; 530 float: right;
510 margin-top: 25px; 531 margin-top: 25px;
511 }*/ 532 }*/
@@ -513,11 +534,11 @@ @@ -513,11 +534,11 @@
513 } 534 }
514 535
515 .active .cur { 536 .active .cur {
516 - color: #000; 537 + color: #444;
517 } 538 }
518 539
519 .active a { 540 .active a {
520 - color: #000; 541 + color: #444;
521 } 542 }
522 543
523 544
@@ -551,7 +572,6 @@ @@ -551,7 +572,6 @@
551 572
552 .category-list-top-board { 573 .category-list-top-board {
553 border-top: 1px solid #e0e0e0; 574 border-top: 1px solid #e0e0e0;
554 - min-height: 160px;  
555 } 575 }
556 576
557 .category-list-last-li { 577 .category-list-last-li {
@@ -564,6 +584,8 @@ @@ -564,6 +584,8 @@
564 } 584 }
565 585
566 .shop-index + .filter-mask { 586 .shop-index + .filter-mask {
  587 + margin-top: 1px;
  588 +
567 .filter-body { 589 .filter-body {
568 overflow: auto; 590 overflow: auto;
569 } 591 }
  1 +@charset "utf-8";
  2 +
  3 +/* base */
  4 +@import "layout/reset";
  5 +@import "layout/common";
  6 +@import "layout/loading";
  7 +@import "layout/swiper";
  8 +@import "layout/header";
  9 +@import "layout/footer";
  10 +@import "layout/utils";
  11 +
  12 +/* page */
  13 +@import "channel/index";
  14 +@import "common/index";
  15 +@import "product/index";
  16 +@import "home/hot-category";