Authored by ccbikai

星潮教室优化

... ... @@ -45,25 +45,26 @@ app.use(bodyParser.urlencoded({
extended: false
}));
app.use(cookieParser());
app.use(session({
proxy: true,
resave: false,
saveUninitialized: true,
unset: 'destroy',
secret: 'nothing', // 兼容 PHP SESSION,sessionID 不加密
name: 'PHPSESSID', // 兼容 PHP SESSION
genid: () => {
return uuid.v4(); // 兼容 PHP SESSION
},
cookie: {
domain: 'yohobuy.com'
},
store: new MemcachedStore({
hosts: config.memcache.session,
prefix: 'qinsessionsession:', // 兼容 PHP SESSION
key: 'yohobuy_session' // 兼容 PHP SESSION
})
}));
// app.use(session({
// proxy: true,
// resave: false,
// saveUninitialized: true,
// unset: 'destroy',
// secret: 'nothing', // 兼容 PHP SESSION,sessionID 不加密
// name: 'PHPSESSID', // 兼容 PHP SESSION
// genid: () => {
// return uuid.v4(); // 兼容 PHP SESSION
// },
// cookie: {
// domain: 'yohobuy.com'
// },
// store: new MemcachedStore({
// hosts: config.memcache.session,
// prefix: 'qinsessionsession:', // 兼容 PHP SESSION
// key: 'yohobuy_session' // 兼容 PHP SESSION
// })
// }));
app.use((req, res, next) => {
req.user = {};
... ...
... ... @@ -8,7 +8,7 @@
{{/content}}
<div class="avatar-wrap">
<div class="avatar-swiper avatar-0">
<div class="avatar-swiper avatar">
<ul class="clearfix swiper-wrapper">
{{# starAvatar}}
<li class="swiper-slide">
... ...
... ... @@ -64,11 +64,13 @@ function setAvatar($userAvatar) {
function setIndexAction() {
var starIScroll;
var commonHeaderTop = $('#yoho-header').outerHeight();
var $loadingTip = $('.loading-tip');
var $avatarWrap = $('.avatar-wrap');
// 下拉刷新,上拉加载
starIScroll = new PullRefresh('.star-wrap', {
height: $(window).height() - $('#yoho-header').height() - $('.head-tab').height(),
height: $(window).height() - commonHeaderTop,
pullDown: function() {
if (!stopLoading) {
stopLoading = true;
... ... @@ -86,8 +88,13 @@ function setIndexAction() {
});
starIScroll.iScroll.on('scroll', function() {
if (this.startY < -180) {
console.log('111');
if (commonHeaderTop > $avatarWrap.offset().top) {
// $('.avatar-clone').css('top', $('.head-tab').outerHeight());
$('.avatar-clone').show();
starIScroll[0].update();
starIScroll[1].update();
} else {
$('.avatar-clone').hide();
}
});
... ... @@ -190,7 +197,7 @@ function setIndexAction() {
// }
if (bannerLen > 1) {
avatarSwiper[0] = new Swiper('.avatar-0', {
avatarSwiper = new Swiper('.avatar', {
loop: true,
// loopedSlides: bannerLen,
... ... @@ -198,12 +205,15 @@ function setIndexAction() {
centeredSlides: true,
slidesPerView: 'auto',
spaceBetween: 10,
slidesOffsetBefore: '-' + $('.avatar-0').find('li').not('.swiper-slide-visible').width() / 2,
slidesOffsetBefore: -($('.avatar').find('li').not('.swiper-slide-visible').width() / 2),
watchSlidesProgress: true,
watchSlidesVisibility: true,
observer: true,
observeParents: true
});
avatarSwiper[0].params.control = avatarSwiper[1];// 需要在Swiper2初始化后,Swiper1控制Swiper2
avatarSwiper[1].params.control = avatarSwiper[0];// 需要在Swiper1初始化后,Swiper2控制Swiper1
}
// 明星动态头像左右滑动
... ... @@ -247,6 +257,8 @@ function setIndexAction() {
}
getIndexHtml = function() {
var $starMain = $('.star-main');
loading.showLoadingMask();
$.ajax({
url: '/guang/star/getIndexHtml',
... ... @@ -254,14 +266,15 @@ getIndexHtml = function() {
success: function(data) {
stopLoading = false;
console.log(data);
if (!data) {
stopLoading = true;
tip.show('没有更多内容了');
}
$('.star-main').html(data);
$starMain.html(data);
bannerLen = $('.avatar .swiper-slide').length;
$starMain.prepend($('.avatar-swiper').clone().addClass('avatar-clone').hide());
// 限制标题字数
$('.cont-area').each(function() {
... ... @@ -270,7 +283,6 @@ getIndexHtml = function() {
loading.hideLoadingMask();
lazyLoad($('img.lazy'));
bannerLen = $('.avatar-0 .swiper-slide').length;
setTimeout(function() {
setIndexAction();
... ...
... ... @@ -115,10 +115,14 @@
overflow: hidden;
margin-top: 30px;
.fixed {
&.avatar-clone {
position: fixed;
left: 0;
top: 0;
margin-top: 86px;
padding: 5px 0;
background: #000;
z-index: 9;
}
li {
... ...