Authored by ccbikai

整理代码

... ... @@ -56,7 +56,7 @@ exports.index = (req, res) => {
}, processPublicData(req, '星潮教室')));
};
exports.ajaxIndexHtml = (req, res) => {
exports.getIndexHtml = (req, res) => {
starModel.getIndexData().then((result) => {
res.render('star/index-html', _.assign({
layout: false,
... ...
... ... @@ -13,7 +13,7 @@ const star = require(cRoot + '/star');
const router = express.Router(); // eslint-disable-line
router.get('/star', star.index); // 星潮教室首页
router.get('/star/ajaxIndexHtml', star.ajaxIndexHtml); // 星潮教室首页
router.get('/star/getIndexHtml', star.getIndexHtml); // 星潮教室首页
router.get('/star/detail', star.detail); // 明星文章专区
router.get('/star/detailList', star.detailList); // 明星文章专区文章Ajax请求
router.get('/star/special', star.special); // 星潮教室星专题
... ...
<div class="avatar-swiper avatar-1">
<ul class="clearfix swiper-wrapper">
{{# starAvatar}}
<li class="swiper-slide">
<img class="rank-avatar" data-url="{{url}}" src="{{image cover 180 180}}">
</li>
{{/ starAvatar}}
</ul>
</div>
<div class="loading-tip">松手开始刷新...</div>
<div class="star-wrap">
<div class="star-content">
... ... @@ -16,6 +7,7 @@
{{/if}}
{{/content}}
<div class="avatar-wrap">
<div class="avatar-swiper avatar-0">
<ul class="clearfix swiper-wrapper">
{{# starAvatar}}
... ... @@ -25,6 +17,7 @@
{{/ starAvatar}}
</ul>
</div>
</div>
<ul class="star-info clearfix">
{{#each articles}}
... ...
... ... @@ -78,8 +78,6 @@ function setIndexAction() {
});
starIScroll.iScroll.on('scrollStart', function() {
$window.trigger('scroll');
// 下拉
if (this.directionY === -1) {
$headTab.slideDown();
... ... @@ -89,16 +87,14 @@ function setIndexAction() {
starIScroll.iScroll.on('scroll', function() {
if (this.startY < -180) {
console.log('111');
}
});
starIScroll.iScroll.on('scrollEnd', function() {
$window.trigger('scroll');
// 上滑
if (this.directionY === 1) {
$headTab.slideUp();
$headTab.slideUp(1000);
}
$loadingTip.slideUp();
});
... ... @@ -253,13 +249,14 @@ function setIndexAction() {
getIndexHtml = function() {
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '/guang/star/ajaxIndexHtml',
url: '/guang/star/getIndexHtml',
dataType: 'html',
success: function(data) {
stopLoading = false;
if (data === '') {
console.log(data);
if (!data) {
stopLoading = true;
tip.show('没有更多内容了');
}
... ...
... ... @@ -48,3 +48,5 @@ function hideLoadingMask() {
exports.init = init;
exports.showLoadingMask = showLoadingMask;
exports.hideLoadingMask = hideLoadingMask;
exports.show = showLoadingMask;
exports.hide = hideLoadingMask;
... ...
... ... @@ -18,7 +18,8 @@ var $ = require('yoho-jquery'),
// });
function PullRefresh(seclector, options) {
var $em,
var $window = $(window),
$em,
pullFormTop = false,
pullStart,
topOffset;
... ... @@ -46,6 +47,7 @@ function PullRefresh(seclector, options) {
}
pullStart = this.y;
$window.trigger('scroll');
});
this.iScroll.on('scrollEnd', function() {
... ... @@ -57,6 +59,8 @@ function PullRefresh(seclector, options) {
if (pullStart === this.y && this.directionY === 1) {
options.pullUp && options.pullUp();
}
$window.trigger('scroll');
});
}
... ...
... ... @@ -115,6 +115,12 @@
overflow: hidden;
margin-top: 30px;
.fixed {
position: fixed;
left: 0;
top: 0;
}
li {
float: left;
width: auto;
... ... @@ -357,14 +363,6 @@
float: left;
}
.avatar-1 {
background: #000;
position: relative;
z-index: 9;
margin-top: 0;
display: none;
}
.loading-tip {
display: none;
text-align: center;
... ...