Authored by 郝肖肖

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

... ... @@ -32,7 +32,8 @@ let _renderData = {
let _channelPage = (req, res, data) => {
return channelModel.getChannelData({
gender: data.gender,
uid: _.toString(req.user.uid)
uid: _.toString(req.user.uid),
limit: 6// 首屏先获取前6个楼层,其余用ajax获取
}).then(result => {
_renderData.homeHeader.defaultTerms = result.defaultTerms;
... ... @@ -56,6 +57,24 @@ let _channelPage = (req, res, data) => {
};
/**
* 获取首页频道其余楼层
*/
let getResourceContent = (req, res, next) => {
return channelModel.getChannelResource({
gender: req.query.gender,
uid: _.toString(req.user.uid),
}).then(result => {
if (result.length) {
result = result.slice(6);
}
res.json(result);
}).catch(next);
};
/**
* 频道选择页
*/
let index = (req, res, next) => {
... ... @@ -163,7 +182,7 @@ let shopRecom = (req, res, next) => {
}).then(result => {
res.send(result);
}).catch(next);
}
};
/**
* 获取用户vip信息
... ... @@ -187,12 +206,12 @@ let userVip = (req, res, next) => {
res.json({
code: 500,
msg: '出错了',
})
});
}
});
}).catch(next);
}
}
};
module.exports = {
switchChannel,
... ... @@ -204,4 +223,5 @@ module.exports = {
bottomBanner,
shopRecom,
userVip,
};
\ No newline at end of file
getResourceContent
};
... ...
... ... @@ -114,14 +114,14 @@ const _processSideBar = (list, choosed) => {
* @param {[object]} gender
* @return {[type]}
*/
const _getChannelResource = (params) => {
const getChannelResource = (params) => {
params.gender = params.gender || 'boys';
params.limit = params.limit || 30;
params = Object.assign(params, {
gender: genderData[params.gender] || '1,2,3',
content_code: contentCode[params.gender], // eslint-disable-line
page: 1,
limit: 30
page: 1
});
if (!params.uid) {
params.new_device = true; // eslint-disable-line
... ... @@ -269,7 +269,7 @@ let getChannelData = (params) => {
var channelData = {};
let navGender = _.cloneDeep(params.gender);
return Promise.all([_getChannelResource(params), _getLeftNav(navGender), _getSearchIndex()]).then((data) => {
return Promise.all([getChannelResource(params), _getLeftNav(navGender), _getSearchIndex()]).then((data) => {
channelData.content = data[0] || []; // 资源位数据
channelData.sideNav = data[1] || []; // 侧边栏数据
channelData.defaultTerms = (data[2] && data[2].defaultTerms && data[2].defaultTerms.length !== 0) ? data[2].defaultTerms[0].content : '搜索商品、品牌';
... ... @@ -308,10 +308,11 @@ let shopRecom = (params) => {
shop_ids: params.shopIds,
uid: params.uid,
});
}
};
module.exports = {
getChannelData,
getChannelResource,
getChannelSwitchData,
getBottomBannerData,
shopRecom,
... ...
... ... @@ -19,6 +19,7 @@ router.get('/boys', channel.switchChannel, channel.boys);
router.get('/girls', channel.switchChannel, channel.girls);
router.get('/kids', channel.switchChannel, channel.kids);
router.get('/lifestyle', channel.switchChannel, channel.lifestyle);
router.get('/channel/getResourceContent', channel.getResourceContent);// 获取首页,其余频道楼层
router.get('/(:channel)/bottomBanner', channel.bottomBanner);
... ... @@ -31,5 +32,5 @@ router.get('/brands/delBrandHistory', brandController.delBrandHistory); // 删
// 5.2新楼层功能
router.post('/channel/shopRecom', channel.shopRecom); // 店铺推荐收藏状态
router.post('/channel/userVip', channel.userVip)
router.post('/channel/userVip', channel.userVip);
module.exports = router;
... ...
... ... @@ -6,7 +6,9 @@
{{/homeHeader}}
{{! 资源位}}
{{> channel/content}}
<div class="resource-content">
{{> channel/content}}
</div>
{{! 商品列表}}
{{#if twoColumnGoods}}
... ...
{{#content}}
{{! 头部banner}}
{{#if focus}}
{{> ../resources/banner-top}}
{{/if}}
{{! 图标入口}}
{{#if appIconList}}
{{> ../resources/icons-enter}}
{{/if}}
{{! 首页公告}}
{{!-- {{#announcement}}
{{> ../resources/notice}}
{{/announcement}} --}}
{{! 中间banner}}
{{#if singleImage}}
<div data-id="{{template_id}}">
{{> ../resources/banner}}
</div>
{{/if}}
{{! 两个小图}}
{{#if smallPic}}
{{> ../resources/thumb-row}}
{{/if}}
{{! 热门品类}}
{{#if recommendContentFive}}
{{> ../resources/hot-category}}
{{/if}}
{{! 热门品牌}}
{{#if appHotBrands}}
{{> ../resources/hot-brands-list}}
{{/if}}
{{! 热门品牌可滑动}}
{{#if customBrands}}
{{> ../resources/hot-brands-swipe}}
{{/if}}
{{! 潮人搭配}}
{{#if trendsetterCollocation}}
{{> ../resources/trendsetter-collocation}}
{{/if}}
{{! 潮流话题}}
{{#if trendgoodsTopic}}
{{> ../resources/trend-topics}}
{{/if}}
{{! 潮流时装/经典裤裙/时尚靴履/潮人配饰/潮流上装}}
{{#if recommendContentOne}}
{{> ../resources/goods-category}}
{{/if}}
{{! 新入住品牌/品味生活/创意生活}}
{{#if recommendContentTwo}}
{{> ../resources/creative-life}}
{{/if}}
{{! PLUS}}
{{#if singleNameImage}}
{{> ../resources/plus-star}}
{{/if}}
{{! 新人专享}}
{{#if oldNewUserFloor}}
{{> ../resources/fresh-only}}
{{/if}}
{{! 秒杀}}
{{#if seckill}}
{{> ../resources/seckill}}
{{/if}}
{{! 标题楼层}}
{{#if titleFloor}}
{{> ../resources/title-floor}}
{{/if}}
{{! 直播楼层}}
{{#if livePicture}}
{{> ../resources/live-picture}}
{{/if}}
{{! 六层图}}
{{#if sixLinesFloor}}
{{> ../resources/six-lines-floor}}
{{/if}}
{{! vip专属}}
{{#if vipUse}}
{{> ../resources/vip-only}}
{{/if}}
{{! 店铺推荐}}
{{#if shopRecommend}}
{{> ../resources/shop-recommand}}
{{/if}}
{{! 新新人专享}}
{{#if newUserFloor}}
{{> ../resources/new-user-floor}}
{{/if}}
{{! 人气单品}}
{{#if popularSingleProduct}}
{{> ../resources/hot-single}}
{{/if}}
{{! SALE}}
{{#if sale1T1L4R}}
{{> ../resources/sale-floor}}
{{/if}}
{{! 新品首发楼层}}
{{#if newProductFloor}}
{{> ../resources/new-first}}
{{/if}}
{{! 分隔楼层}}
{{#if divideImage}}
{{> ../resources/divide-image}}
{{/if}}
{{/content}}
... ...
{{# title}}
<div class="floor-header-more">
<h2>{{#if title}}{{title}}{{else}}{{name}}{{/if}}</h2>
{{#if more_url}}
<a class="more-btn iconfont" href="{{more_url}}">&#xe618;</a>
{{/if}}
</div>
{{/ title}}
... ...
{{#title}}
<div class="floor-header">
<h2>{{title}}</h2>
</div>
{{/title}}
... ...
<div class="banner-center banner-center-swiper">
{{#if singleOne}}
{{#data}}
<div class="banner-list">
<a href="{{url}}">
<img src="{{image src 640 200}}" alt="">
</a>
</div>
{{/data}}
{{else}}
<ul class="banner-list swiper-wrapper clearfix">
{{#data}}
<li class="swiper-slide">
<a href="{{url}}">
<img src="{{image src 640 200}}" alt="">
</a>
</li>
{{/data}}
</ul>
{{/if}}
<div class="swiper-pagination" {{#unless singleOne}}style="display:block"{{/unless}}>
<div class="pagination-inner">
</div>
</div>
</div>
... ...
{{#data}}
{{> ../common/floor-header-more}}
<div class="creative-life">
{{# big_image}}
<a class="banner" href="{{url}}">
<img class="lazy" data-original="{{image src 640 403}}">
</a>
{{/ big_image}}
<ul class="classify-list clearfix">
{{# list}}
<li class="classify">
<a href="{{url}}">
<div class="classify-logo">
<img class="lazy" data-original="{{image src 191 191}}">
</div>
<p class="classify-name">{{title}}</p>
</a>
</li>
{{/ list}}
</ul>
</div>
{{/data}}
... ...
{{#data}}
<div style="background-image:url({{src}})" class="divide-image"></div>
{{/data}}
\ No newline at end of file
... ...
{{#data}}
{{> ../common/floor-header-more}}
<div class="fresh-only">
{{# banner_image}}
<div class="fresh-swiper">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 200}}">
</a>
</div>
{{/ banner_image}}
<div class="fresh-list-swiper">
<ul class="clearfix swiper-wrapper">
{{# list}}
<li class="swiper-slide">
<div class="img-box">
<a href="{{url}}">
<img class="swiper-lazy" data-src="{{image default_images 235 314}}" alt="">
</a>
<div class="swiper-lazy-preloader"></div>
</div>
<div class="fresh-info">
<p class="fresh-name"><a href="{{url}}">{{product_name}}</a></p>
<p class="price">
<span class="cur-price">¥{{sales_price}}</span>
{{# market_price}}
<span class="old-price">¥{{.}}</span>
{{/market_price}}
</p>
<span class="fresh-icon">新人价</span>
</div>
</li>
{{/ list}}
</ul>
</div>
</div>
{{/data}}
... ...
{{#data}}
{{> ../common/floor-header-more}}
<div class="goods-category">
{{# big_image}}
{{#if bigList}}
<div class="category-swiper">
<ul class="swiper-wrapper">
{{# bigList}}
<li class="swiper-slide">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 403}}" alt="{{title}}">
</a>
</li>
{{/ bigList}}
</ul>
<div class="swiper-pagination">
<div class="pagination-inner clearfix">
</div>
</div>
</div>
{{^}}
<div class="category-swiper">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 403}}" alt="{{title}}">
</a>
</div>
{{/if}}
{{/ big_image}}
{{#if list}}
<ul class="category-list clearfix">
{{# list}}
<li>
<a href="{{url}}">
<div class="img-box">
{{#if @first}}
<img class="lazy" data-original="{{image src 258 383}}" alt="">
{{^}}
<img class="lazy" data-original="{{image src 191 191}}" alt="">
{{/if}}
</div>
<p class="category-name">{{title}}</p>
</a>
</li>
{{/ list}}
</ul>
{{/if}}
</div>
{{/data}}
... ...
{{#data}}
<ul class="hot-brands clearfix">
{{> ../common/floor-header-more}}
{{# list}}
<li class="brand">
<a href="{{url}}">
<div class="brand-logo">
{{!--此处不使用 Lazyload 是由于安卓 UC 10 版本加载不出来--}}
<img src="{{image src 158 174}}">
</div>
<p class="brand-name">{{name}}</p>
</a>
</li>
{{/ list}}
<li class="more">
<a class="{{#unless image.src}}default{{/unless}}" href="{{image.url}}">
<img src="{{image image.src 320 172}}">
</a>
</li>
</ul>
{{/data}}
... ...
{{#data}}
<div class="hot-brands">
{{> ../common/floor-header}}
<div class="brands-swiper">
<ul class="brands-list swiper-wrapper clearfix">
{{# list}}
<li class="swiper-slide">
<a href="{{url}}">
<img src="{{image src 140 140}}" alt="">
<span class="brands-title">{{name}}</span>
</a>
</li>
{{/ list}}
</ul>
</div>
</div>
{{/data}}
\ No newline at end of file
... ...
{{#data}}
<div class="hot-category">
{{> ../common/floor-header-more}}
{{# banner}}
<a class="category-banner" href="{{url}}">
<img class="lazy" data-original="{{src}}">
</a>
{{/ banner}}
<ul class="category-list clearfix">
{{# list}}
<li>
<a href="{{url}}">
<div class="img-box">
<img class="lazy" data-original="{{image src 140 140}}" alt="">
</div>
</a>
</li>
{{/ list}}
</ul>
</div>
{{/data}}
\ No newline at end of file
... ...
{{#data}}
<div class="hot-single">
{{> ../common/floor-header-more}}
{{> ./new-floor-banner}}
<div class="hot-single-goods-list" {{#background}}style="background-image: url({{src}})"{{/background}}>
<ul>
{{#list}}
<li class="hot-single-goods">
<a href="//m.yohobuy.com/product/show_{{product_skn}}">
<img src="{{image default_images 153 206}}" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; {{sales_price}}</h3>
<p class="view-num">{{view_num}}</p>
<p class="view-status">正在浏览</p>
</div>
</a>
</li>
{{/list}}
<!--<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">22人</p>
<p class="view-status">已加入收藏</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<img src="" alt="little-head-icon" class="head-icon">
<p class="view-num view-margin">大大王</p>
<p class="view-status view-margin">10分钟前购买</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">12人</p>
<p class="view-status">正在浏览</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<p class="view-num">22人</p>
<p class="view-status">已加入收藏</p>
</div>
</li>
<li class="hot-single-goods">
<img src="" alt="goods" class="goods-pic">
<div class="goods-info">
<h3 class="price">&yen; 188.00</h3>
<img src="" alt="little-head-icon" class="head-icon">
<p class="view-num view-margin">大大王</p>
<p class="view-status view-margin">10分钟前购买</p>
</div>
</li>-->
</ul>
</div>
</div>
{{/data}}
\ No newline at end of file
... ...
{{#appIconList}}
<div class="icons-wrapper" style="background-image:url({{back_image}})">
<ul class="icons-list clearfix">
{{#data}}
<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>
{{/data}}
</ul>
</div>
{{/appIconList}}
... ...
{{> ./title-floor}}
{{> ./three-picture}}
... ...
{{#data}}
<div class="new-first clearfix">
{{> ../common/floor-header-more}}
{{#list.[0]}}
<a href="{{url}}" class="float-container">
<img src="{{image src 268 360}}" alt="left" class="left" />
</a>
{{/list.[0]}}
{{#list.[1]}}
<a href="{{url}}" class="float-container">
<img src="{{image src 186 180}}" alt="right1" class="right" />
</a>
{{/list.[1]}}
{{#list.[2]}}
<a href="{{url}}" class="float-container">
<img src="{{image src 186 180}}" alt="right2" class="right" />
</a>
{{/list.[2]}}
{{#list.[3]}}
<a href="{{url}}" class="float-container">
<img src="{{image src 186 180}}" alt="right3" class="right" />
</a>
{{/list.[3]}}
{{#list.[4]}}
<a href="{{url}}" class="float-container">
<img src="{{image src 186 180}}" alt="right4" class="right" />
</a>
{{/list.[4]}}
</div>
{{/data}}
\ No newline at end of file
... ...
<div class="banner-center banner-center-swiper" style="border: 0;">
{{#if banner_image.[1]}}
<ul class="banner-list swiper-wrapper clearfix">
{{#banner_image}}
<li class="swiper-slide">
<a href="{{url}}">
<img src="{{image src 640 200}}" alt="">
</a>
</li>
{{/banner_image}}
</ul>
{{else}}
{{#banner_image}}
<div class="banner-list">
<a href="{{url}}">
<img src="{{image src 640 200}}" alt="">
</a>
</div>
{{/banner_image}}
{{/if}}
<div class="swiper-pagination" {{#if banner_image.[1]}}style="display:block"{{/if}}>
<div class="pagination-inner">
</div>
</div>
</div>
\ No newline at end of file
... ...
{{#data}}
<div class="new-user-floor">
{{> ../common/floor-header-more}}
<div class="new-user-icon">新人专享</div>
{{> ./new-floor-banner}}
<div class="new-user-goods-container" {{#background}} style="background-image: url({{src}})" {{/background}}>
<ul>
{{#list}}
<li class="new-user-good">
<a href="//m.yohobuy.com/product/show_{{product_skn}}">
<img src="{{image default_images 128 171}}" alt="goods-pic" class="goods-pic" />
<div class="goods-info">
<h3 class="title">{{product_name}}</h3>
<p class="price">&yen; {{sales_price}}</p>
<p class="buy-now">立即购买></p>
</div>
</a>
</li>
{{/list}}
</ul>
</div>
</div>
{{/data}}
\ No newline at end of file
... ...
<div class="notice-wrap clearfix">
<div class="trend">
</div>
<div class="notice" data-time="{{time}}">
{{#data}}
<a class="notice-item item-{{@index}}" href="{{url}}">
<span class="notice-icon"></span>
{{title}}
</a>
{{/data}}
</div>
</div>
... ...
{{#data}}
<div class="plus-star">
{{> ../common/floor-header}}
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 198}}">
</a>
</div>
{{/data}}
... ...
{{#data}}
<div class="sale-floor clearfix">
{{> ../common/floor-header-more}}
{{> ./new-floor-banner }}
{{#list.[0]}}
<a href="{{url}}" class="float-container time-floor">
<img src="{{image src 269 360}}" alt="sale-limit" class="sale-floor-limit">
<div class="sale-floor-time" data-time={{end_time}}>
<p class="limit-title"><i class="icon"></i>限时特卖</p>
<div class="limit">
<span class="hour">00</span>:
<span class="minute">00</span>:
<span class="second">00</span>
</div>
</div>
</a>
{{/list.[0]}}
{{#list.[1]}}
<a href="{{url}}" class="float-container">
<img src="{{image src 284 180}}" alt="sale-break" class="sale-floor-break">
</a>
{{/list.[1]}}
{{#list.[2]}}
<a href="{{url}}" class="sale-floor-entry">
<img src="{{image src 87 180}}" alt="sale-break" >
</a>
{{/list.[2]}}
{{#list.[3]}}
<a href="{{url}}" class="float-container">
<img src="{{image src 284 180}}" alt="sale-discount" class="sale-floor-discount">
</a>
{{/list.[3]}}
{{#list.[4]}}
<a href="{{url}}" class="sale-floor-entry">
<img src="{{image src 87 180}}" alt="sale-break" >
</a>
{{/list.[4]}}
</div>
{{/data}}
\ No newline at end of file
... ...
{{#data}}
{{> ../common/floor-header-more}}
<div class="seckill">
<div class="seckill-times">
<ul>
<li class="time-item">
<div class="normal">
<p class="time">12:00</p>
<p>已开抢</p>
</div>
<div class="selected">
<p class="time"><span>12:00</span>已开抢</p>
<p>还有商品可以继续抢购哦!</p>
</div>
</li>
<li class="time-item foucs">
<div class="normal">
<p class="time">15:00</p>
<p>抢购中</p>
</div>
<div class="selected">
<p class="time"><span>15:00</span>抢购中</p>
<p>剩余:<i class="hour">02</i><i class="minute">02</i><i class="second">02</i></p>
</div>
</li>
<li class="time-item">
<div class="normal">
<p class="time">15:00</p>
<p>即将开抢</p>
</div>
<div class="selected">
<p class="time"><span>15:00</span>即将开抢</p>
<p>距开抢:<i class="hour">02</i><i class="minute">02</i><i class="second">02</i></p>
</div>
</li>
</ul>
</div>
<div class="seckill-products">
</div>
</div>
{{/data}}
\ No newline at end of file
... ...
{{#data}}
<div class="shop-recom">
{{#if title}}
{{> ../common/floor-header-more}}
{{/if}}
<div class="shop-recom-container shop-recom-swiper-container">
<ul class="swiper-wrapper">
{{#list}}
<li class="swiper-slide recom-shop" shopId={{shopId}}>
<div class="shop-top"></div>
<div class="fav-container fav-no">
<div class="shop-notfav"></div><span>收藏</span>
</div>
<div class="fav-container fav-yes" style="display:none">
<div class="shop-fav"></div><span>已收藏</span>
</div>
<span class="faved-num"></span>
<a href="{{url}}">
<img src="{{image src 362 174}}" alt="banner" class="top">
</a>
{{#goods0}}
<a href="{{url}}">
<div class="bottom left">
<img src="{{image src 138 183}}" alt="left">
</div>
</a>
{{/goods0}}
{{#goods1}}
<a href="{{url}}">
<div class="bottom right">
<img src="{{image src 138 183}}" alt="right">
</div>
</a>
{{/goods1}}
</li>
{{/list}}
</ul>
</div>
</div>
{{/data}}
\ No newline at end of file
... ...
{{#data}}
<div class="best-week">
{{> ../common/floor-header-more}}
<ul class="six-lines-floor clearfix">
{{# list}}
<li>
<a href="{{url}}">
<div class="img-box">
<img class="lazy" data-original="{{image src 320 154}}" alt="">
</div>
</a>
</li>
{{/ list}}
</ul>
</div>
{{/data}}
\ No newline at end of file
... ...
{{#data}}
<div class="three-picture clearfix">
{{#list}}
<a href="{{url}}">
<img src="{{image src 210 280}}">
</a>
{{/list}}
</div>
{{/data}}
... ...
<div class="thumb-row">
{{# data}}
<a href="{{url}}">
<div class="thumb-row-box" style="background-image:url({{image src 275 160}})"></div>
</a>
{{/ data}}
</div>
... ...
{{#data}}
{{> ../common/floor-header-more}}
{{/data}}
... ...
{{#data}}
<div class="trend-topic-wrapper">
{{> ../common/floor-header-more}}
<div class="trend-topic-content">
<div class="trend-topic-swiper">
<ul class="swiper-wrapper">
{{# list}}
<li class="swiper-slide">
<a href="{{url}}">
<div class="img-box">
<img class="lazy" data-original="{{image src 580 360}}" src="{{image src 580 360}}" alt="">
</div>
<div class="item-content">
<p class="title">{{title}}</p>
<p class="time">
<span class="iconfont time-icon">&#xe603;</span>
<span>{{publish_time}}</span>
</p>
</div>
</a>
</li>
{{/ list}}
</ul>
</div>
<div class="swiper-pagination">
<div class="pagination-inner clearfix">
</div>
</div>
</div>
</div>
{{/data}}
... ...
{{#data}}
<div class="trend-coll-wrapper">
{{> ../common/floor-header-more}}
<div class="trend-coll-content clearfix">
{{# article}}
<div class="lspan">
<a href="{{url}}"><img class="lazy rspanimg" data-original="{{image src 400 400}}" ></a>
</div>
{{/ article}}
</div>
<div class="trend-coll-tail">
<h3 class="recommend-title">推荐搭配</h3>
<div class="recommend-swiper">
<ul class="recommend-list swiper-wrapper clearfix">
{{# recommend_collocation}}
<li class="recommend-item swiper-slide"><a href="{{url}}"><img class="img" src="{{image src 140 140}}" alt="" /></a></li>
{{/ recommend_collocation}}
</ul>
</div>
</div>
</div>
{{/data}}
... ...
{{#data}}
<div class="vip-only">
{{> ../common/floor-header-more}}
{{> ./new-floor-banner}}
<div class="vip-only-goods-list" {{#background}} style="background-image: url({{src}})" {{/background}}>
<ul>
{{#list}}
<a href="//m.yohobuy.com/product/show_{{product_skn}}">
<li class="vip-only-goods">
<img src="{{image default_images 153 206}}" alt="goods" class="goods-pic">
<div class="goods-info">
<p class="vip-price vip1">&yen; {{vip1_price}}</p>
<p class="vip-price vip2">&yen; {{vip2_price}}</p>
<p class="vip-price vip3">&yen; {{vip3_price}}</p>
<p class="sale-price">&yen; {{market_price}} <span class="vip-icon"></span></p>
</div>
</li>
</a>
{{/list}}
</ul>
</div>
</div>
{{/data}}
\ No newline at end of file
... ...
... ... @@ -15,10 +15,13 @@ var $mobileWrap = $('.mobile-wrap'),
$sideNav = $('.side-nav'),
$subNav = $('.sub-nav'),
$logotrans = $('.home-header .logo'),
$resourceContent = $('.resource-content'),
start = 0,
swiperClass,
isen = true;
var channelContentHbs = require('channel/content.hbs');
var C_ID;
require('../common');
... ... @@ -123,6 +126,25 @@ if ($('.banner-center-swiper').find('li').size() > 1) {
});
}
// 异步获取首屏其余楼层
var getResourceContent = function() {
$.ajax({
type: 'GET',
url: '/channel/getResourceContent',
async: false,//改为false,否则下面初始化会找不到元素对象
data: {
gender: $mobileWrap.data('channel')
},
}).then(function(result) {
var resourceTemplate = channelContentHbs({content: result});
$resourceContent.append(resourceTemplate);
lazyLoad($(resourceTemplate).find('img.lazy'));
});
};
getResourceContent();
// 热门品牌滑动
new Swiper('.brands-swiper', {
grabCursor: true,
... ... @@ -231,17 +253,19 @@ window.setCookie('_Channel', $mobileWrap.data('channel'), {
});
// 店铺推荐滑动效果
var shopSwiper = new Swiper('.shop-recom-swiper-container', {
centeredSlides: true,
slidesPerView: 'auto',
paginationClickable: true,
slideActiveClass: 'recom-active',
});
if ($('.shop-recom-swiper-container').find('li') > 1) {
new Swiper('.shop-recom-swiper-container', {
centeredSlides: true,
slidesPerView: 'auto',
paginationClickable: true,
slideActiveClass: 'recom-active',
});
}
// 店铺推荐人数和收藏初始查询
var checkShop = function() {
var shopIds = [];
$('.recom-shop').each(function() {
shopIds.push($(this).attr('shopId'));
});
... ... @@ -256,6 +280,7 @@ var checkShop = function() {
for (var i = 0, elem;
(elem = result.data[i]) != null; i++) {
var a = $('.recom-shop[shopId = ' + elem.id + ']');
a.find('.faved-num').text(elem.collectionNum + '人已收藏');
if (elem.favorite) {
a.find('.fav-no').hide();
... ... @@ -265,10 +290,12 @@ var checkShop = function() {
}
});
};
checkShop();
// 店铺收藏 || 取消收藏
var $collect = $('.fav-container');
$collect.on('touchstart', function() {
var opt = $(this).hasClass('fav-yes') ? 'cancel' : 'ok';
var self = $(this);
... ... @@ -312,7 +339,6 @@ $collect.on('touchstart', function() {
},
error: function() {
tip.show('网络断开连接了~');
searching = false;
}
});
});
... ... @@ -320,12 +346,13 @@ $collect.on('touchstart', function() {
// vip专属等级查询
$.ajax({
method: 'POST',
url: location.protocol + '//m.yohobuy.com' + '/channel/userVip',
url: location.protocol + '//m.yohobuy.com/channel/userVip',
data: {
channel: 1,
},
success: function(data) {
var vip = $('.vip-only');
if (data.code === 200 && Number(data.current_vip_level) !== 0) {
vip.show();
vip.find('.vip' + data.current_vip_level).show();
... ... @@ -333,7 +360,6 @@ $.ajax({
},
error: function() {
tip.show('网络断开连接了~');
searching = false;
}
});
... ... @@ -342,9 +368,10 @@ var saleTime = function(elem, offsetTime) {
var hour = parseInt(offsetTime / (60 * 60), 10),
minute = parseInt(offsetTime % (60 * 60) / 60, 10),
second = offsetTime % 60;
if (offsetTime <= -1) { // 结束倒计时刷新状态
$(elem).find('.limit').hide();
}
if (offsetTime <= -1) { // 结束倒计时刷新状态
$(elem).find('.limit').hide();
}
if (offsetTime >= -1) {
$(elem).find('.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour));
... ...