Authored by 郝肖肖

tab select

... ... @@ -25,14 +25,14 @@ exports.index = (req, res, next) => {
/**
* 潮流优选首页-资源位
*/
exports.resources = (req, res, next) => {
exports.resourcesTemplate = (req, res, next) => {
let code = req.query.code || '';
plusstarModel.getResources({
content_code: code
}).then(result => {
res.render('plusstar/index', {
page: 'plusstar-index',
res.render('plusstar/resources-template', {
page: 'plusstar-resources-template',
result: result,
title: '潮流优选'
});
... ...
... ... @@ -24,6 +24,6 @@ router.get('/star/collocation/list', star.collocationList); // 星潮教室星
router.post('/star/setFavorite', star.setFavorite); // 收藏文章
router.get('/plusstar', plusstar.index); // 潮流优选
router.get('/plusstar/resources', plusstar.resources); // 潮流优选首页-资源位
router.get('/plusstar/resources-template', plusstar.resourcesTemplate); // 潮流优选首页-资源位
module.exports = router;
... ...
... ... @@ -12,65 +12,8 @@
{{/if}}
<!--/tab-nav-->
<div class="resources">
<!--banner-->
{{#each result.focus1}}
{{> resources/banner-top}}
{{/each}}
{{#each result.title_image}}
<div class="header-title">
{{title}}
<a class="more" href="{{moreUrl}}">{{moreName}}</a>
</div>
<div class="title-image">
<a class="image" href="{{image.url}}">
<img class="lazy" data-original="{{image image.src 750 364}}">
</a>
</div>
{{/each}}
<div class="focus-left-right">
{{#each result.focus2.data}}
<a href="{{url}}" title="{{title}}">
<img class="lazy" data-original="{{image src 250 250}}">
</a>
{{/each}}
</div>
<!--/focus-left-right-->
{{#if result.recommend}}
<div class="header-title">
{{result.recommend.title.name}}
<a class="more" href="{{result.recommend.title.moreUrl}}">
{{result.recommend.title.moreName}}
</a>
</div>
<div class="recommend-content-five">
{{#each result.recommend.data}}
<a href="{{url}}" title="{{title}}">
<img class="lazy" data-original="{{image src 375 375}}">
</a>
{{/each}}
</div>
{{/if}}
{{#if result.goods}}
<div class="header-title">
{{result.goods.title.name}}
<a class="more" href="{{result.goods.title.moreUrl}}">
{{result.goods.title.moreName}}
</a>
</div>
<div class="goods">
<!--商品--->
{{#each result.goods.data}}
{{> common/goods}}
{{/each}}
</div><!--/goods-->
{{/if}}
</div><!--/resources-->
<div class="plusstar-resources">
<!--资源位数据模板-->
</div><!--/plusstar-resources-->
</div><!--/plusstar-page-->
\ No newline at end of file
... ...
<div class="resources">
<!--banner-->
{{#each result.focus1}}
{{> resources/banner-top}}
{{/each}}
{{#each result.title_image}}
<div class="header-title">
{{title}}
<a class="more" href="{{moreUrl}}">{{moreName}}</a>
</div>
<div class="title-image">
<a class="image" href="{{image.url}}">
<img class="lazy" data-original="{{image image.src 750 364}}">
</a>
</div>
{{/each}}
<div class="focus-left-right">
{{#each result.focus2.data}}
<a href="{{url}}" title="{{title}}">
<img class="lazy" data-original="{{image src 250 250}}">
</a>
{{/each}}
</div>
<!--/focus-left-right-->
{{#if result.recommend}}
<div class="header-title">
{{result.recommend.title.name}}
<a class="more" href="{{result.recommend.title.moreUrl}}">
{{result.recommend.title.moreName}}
</a>
</div>
<div class="recommend-content-five">
{{#each result.recommend.data}}
<a href="{{url}}" title="{{title}}">
<img class="lazy" data-original="{{image src 375 375}}">
</a>
{{/each}}
</div>
{{/if}}
{{#if result.goods}}
<div class="header-title">
{{result.goods.title.name}}
<a class="more" href="{{result.goods.title.moreUrl}}">
{{result.goods.title.moreName}}
</a>
</div>
<div class="goods">
<!--商品--->
{{#each result.goods.data}}
{{> common/goods}}
{{/each}}
</div><!--/goods-->
{{/if}}
</div><!--/resources-->
... ...
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
lazyLoad = require('yoho-jquery-lazyload');
var plusstar = {};
require('../common');
lazyLoad($('img.lazy'));
// 头部banner轮播
if ($('.banner-swiper').find('li').size() > 1) {
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
pagination: '.banner-top .pagination-inner'
});
}
plusstar = {
init: function() {
var that = this, $liDom;
//事情委托机制
$('.plusstar-page .tab-nav ul').bind('click', function(even) {
$liDom = $(event.target).closest('li');
$(this).find('li').removeClass('focus');
$liDom.addClass('focus');
that.tabNav($liDom.data('code'));
});
switch (window.cookie('_Channel')) {
case 'girls':
$liDom = $('.plusstar-page .tab-nav ul li:eq(1)');
break;
case 'lifestyle':
$liDom = $('.plusstar-page .tab-nav ul li:eq(2)');
break;
default:
$liDom = $('.plusstar-page .tab-nav ul li:eq(0)');
break;
}
that.tabNav($liDom.data('code'));
},
tabNav: function(code) {
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '/guang/plusstar/resources-template',
data: {
code: code
},
dataType: 'html',
success: function(data) {
if (data === '') {
tip.show('没有更多内容了');
}
$('.plusstar-resources').html(data);
loading.hideLoadingMask();
lazyLoad($('img.lazy'));
},
error: function() {
tip.show('网络断开连接了~');
}
});
}
};
$(function() {
plusstar.init();
});
\ No newline at end of file
... ...
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper');
var plusstarResources = {
init: function() {
// 头部banner轮播
if ($('.banner-swiper').find('li').size() > 1) {
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
pagination: '.banner-top .pagination-inner'
});
}
}
};
$(function() {
plusstarResources.init();
});
\ No newline at end of file
... ...