Authored by wangqing

增加两个人间

... ... @@ -108,8 +108,8 @@ gulp.task('build', function() {
pkg: pkg
}))
.pipe(concat('index-debug.js'))
.pipe(gulp.dest(distDir.js))
.pipe(gulp.dest(dist_dir.js))
.pipe(uglify())
.pipe(concat('index.js'))
.pipe(gulp.dest(distDir.js));
.pipe(gulp.dest(dist_dir.js));
});
\ No newline at end of file
... ...
... ... @@ -20,6 +20,7 @@
"mlellipsis": "0.0.6",
"iscroll": "5.1.2",
"underscore": "1.6.0",
"import-style": "1.0.0",
"yoho.jgestures": "0.9.2"
},
"devDependencies": {
... ...
/**
* 模拟数据
* @author: xuqi(qi.xu@yoho.cn)
* @date: 2015/3/30
*/
module.exports = function() {
return [{
starheader: [{
title: '推荐',
link: 'ss',
highlight: 'hasunderline',
id: 1
}, {
title: 'ALL',
link: 'dd',
highlight: '',
id: 2
}]
}, {
starinner: [{
id: '1',
showClass: 'show',
banner: {
bannerId:'1',
imgList: [{
url: 'http://stussy.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"361"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/3Stussy_01.jpg',
description: ''
}, {
url: 'http://stussy.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"361"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/3Stussy_02.jpg',
description: ''
}]
},
brandList: [{
subId: 'e3',
img: {
url: 'http://stussy.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"361"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/3Stussy_01.jpg',
description: ''
}
}, {
subId: 'e4',
img: {
url: 'http://adidas.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"349"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/4adidas-originals_01.jpg',
description: ''
}
}, {
subId: 'e5',
img: {
url: 'http://huf.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"578"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/5HUF_01.jpg',
description: ''
}
}, {
subId: 'e6',
img: {
url: 'http://ktz.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"530"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/6KTZ_01.jpg',
description: ''
}
}]
}, {
id: '2',
showClass: 'hide',
banner: {
bannerId:'2',
imgList: [{
url: 'http://stussy.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"361"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/6KTZ_01.jpg',
description: ''
}, {
url: 'http://stussy.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"361"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/5HUF_01.jpg',
description: ''
}]
},
brandList: [{
subId: 'e3',
img: {
url: 'http://stussy.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"361"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/4STAYREAL_02.jpg',
description: ''
}
}, {
subId: 'e4',
img: {
url: 'http://adidas.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"349"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/4STAYREAL_02.jpg',
description: ''
}
}, {
subId: 'e5',
img: {
url: 'http://huf.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"578"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/4STAYREAL_02.jpg',
description: ''
}
}, {
subId: 'e6',
img: {
url: 'http://ktz.m.yohobuy.com/?openby:yohobuy={"action":"go.brand","params":{"brand_id":"530"}}',
src: 'http://ad.yoho.cn/yohobuy/newfestival/img/brandsmap/4STAYREAL_02.jpg',
description: ''
}
}]
}]
}, {
starfooter: {
url: '',
link: ''
}
}];
}
\ No newline at end of file
... ...
var $ = require('yoho.jquery'),
Swiper = require('yoho.iswiper'),
Mustache = require('yoho.mustache'),
FetchBrand = require('./fetchbrand'),
jgestures = require('yoho.jgestures');
var fetching = false,
pagecount = 10,
page = window.global_totalcount >= pagecount ? pagecount : window.global_totalcount,
loaded = {},
slideCache = [],
slideMap = {},
lastScrollY = window.pageYOffset,
scrollY = window.pageYOffset,
innerHeight,
topViewPort,
bottomViewPort;
/**
*获得模板
*/
var template, global_timer;
function showLoadPreview() {
document.querySelector('.loadmore').style.display = 'block';
}
function hideLoadPreview() {
document.querySelector('.loadmore').style.display = 'none';
}
/**
* 抓取数据
* @return {[type]} [description]
*/
function fetchBrands() {
if (fetching) {
return;
} else {
fetching = true;
}
var senddata = {
brandcat: global_brandcat,
start: page,
count: pagecount
};
var sendparams = {
data: senddata,
url: global_fetchdataurl
};
FetchBrand.FetchBrandDataInfo('brands', sendparams, function(data) {
var frag = Mustache.render(template, {
brandList: data.data.brandList
});
window.global_totalcount = data.data.total;
$('#' + global_showpannel).append(frag)
var swiper = $(frag).find('.swiper-container');
swiper = swiper.prevObject;
for (var i = 0; i < swiper.length; i++) {
(function(id) {
var swiperid = swiper[id].getAttribute('id');
new Swiper('.swiper-container' + swiperid, {
pagination: '.swiper-pagination' + swiperid,
lazyLoading: false,
lazyLoadingInPrevNext: false,
loop: false,
autoplay: false
});
})(i)
}
fetching = false;
hideLoadPreview();
page += pagecount;
});
}
/**
* 模拟滚动的函数
* @param {[type]} e [description]
* @param {[type]} force [description]
* @return {[type]} [description]
*/
function handleScroll(e, force) {
window.clearTimeout(global_timer);
if (page >= window.global_totalcount) {
return;
}
if (lastScrollY === window.scrollY) {
global_timer = window.setTimeout(handleScroll, 100);
return;
} else {
lastScrollY = window.scrollY;
}
scrollY = window.scrollY;
innerHeight = window.innerHeight; //窗口高度
topViewPort = scrollY - 6000;
bottomViewPort = scrollY + innerHeight + 6000;
if (window.scrollY + innerHeight >= document.body.offsetHeight) { //是否提前到底
showLoadPreview();
fetchBrands();
}
global_timer = window.setTimeout(handleScroll, 100);
}
/**抓取数据**/
function getBrand(catid) {
page = 0;
global_showpannel = 'showpannel' + catid;
global_brandcat = catid;
window.scrollTo(0, 0);
fetchBrands();
global_timer = window.setTimeout(handleScroll, 100);
}
/**
* 初始化
* @param {[type]} ) { window.setTimeout(handleScroll, 100); fetchBrands();} [description]
* @return {[type]} [description]
*/
exports.init = function() {
$('.navitemwrapper').bind('tapone', function() {
var nowActHeader = $(this),
preActHeader = $('.newfestivalbrandheader').data('actheadtag') || $('.hasunderline'),
tagId = nowActHeader.attr('tagid'),
nowActContent = $('#showpannel' + tagId),
preActContent = $('.newfestivalbrandheader').data('actcontenttag') || $('.newfestivalbrandwrapper .show');
preActHeader.removeClass('hasunderline');
nowActHeader.addClass('hasunderline');
$('.newfestivalbrandheader').data('actheadtag', nowActHeader);
//preActContent.empty(); //清掉上个界面的数据
parenttop = nowActContent.offset().top; //重置高度
preActContent.removeClass('show').addClass('hide');
nowActContent.removeClass('hide').addClass('show');
$('.newfestivalbrandheader').data('actcontenttag', nowActContent);
var catid = tagId;
//getBrand(catid);
});
}
\ No newline at end of file
... ...
... ... @@ -19,7 +19,7 @@ var fetching = false,
*获得模板
*/
var template, global_timer;
var parenttop = 145 * pagecount;
function showLoadPreview() {
document.querySelector('.loadmore').style.display = 'block';
}
... ... @@ -47,12 +47,13 @@ function fetchBrands() {
url: global_fetchdataurl
};
FetchBrand.FetchBrandDataInfo('brands', sendparams, function(data) {
var frag=Mustache.render(template, {
var frag = Mustache.render(template, {
brandList: data.data.brandList
});
window.global_totalcount = data.data.total;
$('#'+global_showpannel).append(frag)
$('#' + global_showpannel).append(frag)
var swiper = $(frag).find('.swiper-container');
swiper = swiper.prevObject;
for (var i = 0; i < swiper.length; i++) {
(function(id) {
var swiperid = swiper[id].getAttribute('id');
... ...
... ... @@ -192,12 +192,18 @@
bottom: 0;
right: 0;
display: none;
opacity: .5;
filter: alpha(opacity=50);
}
.infislide .img {
-webkit-transition: opacity 0.25s ease-in-out;
-moz-transition: opacity 0.25s ease-in-out;
-o-transition: opacity 0.25s ease-in-out;
transition: opacity 0.25s ease-in-out;
}
\ No newline at end of file
}
.branddetail {
a {
display: block;
}
img {
width: 100%;
}
}
\ No newline at end of file
... ...
... ... @@ -22,6 +22,7 @@ module.exports = function(app) {
app.get('/ps/list', ps.list); //plus + star page list
app.get('/ps', ps.show); //plus + star
app.get('/ps/tabpage', ps.tabPage); //plustabpage
app.get('/ps/newtabpage',ps.tabPageNew)
app.post('/ps/getBrand',ps.getBrand);
app.get('/ps/psTmplage',ps.psTmplage);
... ...
... ... @@ -10,6 +10,7 @@ var data = require('../../public/js/data'),
fs = require('fs'),
tabpage = require('../../public/js/data_tabpage')('temp'),
original = require('../../public/js/data_tabpage')('original'),
newtagpage = require('../../public/js/data_newtabpage')(),
tplPath = path.normalize(path.join(__dirname, '../partials/ps/info-item.html'));
function clone(myObj) {
... ... @@ -51,6 +52,19 @@ exports.readTpl = function(req, res) {
});
});
};
exports.tabPageNew = function(req, res) {
var obj = {};
obj.global_fetchdataurl = 'getBrand';
obj.global_brandcat = '1';
obj.global_showpannel = 'showpannel1';
obj.global_totalcount = 20;
res.render('pages/ps-newtabpage', {
data: newtagpage,
globalConfig: obj,
layout: '../layouts/layout',
isNewTabPage: true
});
}
/**
* 首次跳转
* @param {[type]} req [description]
... ... @@ -110,8 +124,6 @@ exports.getBrand = function(req, res) {
*/
exports.psTmplage = function(req, res) {
var temp = '{{#brandList}}' +
'<div class="row brandpicwrapper infislide" data-id="{{subId}}" id="s-{{subId}}">' +
'<div class="col">' +
'<div class="swiper-container swiper-container{{subId}}" id="{{subId}}">' +
'<div class="swiper-wrapper">' +
'{{# imgList}}' +
... ... @@ -124,8 +136,6 @@ exports.psTmplage = function(req, res) {
'</div>' +
'<div class="swiper-pagination swiper-pagination{{subId}}"></div>' +
'</div>' +
'</div>' +
'</div>' +
'{{/brandList}}';
res.send(temp);
}
... ...
{{#data}}
<div class="newfestivalbrandwrapper">
{{!导航}}
<div class="row newfestivalbrandheader" id="brandnavwrapper">
{{# starheader}}
<div class="col col-50 navitemwrapper {{highlight}}" tagid={{id}}>
<a class="img-container " href="javascript:void(0)">
<h3 class="navitem hasvline">{{title}}</h3>
</a>
</div>
{{/ starheader}}
</div>
{{!内容}}
{{# starinner}}
<div class="brandsshowpannel {{showClass}} " id="showpannel{{id}}" >
{{#banner}}
<div class="swiper-container swiper-container{{bannerId}}" id="{{bannerId}}" >
<div class="swiper-wrapper">
{{# imgList}}
<div class="swiper-slide branddetail">
<a href="{{url}}">
<img class="img" src="{{src}}" />
</a>
</div>
{{/imgList}}
</div>
<div class="swiper-pagination swiper-pagination{{bannerId}}"></div>
</div>
{{/banner}}
{{#brandList}}
{{# img}}
<div class="branddetail">
<a href="{{url}}">
<img class="img" src="{{src}}" />
</a>
</div>
{{/img}}
{{/brandList}}
</div>
{{/ starinner}}
{{!尾部}}
{{# starfooter}}
<div class="row">
<div class="col">
<a href="{{link}}" style="display:block">
<img src="{{src}}" alt="" style="width:100%"></a>
</div>
</div>
{{/starfooter}}
</div>
{{/data}}
\ No newline at end of file
... ...
... ... @@ -31,25 +31,21 @@
{{# starinner}}
<div class="brandsshowpannel {{showClass}} " id="showpannel{{id}}" >
{{#brandList}}
<div class="row brandpicwrapper infislide" data-id="{{subId}}" id="s-{{subId}}">
<div class="col">
<div class="swiper-container swiper-container{{subId}}" id="{{subId}}">
<div class="swiper-wrapper">
{{# imgList}}
<div class="swiper-slide branddetail">
<a href="{{url}}">
<img class="img" src="{{src}}" />
<div class="brandpicwordswrapper">
<p class="brandpicwords">{{description}}</p>
</div>
</a>
</div>
{{/imgList}}
<div class="swiper-container swiper-container{{subId}}" id="{{subId}}">
<div class="swiper-wrapper">
{{# imgList}}
<div class="swiper-slide branddetail">
<a href="{{url}}">
<img class="img" src="{{src}}" />
<div class="brandpicwordswrapper">
<p class="brandpicwords">{{description}}</p>
</div>
</a>
</div>
<div class="swiper-pagination swiper-pagination{{subId}}"></div>
{{/imgList}}
</div>
<div class="swiper-pagination swiper-pagination{{subId}}"></div>
</div>
</div>
{{/brandList}}
</div>
{{/ starinner}}
... ...
<script src="http://localhost:8000/public/js/ps-tabpage.js"></script>
<script type="text/javascript">
seajs.use('public/js/ps-newtabpage', function(psnewtabpage) {
var swiper = document.querySelectorAll('.swiper-container');
for(var i=0;i<swiper.length;i++ ){
var swiperid = swiper[i].getAttribute('id');
new Swiper('.swiper-container' + swiperid, {
pagination: '.swiper-pagination' + swiperid,
lazyLoading: false,
lazyLoadingInPrevNext: false,
loop: false,
autoplay: false
});
}
if (psnewtabpage) {
psnewtabpage.init();
}
});
</script>
\ No newline at end of file
... ...
... ... @@ -40,4 +40,8 @@
{{! 标签切换}}
{{# isTabPage}}
{{> footer_js/ps_tabpage}}
{{/ isTabPage}}
\ No newline at end of file
{{/ isTabPage}}
{{! 新标签切换}}
{{# isNewTabPage}}
{{> footer_js/ps_newtabpage}}
{{/ isNewTabPage}}
\ No newline at end of file
... ...