...
|
...
|
@@ -5,10 +5,9 @@ |
|
|
*/
|
|
|
|
|
|
var $ = require('yoho-jquery'),
|
|
|
Hammer = require('yoho-hammer'),
|
|
|
ellipsis = require('yoho-mlellipsis'),
|
|
|
lazyLoad = require('yoho-jquery-lazyload'),
|
|
|
Swiper = require('yoho-swiper');
|
|
|
Swiper = require('yoho-swiper2');
|
|
|
|
|
|
var tip = require('../plugin/tip');
|
|
|
var loading = require('../plugin/loading');
|
...
|
...
|
@@ -55,12 +54,15 @@ function initSwiper(typeId) { |
|
|
if (typeof typeId === undefined) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (!mySwiper[typeId]) {
|
|
|
mySwiper[typeId] = new Swiper('.swiper-cont-' + typeId, {
|
|
|
lazyLoading: true,
|
|
|
wrapperClass: 'swiper-wrap-' + typeId,
|
|
|
pagination: '.swiper-pagi-' + typeId,
|
|
|
autoplay: 3000
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -85,38 +87,20 @@ function setLazyLoadAndMellipsis($infos) { |
|
|
* @params $container 逛资讯列表容器
|
|
|
*/
|
|
|
function initInfosEvt($container) {
|
|
|
var cHammer;
|
|
|
|
|
|
if (typeof $container === 'undefined') {
|
|
|
return;
|
|
|
}
|
|
|
if (typeof $container[0] === 'undefined') {
|
|
|
return;
|
|
|
}
|
|
|
cHammer = new Hammer($container[0]);
|
|
|
|
|
|
// 点赞或者收藏事件
|
|
|
cHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target),
|
|
|
opt = 'ok',
|
|
|
$btn,
|
|
|
$info,
|
|
|
yhChannel;
|
|
|
|
|
|
// e.preventDefault();
|
|
|
|
|
|
// 点赞
|
|
|
$btn = $this.closest('.like-btn');
|
|
|
if ($btn.length > 0 && !isLoading) {
|
|
|
$container.find('.like-btn').on('touchend touchcancel', function(e) {
|
|
|
var opt = 'ok', $btn = $(this), $info, isLoading;
|
|
|
e.preventDefault();
|
|
|
if ($btn.hasClass('like')) {
|
|
|
opt = 'cancel';
|
|
|
}
|
|
|
|
|
|
$info = $this.closest('.guang-info');
|
|
|
|
|
|
$info = $btn.closest('.guang-info');
|
|
|
isLoading = true;
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/guang/opt/praiseArticle',
|
...
|
...
|
@@ -127,10 +111,8 @@ function initInfosEvt($container) { |
|
|
success: function(data) {
|
|
|
var code = data.code;
|
|
|
|
|
|
|
|
|
if (code === 200) {
|
|
|
$btn.next('.like-count').text(data.data);
|
|
|
|
|
|
// 切换点赞状态
|
|
|
$btn.toggleClass('like');
|
|
|
}
|
...
|
...
|
@@ -143,18 +125,16 @@ function initInfosEvt($container) { |
|
|
}
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// APP收藏
|
|
|
$btn = $this.closest('.collect-btn');
|
|
|
if ($btn.length > 0) {
|
|
|
$container.find('.collect-btn').on('touchend touchcancel', function(e) {
|
|
|
var opt = 'ok', $btn = $(this), $info, isLoading, yhChannel;
|
|
|
e.preventDefault();
|
|
|
if ($btn.hasClass('collected')) {
|
|
|
opt = 'cancel';
|
|
|
}
|
|
|
|
|
|
$info = $this.closest('.guang-info');
|
|
|
|
|
|
$info = $btn.closest('.guang-info');
|
|
|
isLoading = true;
|
|
|
if (getUrlParam('yh_channel')) {
|
|
|
yhChannel = getUrlParam('yh_channel');
|
|
|
}
|
...
|
...
|
@@ -179,7 +159,7 @@ function initInfosEvt($container) { |
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
return;
|
|
|
});
|
|
|
|
|
|
setLazyLoadAndMellipsis($container.find('.guang-info'));
|
...
|
...
|
@@ -253,8 +233,6 @@ function loadMore($container, opt, url) { |
|
|
|
|
|
getDynamicData.getDynamicData();
|
|
|
window.rePosFooter();// 插入内容后重新计算底部位置
|
|
|
|
|
|
getDynamicData.getDynamicData();
|
|
|
}
|
|
|
|
|
|
opt.page++;
|
...
|
...
|
|