Authored by 郝肖肖

首页获取频道首屏加载部分楼层

@@ -32,7 +32,8 @@ let _renderData = { @@ -32,7 +32,8 @@ let _renderData = {
32 let _channelPage = (req, res, data) => { 32 let _channelPage = (req, res, data) => {
33 return channelModel.getChannelData({ 33 return channelModel.getChannelData({
34 gender: data.gender, 34 gender: data.gender,
35 - uid: _.toString(req.user.uid) 35 + uid: _.toString(req.user.uid),
  36 + limit: 6// 首屏先获取前6个楼层,其余用ajax获取
36 }).then(result => { 37 }).then(result => {
37 _renderData.homeHeader.defaultTerms = result.defaultTerms; 38 _renderData.homeHeader.defaultTerms = result.defaultTerms;
38 39
@@ -56,6 +57,24 @@ let _channelPage = (req, res, data) => { @@ -56,6 +57,24 @@ let _channelPage = (req, res, data) => {
56 }; 57 };
57 58
58 /** 59 /**
  60 + * 获取首页频道其余楼层
  61 + */
  62 +let getResourceContent = (req, res, next) => {
  63 +
  64 + return channelModel.getChannelResource({
  65 + gender: req.query.gender,
  66 + uid: _.toString(req.user.uid),
  67 + }).then(result => {
  68 +
  69 + if (result.length) {
  70 + result = result.slice(6);
  71 + }
  72 +
  73 + res.json(result);
  74 + }).catch(next);
  75 +};
  76 +
  77 +/**
59 * 频道选择页 78 * 频道选择页
60 */ 79 */
61 let index = (req, res, next) => { 80 let index = (req, res, next) => {
@@ -163,7 +182,7 @@ let shopRecom = (req, res, next) => { @@ -163,7 +182,7 @@ let shopRecom = (req, res, next) => {
163 }).then(result => { 182 }).then(result => {
164 res.send(result); 183 res.send(result);
165 }).catch(next); 184 }).catch(next);
166 -} 185 +};
167 186
168 /** 187 /**
169 * 获取用户vip信息 188 * 获取用户vip信息
@@ -187,12 +206,12 @@ let userVip = (req, res, next) => { @@ -187,12 +206,12 @@ let userVip = (req, res, next) => {
187 res.json({ 206 res.json({
188 code: 500, 207 code: 500,
189 msg: '出错了', 208 msg: '出错了',
190 - }) 209 + });
191 } 210 }
192 - }); 211 + }).catch(next);
193 } 212 }
194 213
195 -} 214 +};
196 215
197 module.exports = { 216 module.exports = {
198 switchChannel, 217 switchChannel,
@@ -204,4 +223,5 @@ module.exports = { @@ -204,4 +223,5 @@ module.exports = {
204 bottomBanner, 223 bottomBanner,
205 shopRecom, 224 shopRecom,
206 userVip, 225 userVip,
207 -};  
  226 + getResourceContent
  227 +};
@@ -114,14 +114,14 @@ const _processSideBar = (list, choosed) => { @@ -114,14 +114,14 @@ const _processSideBar = (list, choosed) => {
114 * @param {[object]} gender 114 * @param {[object]} gender
115 * @return {[type]} 115 * @return {[type]}
116 */ 116 */
117 -const _getChannelResource = (params) => { 117 +const getChannelResource = (params) => {
118 params.gender = params.gender || 'boys'; 118 params.gender = params.gender || 'boys';
  119 + params.limit = params.limit || 30;
119 120
120 params = Object.assign(params, { 121 params = Object.assign(params, {
121 gender: genderData[params.gender] || '1,2,3', 122 gender: genderData[params.gender] || '1,2,3',
122 content_code: contentCode[params.gender], // eslint-disable-line 123 content_code: contentCode[params.gender], // eslint-disable-line
123 - page: 1,  
124 - limit: 30 124 + page: 1
125 }); 125 });
126 if (!params.uid) { 126 if (!params.uid) {
127 params.new_device = true; // eslint-disable-line 127 params.new_device = true; // eslint-disable-line
@@ -269,7 +269,7 @@ let getChannelData = (params) => { @@ -269,7 +269,7 @@ let getChannelData = (params) => {
269 var channelData = {}; 269 var channelData = {};
270 let navGender = _.cloneDeep(params.gender); 270 let navGender = _.cloneDeep(params.gender);
271 271
272 - return Promise.all([_getChannelResource(params), _getLeftNav(navGender), _getSearchIndex()]).then((data) => { 272 + return Promise.all([getChannelResource(params), _getLeftNav(navGender), _getSearchIndex()]).then((data) => {
273 channelData.content = data[0] || []; // 资源位数据 273 channelData.content = data[0] || []; // 资源位数据
274 channelData.sideNav = data[1] || []; // 侧边栏数据 274 channelData.sideNav = data[1] || []; // 侧边栏数据
275 channelData.defaultTerms = (data[2] && data[2].defaultTerms && data[2].defaultTerms.length !== 0) ? data[2].defaultTerms[0].content : '搜索商品、品牌'; 275 channelData.defaultTerms = (data[2] && data[2].defaultTerms && data[2].defaultTerms.length !== 0) ? data[2].defaultTerms[0].content : '搜索商品、品牌';
@@ -308,10 +308,11 @@ let shopRecom = (params) => { @@ -308,10 +308,11 @@ let shopRecom = (params) => {
308 shop_ids: params.shopIds, 308 shop_ids: params.shopIds,
309 uid: params.uid, 309 uid: params.uid,
310 }); 310 });
311 -} 311 +};
312 312
313 module.exports = { 313 module.exports = {
314 getChannelData, 314 getChannelData,
  315 + getChannelResource,
315 getChannelSwitchData, 316 getChannelSwitchData,
316 getBottomBannerData, 317 getBottomBannerData,
317 shopRecom, 318 shopRecom,
@@ -19,6 +19,7 @@ router.get('/boys', channel.switchChannel, channel.boys); @@ -19,6 +19,7 @@ router.get('/boys', channel.switchChannel, channel.boys);
19 router.get('/girls', channel.switchChannel, channel.girls); 19 router.get('/girls', channel.switchChannel, channel.girls);
20 router.get('/kids', channel.switchChannel, channel.kids); 20 router.get('/kids', channel.switchChannel, channel.kids);
21 router.get('/lifestyle', channel.switchChannel, channel.lifestyle); 21 router.get('/lifestyle', channel.switchChannel, channel.lifestyle);
  22 +router.get('/channel/getResourceContent', channel.getResourceContent);// 获取首页,其余频道楼层
22 23
23 router.get('/(:channel)/bottomBanner', channel.bottomBanner); 24 router.get('/(:channel)/bottomBanner', channel.bottomBanner);
24 25
@@ -31,5 +32,5 @@ router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删 @@ -31,5 +32,5 @@ router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删
31 32
32 // 5.2新楼层功能 33 // 5.2新楼层功能
33 router.post('/channel/shopRecom', channel.shopRecom); // 店铺推荐收藏状态 34 router.post('/channel/shopRecom', channel.shopRecom); // 店铺推荐收藏状态
34 -router.post('/channel/userVip', channel.userVip) 35 +router.post('/channel/userVip', channel.userVip);
35 module.exports = router; 36 module.exports = router;
@@ -6,7 +6,9 @@ @@ -6,7 +6,9 @@
6 {{/homeHeader}} 6 {{/homeHeader}}
7 7
8 {{! 资源位}} 8 {{! 资源位}}
9 - {{> channel/content}} 9 + <div class="resource-content">
  10 + {{> channel/content}}
  11 + </div>
10 12
11 {{! 商品列表}} 13 {{! 商品列表}}
12 {{#if twoColumnGoods}} 14 {{#if twoColumnGoods}}
  1 +
  2 +{{#content}}
  3 + {{! 头部banner}}
  4 + {{#if focus}}
  5 + {{> ../resources/banner-top}}
  6 + {{/if}}
  7 + {{! 图标入口}}
  8 + {{#if appIconList}}
  9 + {{> ../resources/icons-enter}}
  10 + {{/if}}
  11 + {{! 首页公告}}
  12 + {{!-- {{#announcement}}
  13 + {{> ../resources/notice}}
  14 + {{/announcement}} --}}
  15 + {{! 中间banner}}
  16 + {{#if singleImage}}
  17 + <div data-id="{{template_id}}">
  18 + {{> ../resources/banner}}
  19 + </div>
  20 + {{/if}}
  21 + {{! 两个小图}}
  22 + {{#if smallPic}}
  23 + {{> ../resources/thumb-row}}
  24 + {{/if}}
  25 + {{! 热门品类}}
  26 + {{#if recommendContentFive}}
  27 + {{> ../resources/hot-category}}
  28 + {{/if}}
  29 + {{! 热门品牌}}
  30 + {{#if appHotBrands}}
  31 + {{> ../resources/hot-brands-list}}
  32 + {{/if}}
  33 + {{! 热门品牌可滑动}}
  34 + {{#if customBrands}}
  35 + {{> ../resources/hot-brands-swipe}}
  36 + {{/if}}
  37 + {{! 潮人搭配}}
  38 + {{#if trendsetterCollocation}}
  39 + {{> ../resources/trendsetter-collocation}}
  40 + {{/if}}
  41 + {{! 潮流话题}}
  42 + {{#if trendgoodsTopic}}
  43 + {{> ../resources/trend-topics}}
  44 + {{/if}}
  45 + {{! 潮流时装/经典裤裙/时尚靴履/潮人配饰/潮流上装}}
  46 + {{#if recommendContentOne}}
  47 + {{> ../resources/goods-category}}
  48 + {{/if}}
  49 + {{! 新入住品牌/品味生活/创意生活}}
  50 + {{#if recommendContentTwo}}
  51 + {{> ../resources/creative-life}}
  52 + {{/if}}
  53 + {{! PLUS}}
  54 + {{#if singleNameImage}}
  55 + {{> ../resources/plus-star}}
  56 + {{/if}}
  57 + {{! 新人专享}}
  58 + {{#if oldNewUserFloor}}
  59 + {{> ../resources/fresh-only}}
  60 + {{/if}}
  61 + {{! 秒杀}}
  62 + {{#if seckill}}
  63 + {{> ../resources/seckill}}
  64 + {{/if}}
  65 + {{! 标题楼层}}
  66 + {{#if titleFloor}}
  67 + {{> ../resources/title-floor}}
  68 + {{/if}}
  69 + {{! 直播楼层}}
  70 + {{#if livePicture}}
  71 + {{> ../resources/live-picture}}
  72 + {{/if}}
  73 + {{! 六层图}}
  74 + {{#if sixLinesFloor}}
  75 + {{> ../resources/six-lines-floor}}
  76 + {{/if}}
  77 + {{! vip专属}}
  78 + {{#if vipUse}}
  79 + {{> ../resources/vip-only}}
  80 + {{/if}}
  81 + {{! 店铺推荐}}
  82 + {{#if shopRecommend}}
  83 + {{> ../resources/shop-recommand}}
  84 + {{/if}}
  85 + {{! 新新人专享}}
  86 + {{#if newUserFloor}}
  87 + {{> ../resources/new-user-floor}}
  88 + {{/if}}
  89 + {{! 人气单品}}
  90 + {{#if popularSingleProduct}}
  91 + {{> ../resources/hot-single}}
  92 + {{/if}}
  93 + {{! SALE}}
  94 + {{#if sale1T1L4R}}
  95 + {{> ../resources/sale-floor}}
  96 + {{/if}}
  97 + {{! 新品首发楼层}}
  98 + {{#if newProductFloor}}
  99 + {{> ../resources/new-first}}
  100 + {{/if}}
  101 + {{! 分隔楼层}}
  102 + {{#if divideImage}}
  103 + {{> ../resources/divide-image}}
  104 + {{/if}}
  105 +{{/content}}
  1 +{{# title}}
  2 +<div class="floor-header-more">
  3 + <h2>{{#if title}}{{title}}{{else}}{{name}}{{/if}}</h2>
  4 + {{#if more_url}}
  5 + <a class="more-btn iconfont" href="{{more_url}}">&#xe618;</a>
  6 + {{/if}}
  7 +</div>
  8 +{{/ title}}
  1 +{{#title}}
  2 +<div class="floor-header">
  3 + <h2>{{title}}</h2>
  4 +</div>
  5 +{{/title}}
  1 +<div class="banner-center banner-center-swiper">
  2 + {{#if singleOne}}
  3 + {{#data}}
  4 + <div class="banner-list">
  5 + <a href="{{url}}">
  6 + <img src="{{image src 640 200}}" alt="">
  7 + </a>
  8 + </div>
  9 + {{/data}}
  10 + {{else}}
  11 + <ul class="banner-list swiper-wrapper clearfix">
  12 + {{#data}}
  13 + <li class="swiper-slide">
  14 + <a href="{{url}}">
  15 + <img src="{{image src 640 200}}" alt="">
  16 + </a>
  17 + </li>
  18 + {{/data}}
  19 + </ul>
  20 + {{/if}}
  21 + <div class="swiper-pagination" {{#unless singleOne}}style="display:block"{{/unless}}>
  22 + <div class="pagination-inner">
  23 + </div>
  24 + </div>
  25 +</div>
  1 +{{#data}}
  2 + {{> ../common/floor-header-more}}
  3 + <div class="creative-life">
  4 + {{# big_image}}
  5 + <a class="banner" href="{{url}}">
  6 + <img class="lazy" data-original="{{image src 640 403}}">
  7 + </a>
  8 + {{/ big_image}}
  9 + <ul class="classify-list clearfix">
  10 + {{# list}}
  11 + <li class="classify">
  12 + <a href="{{url}}">
  13 + <div class="classify-logo">
  14 + <img class="lazy" data-original="{{image src 191 191}}">
  15 + </div>
  16 + <p class="classify-name">{{title}}</p>
  17 + </a>
  18 + </li>
  19 + {{/ list}}
  20 + </ul>
  21 + </div>
  22 +{{/data}}
  1 +{{#data}}
  2 + <div style="background-image:url({{src}})" class="divide-image"></div>
  3 +{{/data}}
  1 +{{#data}}
  2 + {{> ../common/floor-header-more}}
  3 + <div class="fresh-only">
  4 + {{# banner_image}}
  5 + <div class="fresh-swiper">
  6 + <a href="{{url}}">
  7 + <img class="lazy" data-original="{{image src 640 200}}">
  8 + </a>
  9 + </div>
  10 + {{/ banner_image}}
  11 + <div class="fresh-list-swiper">
  12 + <ul class="clearfix swiper-wrapper">
  13 + {{# list}}
  14 + <li class="swiper-slide">
  15 + <div class="img-box">
  16 + <a href="{{url}}">
  17 + <img class="swiper-lazy" data-src="{{image default_images 235 314}}" alt="">
  18 + </a>
  19 + <div class="swiper-lazy-preloader"></div>
  20 + </div>
  21 + <div class="fresh-info">
  22 + <p class="fresh-name"><a href="{{url}}">{{product_name}}</a></p>
  23 + <p class="price">
  24 + <span class="cur-price">¥{{sales_price}}</span>
  25 + {{# market_price}}
  26 + <span class="old-price">¥{{.}}</span>
  27 + {{/market_price}}
  28 + </p>
  29 + <span class="fresh-icon">新人价</span>
  30 + </div>
  31 + </li>
  32 + {{/ list}}
  33 + </ul>
  34 + </div>
  35 + </div>
  36 +{{/data}}
  1 +{{#data}}
  2 + {{> ../common/floor-header-more}}
  3 + <div class="goods-category">
  4 + {{# big_image}}
  5 + {{#if bigList}}
  6 + <div class="category-swiper">
  7 + <ul class="swiper-wrapper">
  8 + {{# bigList}}
  9 + <li class="swiper-slide">
  10 + <a href="{{url}}">
  11 + <img class="lazy" data-original="{{image src 640 403}}" alt="{{title}}">
  12 + </a>
  13 + </li>
  14 + {{/ bigList}}
  15 + </ul>
  16 + <div class="swiper-pagination">
  17 + <div class="pagination-inner clearfix">
  18 + </div>
  19 + </div>
  20 + </div>
  21 + {{^}}
  22 + <div class="category-swiper">
  23 + <a href="{{url}}">
  24 + <img class="lazy" data-original="{{image src 640 403}}" alt="{{title}}">
  25 + </a>
  26 + </div>
  27 + {{/if}}
  28 + {{/ big_image}}
  29 + {{#if list}}
  30 + <ul class="category-list clearfix">
  31 + {{# list}}
  32 + <li>
  33 + <a href="{{url}}">
  34 + <div class="img-box">
  35 + {{#if @first}}
  36 + <img class="lazy" data-original="{{image src 258 383}}" alt="">
  37 + {{^}}
  38 + <img class="lazy" data-original="{{image src 191 191}}" alt="">
  39 + {{/if}}
  40 + </div>
  41 + <p class="category-name">{{title}}</p>
  42 + </a>
  43 + </li>
  44 + {{/ list}}
  45 + </ul>
  46 + {{/if}}
  47 + </div>
  48 +{{/data}}
  1 +{{#data}}
  2 + <ul class="hot-brands clearfix">
  3 + {{> ../common/floor-header-more}}
  4 + {{# list}}
  5 + <li class="brand">
  6 + <a href="{{url}}">
  7 + <div class="brand-logo">
  8 + {{!--此处不使用 Lazyload 是由于安卓 UC 10 版本加载不出来--}}
  9 + <img src="{{image src 158 174}}">
  10 + </div>
  11 + <p class="brand-name">{{name}}</p>
  12 + </a>
  13 + </li>
  14 + {{/ list}}
  15 +
  16 + <li class="more">
  17 + <a class="{{#unless image.src}}default{{/unless}}" href="{{image.url}}">
  18 + <img src="{{image image.src 320 172}}">
  19 + </a>
  20 + </li>
  21 + </ul>
  22 +{{/data}}
  1 +{{#data}}
  2 + <div class="hot-brands">
  3 + {{> ../common/floor-header}}
  4 + <div class="brands-swiper">
  5 + <ul class="brands-list swiper-wrapper clearfix">
  6 + {{# list}}
  7 + <li class="swiper-slide">
  8 + <a href="{{url}}">
  9 + <img src="{{image src 140 140}}" alt="">
  10 + <span class="brands-title">{{name}}</span>
  11 + </a>
  12 + </li>
  13 + {{/ list}}
  14 + </ul>
  15 + </div>
  16 + </div>
  17 +{{/data}}
  1 +{{#data}}
  2 + <div class="hot-category">
  3 + {{> ../common/floor-header-more}}
  4 +
  5 + {{# banner}}
  6 + <a class="category-banner" href="{{url}}">
  7 + <img class="lazy" data-original="{{src}}">
  8 + </a>
  9 + {{/ banner}}
  10 + <ul class="category-list clearfix">
  11 + {{# list}}
  12 + <li>
  13 + <a href="{{url}}">
  14 + <div class="img-box">
  15 + <img class="lazy" data-original="{{image src 140 140}}" alt="">
  16 + </div>
  17 + </a>
  18 + </li>
  19 + {{/ list}}
  20 + </ul>
  21 + </div>
  22 +{{/data}}
  1 +{{#data}}
  2 +<div class="hot-single">
  3 + {{> ../common/floor-header-more}}
  4 + {{> ./new-floor-banner}}
  5 + <div class="hot-single-goods-list" {{#background}}style="background-image: url({{src}})"{{/background}}>
  6 + <ul>
  7 + {{#list}}
  8 + <li class="hot-single-goods">
  9 + <a href="//m.yohobuy.com/product/show_{{product_skn}}">
  10 + <img src="{{image default_images 153 206}}" alt="goods" class="goods-pic">
  11 + <div class="goods-info">
  12 + <h3 class="price">&yen; {{sales_price}}</h3>
  13 + <p class="view-num">{{view_num}}</p>
  14 + <p class="view-status">正在浏览</p>
  15 + </div>
  16 + </a>
  17 + </li>
  18 + {{/list}}
  19 + <!--<li class="hot-single-goods">
  20 + <img src="" alt="goods" class="goods-pic">
  21 + <div class="goods-info">
  22 + <h3 class="price">&yen; 188.00</h3>
  23 + <p class="view-num">22人</p>
  24 + <p class="view-status">已加入收藏</p>
  25 + </div>
  26 + </li>
  27 + <li class="hot-single-goods">
  28 + <img src="" alt="goods" class="goods-pic">
  29 + <div class="goods-info">
  30 + <h3 class="price">&yen; 188.00</h3>
  31 + <img src="" alt="little-head-icon" class="head-icon">
  32 + <p class="view-num view-margin">大大王</p>
  33 + <p class="view-status view-margin">10分钟前购买</p>
  34 + </div>
  35 + </li>
  36 + <li class="hot-single-goods">
  37 + <img src="" alt="goods" class="goods-pic">
  38 + <div class="goods-info">
  39 + <h3 class="price">&yen; 188.00</h3>
  40 + <p class="view-num">12人</p>
  41 + <p class="view-status">正在浏览</p>
  42 + </div>
  43 + </li>
  44 + <li class="hot-single-goods">
  45 + <img src="" alt="goods" class="goods-pic">
  46 + <div class="goods-info">
  47 + <h3 class="price">&yen; 188.00</h3>
  48 + <p class="view-num">22人</p>
  49 + <p class="view-status">已加入收藏</p>
  50 + </div>
  51 + </li>
  52 + <li class="hot-single-goods">
  53 + <img src="" alt="goods" class="goods-pic">
  54 + <div class="goods-info">
  55 + <h3 class="price">&yen; 188.00</h3>
  56 + <img src="" alt="little-head-icon" class="head-icon">
  57 + <p class="view-num view-margin">大大王</p>
  58 + <p class="view-status view-margin">10分钟前购买</p>
  59 + </div>
  60 + </li>-->
  61 + </ul>
  62 + </div>
  63 +</div>
  64 +{{/data}}
  1 +{{#appIconList}}
  2 +<div class="icons-wrapper" style="background-image:url({{back_image}})">
  3 + <ul class="icons-list clearfix">
  4 + {{#data}}
  5 + <li class="icons-item item-{{../number}}"><a href="{{url}}" class="imagebar"><img src="{{image src 98 98}}" alt=""></a><a href="{{url}}" class="linkbar">{{title}}</a></li>
  6 + {{/data}}
  7 + </ul>
  8 +</div>
  9 +{{/appIconList}}
  1 +{{> ./title-floor}}
  2 +{{> ./three-picture}}
  1 +{{#data}}
  2 +<div class="new-first clearfix">
  3 + {{> ../common/floor-header-more}}
  4 + {{#list.[0]}}
  5 + <a href="{{url}}" class="float-container">
  6 + <img src="{{image src 268 360}}" alt="left" class="left" />
  7 + </a>
  8 + {{/list.[0]}}
  9 + {{#list.[1]}}
  10 + <a href="{{url}}" class="float-container">
  11 + <img src="{{image src 186 180}}" alt="right1" class="right" />
  12 + </a>
  13 + {{/list.[1]}}
  14 + {{#list.[2]}}
  15 + <a href="{{url}}" class="float-container">
  16 + <img src="{{image src 186 180}}" alt="right2" class="right" />
  17 + </a>
  18 + {{/list.[2]}}
  19 + {{#list.[3]}}
  20 + <a href="{{url}}" class="float-container">
  21 + <img src="{{image src 186 180}}" alt="right3" class="right" />
  22 + </a>
  23 + {{/list.[3]}}
  24 + {{#list.[4]}}
  25 + <a href="{{url}}" class="float-container">
  26 + <img src="{{image src 186 180}}" alt="right4" class="right" />
  27 + </a>
  28 + {{/list.[4]}}
  29 +</div>
  30 +{{/data}}
  1 +<div class="banner-center banner-center-swiper" style="border: 0;">
  2 + {{#if banner_image.[1]}}
  3 + <ul class="banner-list swiper-wrapper clearfix">
  4 + {{#banner_image}}
  5 + <li class="swiper-slide">
  6 + <a href="{{url}}">
  7 + <img src="{{image src 640 200}}" alt="">
  8 + </a>
  9 + </li>
  10 + {{/banner_image}}
  11 + </ul>
  12 + {{else}}
  13 + {{#banner_image}}
  14 + <div class="banner-list">
  15 + <a href="{{url}}">
  16 + <img src="{{image src 640 200}}" alt="">
  17 + </a>
  18 + </div>
  19 + {{/banner_image}}
  20 + {{/if}}
  21 + <div class="swiper-pagination" {{#if banner_image.[1]}}style="display:block"{{/if}}>
  22 + <div class="pagination-inner">
  23 + </div>
  24 + </div>
  25 +</div>
  1 +{{#data}}
  2 +<div class="new-user-floor">
  3 + {{> ../common/floor-header-more}}
  4 + <div class="new-user-icon">新人专享</div>
  5 + {{> ./new-floor-banner}}
  6 + <div class="new-user-goods-container" {{#background}} style="background-image: url({{src}})" {{/background}}>
  7 + <ul>
  8 + {{#list}}
  9 + <li class="new-user-good">
  10 + <a href="//m.yohobuy.com/product/show_{{product_skn}}">
  11 + <img src="{{image default_images 128 171}}" alt="goods-pic" class="goods-pic" />
  12 + <div class="goods-info">
  13 + <h3 class="title">{{product_name}}</h3>
  14 + <p class="price">&yen; {{sales_price}}</p>
  15 + <p class="buy-now">立即购买></p>
  16 + </div>
  17 + </a>
  18 + </li>
  19 + {{/list}}
  20 + </ul>
  21 + </div>
  22 +</div>
  23 +{{/data}}
  1 +<div class="notice-wrap clearfix">
  2 + <div class="trend">
  3 + </div>
  4 + <div class="notice" data-time="{{time}}">
  5 + {{#data}}
  6 + <a class="notice-item item-{{@index}}" href="{{url}}">
  7 + <span class="notice-icon"></span>
  8 + {{title}}
  9 + </a>
  10 + {{/data}}
  11 + </div>
  12 +</div>
  1 +{{#data}}
  2 + <div class="plus-star">
  3 + {{> ../common/floor-header}}
  4 + <a href="{{url}}">
  5 + <img class="lazy" data-original="{{image src 640 198}}">
  6 + </a>
  7 + </div>
  8 +{{/data}}
  1 +{{#data}}
  2 +<div class="sale-floor clearfix">
  3 + {{> ../common/floor-header-more}}
  4 + {{> ./new-floor-banner }}
  5 +
  6 + {{#list.[0]}}
  7 + <a href="{{url}}" class="float-container time-floor">
  8 + <img src="{{image src 269 360}}" alt="sale-limit" class="sale-floor-limit">
  9 + <div class="sale-floor-time" data-time={{end_time}}>
  10 + <p class="limit-title"><i class="icon"></i>限时特卖</p>
  11 + <div class="limit">
  12 + <span class="hour">00</span>:
  13 + <span class="minute">00</span>:
  14 + <span class="second">00</span>
  15 + </div>
  16 + </div>
  17 + </a>
  18 + {{/list.[0]}}
  19 +
  20 + {{#list.[1]}}
  21 + <a href="{{url}}" class="float-container">
  22 + <img src="{{image src 284 180}}" alt="sale-break" class="sale-floor-break">
  23 + </a>
  24 + {{/list.[1]}}
  25 + {{#list.[2]}}
  26 + <a href="{{url}}" class="sale-floor-entry">
  27 + <img src="{{image src 87 180}}" alt="sale-break" >
  28 + </a>
  29 + {{/list.[2]}}
  30 + {{#list.[3]}}
  31 + <a href="{{url}}" class="float-container">
  32 + <img src="{{image src 284 180}}" alt="sale-discount" class="sale-floor-discount">
  33 + </a>
  34 + {{/list.[3]}}
  35 + {{#list.[4]}}
  36 + <a href="{{url}}" class="sale-floor-entry">
  37 + <img src="{{image src 87 180}}" alt="sale-break" >
  38 + </a>
  39 + {{/list.[4]}}
  40 +</div>
  41 +{{/data}}
  1 +{{#data}}
  2 + {{> ../common/floor-header-more}}
  3 + <div class="seckill">
  4 + <div class="seckill-times">
  5 + <ul>
  6 + <li class="time-item">
  7 + <div class="normal">
  8 + <p class="time">12:00</p>
  9 + <p>已开抢</p>
  10 + </div>
  11 + <div class="selected">
  12 + <p class="time"><span>12:00</span>已开抢</p>
  13 + <p>还有商品可以继续抢购哦!</p>
  14 + </div>
  15 + </li>
  16 + <li class="time-item foucs">
  17 + <div class="normal">
  18 + <p class="time">15:00</p>
  19 + <p>抢购中</p>
  20 + </div>
  21 + <div class="selected">
  22 + <p class="time"><span>15:00</span>抢购中</p>
  23 + <p>剩余:<i class="hour">02</i><i class="minute">02</i><i class="second">02</i></p>
  24 + </div>
  25 + </li>
  26 + <li class="time-item">
  27 + <div class="normal">
  28 + <p class="time">15:00</p>
  29 + <p>即将开抢</p>
  30 + </div>
  31 + <div class="selected">
  32 + <p class="time"><span>15:00</span>即将开抢</p>
  33 + <p>距开抢:<i class="hour">02</i><i class="minute">02</i><i class="second">02</i></p>
  34 + </div>
  35 + </li>
  36 + </ul>
  37 + </div>
  38 + <div class="seckill-products">
  39 +
  40 + </div>
  41 + </div>
  42 +{{/data}}
  1 +{{#data}}
  2 +<div class="shop-recom">
  3 + {{#if title}}
  4 + {{> ../common/floor-header-more}}
  5 + {{/if}}
  6 + <div class="shop-recom-container shop-recom-swiper-container">
  7 + <ul class="swiper-wrapper">
  8 + {{#list}}
  9 + <li class="swiper-slide recom-shop" shopId={{shopId}}>
  10 + <div class="shop-top"></div>
  11 + <div class="fav-container fav-no">
  12 + <div class="shop-notfav"></div><span>收藏</span>
  13 + </div>
  14 + <div class="fav-container fav-yes" style="display:none">
  15 + <div class="shop-fav"></div><span>已收藏</span>
  16 + </div>
  17 + <span class="faved-num"></span>
  18 + <a href="{{url}}">
  19 + <img src="{{image src 362 174}}" alt="banner" class="top">
  20 + </a>
  21 + {{#goods0}}
  22 + <a href="{{url}}">
  23 + <div class="bottom left">
  24 + <img src="{{image src 138 183}}" alt="left">
  25 + </div>
  26 + </a>
  27 + {{/goods0}}
  28 + {{#goods1}}
  29 + <a href="{{url}}">
  30 + <div class="bottom right">
  31 + <img src="{{image src 138 183}}" alt="right">
  32 + </div>
  33 + </a>
  34 + {{/goods1}}
  35 + </li>
  36 + {{/list}}
  37 + </ul>
  38 + </div>
  39 +</div>
  40 +{{/data}}
  1 +{{#data}}
  2 + <div class="best-week">
  3 + {{> ../common/floor-header-more}}
  4 +
  5 + <ul class="six-lines-floor clearfix">
  6 + {{# list}}
  7 + <li>
  8 + <a href="{{url}}">
  9 + <div class="img-box">
  10 + <img class="lazy" data-original="{{image src 320 154}}" alt="">
  11 + </div>
  12 + </a>
  13 + </li>
  14 + {{/ list}}
  15 + </ul>
  16 + </div>
  17 +{{/data}}
  1 +{{#data}}
  2 +<div class="three-picture clearfix">
  3 + {{#list}}
  4 + <a href="{{url}}">
  5 + <img src="{{image src 210 280}}">
  6 + </a>
  7 + {{/list}}
  8 +</div>
  9 +{{/data}}
  1 +<div class="thumb-row">
  2 + {{# data}}
  3 + <a href="{{url}}">
  4 + <div class="thumb-row-box" style="background-image:url({{image src 275 160}})"></div>
  5 + </a>
  6 + {{/ data}}
  7 +</div>
  1 +{{#data}}
  2 +{{> ../common/floor-header-more}}
  3 +{{/data}}
  1 +{{#data}}
  2 + <div class="trend-topic-wrapper">
  3 + {{> ../common/floor-header-more}}
  4 + <div class="trend-topic-content">
  5 + <div class="trend-topic-swiper">
  6 + <ul class="swiper-wrapper">
  7 + {{# list}}
  8 + <li class="swiper-slide">
  9 + <a href="{{url}}">
  10 + <div class="img-box">
  11 + <img class="lazy" data-original="{{image src 580 360}}" src="{{image src 580 360}}" alt="">
  12 + </div>
  13 + <div class="item-content">
  14 + <p class="title">{{title}}</p>
  15 + <p class="time">
  16 + <span class="iconfont time-icon">&#xe603;</span>
  17 + <span>{{publish_time}}</span>
  18 + </p>
  19 + </div>
  20 + </a>
  21 + </li>
  22 + {{/ list}}
  23 + </ul>
  24 + </div>
  25 + <div class="swiper-pagination">
  26 + <div class="pagination-inner clearfix">
  27 + </div>
  28 + </div>
  29 + </div>
  30 + </div>
  31 +{{/data}}
  1 +{{#data}}
  2 + <div class="trend-coll-wrapper">
  3 + {{> ../common/floor-header-more}}
  4 + <div class="trend-coll-content clearfix">
  5 + {{# article}}
  6 + <div class="lspan">
  7 + <a href="{{url}}"><img class="lazy rspanimg" data-original="{{image src 400 400}}" ></a>
  8 + </div>
  9 + {{/ article}}
  10 + </div>
  11 + <div class="trend-coll-tail">
  12 + <h3 class="recommend-title">推荐搭配</h3>
  13 + <div class="recommend-swiper">
  14 + <ul class="recommend-list swiper-wrapper clearfix">
  15 + {{# recommend_collocation}}
  16 + <li class="recommend-item swiper-slide"><a href="{{url}}"><img class="img" src="{{image src 140 140}}" alt="" /></a></li>
  17 + {{/ recommend_collocation}}
  18 + </ul>
  19 + </div>
  20 + </div>
  21 + </div>
  22 +{{/data}}
  23 +
  24 +
  1 +{{#data}}
  2 +<div class="vip-only">
  3 + {{> ../common/floor-header-more}}
  4 +
  5 + {{> ./new-floor-banner}}
  6 +
  7 + <div class="vip-only-goods-list" {{#background}} style="background-image: url({{src}})" {{/background}}>
  8 + <ul>
  9 + {{#list}}
  10 + <a href="//m.yohobuy.com/product/show_{{product_skn}}">
  11 + <li class="vip-only-goods">
  12 + <img src="{{image default_images 153 206}}" alt="goods" class="goods-pic">
  13 + <div class="goods-info">
  14 + <p class="vip-price vip1">&yen; {{vip1_price}}</p>
  15 + <p class="vip-price vip2">&yen; {{vip2_price}}</p>
  16 + <p class="vip-price vip3">&yen; {{vip3_price}}</p>
  17 + <p class="sale-price">&yen; {{market_price}} <span class="vip-icon"></span></p>
  18 + </div>
  19 + </li>
  20 + </a>
  21 + {{/list}}
  22 + </ul>
  23 + </div>
  24 +</div>
  25 +{{/data}}
@@ -15,10 +15,13 @@ var $mobileWrap = $('.mobile-wrap'), @@ -15,10 +15,13 @@ var $mobileWrap = $('.mobile-wrap'),
15 $sideNav = $('.side-nav'), 15 $sideNav = $('.side-nav'),
16 $subNav = $('.sub-nav'), 16 $subNav = $('.sub-nav'),
17 $logotrans = $('.home-header .logo'), 17 $logotrans = $('.home-header .logo'),
  18 + $resourceContent = $('.resource-content'),
18 start = 0, 19 start = 0,
19 swiperClass, 20 swiperClass,
20 isen = true; 21 isen = true;
21 22
  23 +var channelContentHbs = require('channel/content.hbs');
  24 +
22 var C_ID; 25 var C_ID;
23 26
24 require('../common'); 27 require('../common');
@@ -123,6 +126,25 @@ if ($('.banner-center-swiper').find('li').size() > 1) { @@ -123,6 +126,25 @@ if ($('.banner-center-swiper').find('li').size() > 1) {
123 }); 126 });
124 } 127 }
125 128
  129 +// 异步获取首屏其余楼层
  130 +var getResourceContent = function() {
  131 + $.ajax({
  132 + type: 'GET',
  133 + url: '/channel/getResourceContent',
  134 + async: false,//改为false,否则下面初始化会找不到元素对象
  135 + data: {
  136 + gender: $mobileWrap.data('channel')
  137 + },
  138 + }).then(function(result) {
  139 + var resourceTemplate = channelContentHbs({content: result});
  140 +
  141 + $resourceContent.append(resourceTemplate);
  142 + lazyLoad($(resourceTemplate).find('img.lazy'));
  143 + });
  144 +};
  145 +
  146 +getResourceContent();
  147 +
126 // 热门品牌滑动 148 // 热门品牌滑动
127 new Swiper('.brands-swiper', { 149 new Swiper('.brands-swiper', {
128 grabCursor: true, 150 grabCursor: true,
@@ -231,17 +253,19 @@ window.setCookie('_Channel', $mobileWrap.data('channel'), { @@ -231,17 +253,19 @@ window.setCookie('_Channel', $mobileWrap.data('channel'), {
231 }); 253 });
232 254
233 // 店铺推荐滑动效果 255 // 店铺推荐滑动效果
234 -  
235 -var shopSwiper = new Swiper('.shop-recom-swiper-container', {  
236 - centeredSlides: true,  
237 - slidesPerView: 'auto',  
238 - paginationClickable: true,  
239 - slideActiveClass: 'recom-active',  
240 -}); 256 +if ($('.shop-recom-swiper-container').find('li') > 1) {
  257 + new Swiper('.shop-recom-swiper-container', {
  258 + centeredSlides: true,
  259 + slidesPerView: 'auto',
  260 + paginationClickable: true,
  261 + slideActiveClass: 'recom-active',
  262 + });
  263 +}
241 264
242 // 店铺推荐人数和收藏初始查询 265 // 店铺推荐人数和收藏初始查询
243 var checkShop = function() { 266 var checkShop = function() {
244 var shopIds = []; 267 var shopIds = [];
  268 +
245 $('.recom-shop').each(function() { 269 $('.recom-shop').each(function() {
246 shopIds.push($(this).attr('shopId')); 270 shopIds.push($(this).attr('shopId'));
247 }); 271 });
@@ -256,6 +280,7 @@ var checkShop = function() { @@ -256,6 +280,7 @@ var checkShop = function() {
256 for (var i = 0, elem; 280 for (var i = 0, elem;
257 (elem = result.data[i]) != null; i++) { 281 (elem = result.data[i]) != null; i++) {
258 var a = $('.recom-shop[shopId = ' + elem.id + ']'); 282 var a = $('.recom-shop[shopId = ' + elem.id + ']');
  283 +
259 a.find('.faved-num').text(elem.collectionNum + '人已收藏'); 284 a.find('.faved-num').text(elem.collectionNum + '人已收藏');
260 if (elem.favorite) { 285 if (elem.favorite) {
261 a.find('.fav-no').hide(); 286 a.find('.fav-no').hide();
@@ -265,10 +290,12 @@ var checkShop = function() { @@ -265,10 +290,12 @@ var checkShop = function() {
265 } 290 }
266 }); 291 });
267 }; 292 };
  293 +
268 checkShop(); 294 checkShop();
269 295
270 // 店铺收藏 || 取消收藏 296 // 店铺收藏 || 取消收藏
271 var $collect = $('.fav-container'); 297 var $collect = $('.fav-container');
  298 +
272 $collect.on('touchstart', function() { 299 $collect.on('touchstart', function() {
273 var opt = $(this).hasClass('fav-yes') ? 'cancel' : 'ok'; 300 var opt = $(this).hasClass('fav-yes') ? 'cancel' : 'ok';
274 var self = $(this); 301 var self = $(this);
@@ -312,7 +339,6 @@ $collect.on('touchstart', function() { @@ -312,7 +339,6 @@ $collect.on('touchstart', function() {
312 }, 339 },
313 error: function() { 340 error: function() {
314 tip.show('网络断开连接了~'); 341 tip.show('网络断开连接了~');
315 - searching = false;  
316 } 342 }
317 }); 343 });
318 }); 344 });
@@ -320,12 +346,13 @@ $collect.on('touchstart', function() { @@ -320,12 +346,13 @@ $collect.on('touchstart', function() {
320 // vip专属等级查询 346 // vip专属等级查询
321 $.ajax({ 347 $.ajax({
322 method: 'POST', 348 method: 'POST',
323 - url: location.protocol + '//m.yohobuy.com' + '/channel/userVip', 349 + url: location.protocol + '//m.yohobuy.com/channel/userVip',
324 data: { 350 data: {
325 channel: 1, 351 channel: 1,
326 }, 352 },
327 success: function(data) { 353 success: function(data) {
328 var vip = $('.vip-only'); 354 var vip = $('.vip-only');
  355 +
329 if (data.code === 200 && Number(data.current_vip_level) !== 0) { 356 if (data.code === 200 && Number(data.current_vip_level) !== 0) {
330 vip.show(); 357 vip.show();
331 vip.find('.vip' + data.current_vip_level).show(); 358 vip.find('.vip' + data.current_vip_level).show();
@@ -333,7 +360,6 @@ $.ajax({ @@ -333,7 +360,6 @@ $.ajax({
333 }, 360 },
334 error: function() { 361 error: function() {
335 tip.show('网络断开连接了~'); 362 tip.show('网络断开连接了~');
336 - searching = false;  
337 } 363 }
338 }); 364 });
339 365
@@ -342,9 +368,10 @@ var saleTime = function(elem, offsetTime) { @@ -342,9 +368,10 @@ var saleTime = function(elem, offsetTime) {
342 var hour = parseInt(offsetTime / (60 * 60), 10), 368 var hour = parseInt(offsetTime / (60 * 60), 10),
343 minute = parseInt(offsetTime % (60 * 60) / 60, 10), 369 minute = parseInt(offsetTime % (60 * 60) / 60, 10),
344 second = offsetTime % 60; 370 second = offsetTime % 60;
345 - if (offsetTime <= -1) { // 结束倒计时刷新状态  
346 - $(elem).find('.limit').hide();  
347 - } 371 +
  372 + if (offsetTime <= -1) { // 结束倒计时刷新状态
  373 + $(elem).find('.limit').hide();
  374 + }
348 375
349 if (offsetTime >= -1) { 376 if (offsetTime >= -1) {
350 $(elem).find('.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour)); 377 $(elem).find('.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour));