|
|
import BScroll from 'better-scroll';
|
|
|
|
|
|
require('scss/magazine/detail.page.scss');
|
|
|
|
|
|
let $ = require('yoho-jquery');
|
...
|
...
|
@@ -5,6 +7,8 @@ let get = require('lodash/get'); |
|
|
let Swiper = require('yoho-swiper');
|
|
|
let dialog = require('js/plugin/dialog');
|
|
|
|
|
|
const downloadPage = '//union.yoho.cn/union/app-downloads.html?union_type=100000000000349';
|
|
|
|
|
|
new Swiper('.swiper-container', {
|
|
|
observer: true,
|
|
|
observeParents: true,
|
...
|
...
|
@@ -17,6 +21,10 @@ new Swiper('.swiper-container', { |
|
|
pagination: '.swiper-pagination',
|
|
|
});
|
|
|
|
|
|
document.body.addEventListener('touchmove', function(e) {
|
|
|
e.preventDefault(); // 阻止默认的处理方式(阻止下拉滑动的效果)
|
|
|
}, {passive: false});
|
|
|
|
|
|
function DragableElm(elm) {
|
|
|
if (!elm || !elm.length || elm._dragable) {
|
|
|
return;
|
...
|
...
|
@@ -53,8 +61,10 @@ function DragableElm(elm) { |
|
|
});
|
|
|
};
|
|
|
|
|
|
elm.find('.detail-container').scroll(e => {
|
|
|
_canDrag = !!(_open && e.target.scrollTop < 10);
|
|
|
let bscroll = new BScroll(elm.find('.detail-container')[0]);
|
|
|
|
|
|
bscroll.on('scrollEnd', pos => {
|
|
|
_canDrag = _open ? pos.y > -10 : true;
|
|
|
});
|
|
|
|
|
|
elm.on('touchstart', e => {
|
...
|
...
|
@@ -123,15 +133,15 @@ $('.to-download').on('click', function() { |
|
|
rightBtnText: '确定'
|
|
|
}
|
|
|
}, function() {
|
|
|
window.location.href = '//union.yoho.cn/union/app-downloads.html?union_type=100000000000349';
|
|
|
window.location.href = downloadPage;
|
|
|
});
|
|
|
});
|
|
|
|
|
|
$('.buy-magazine-now').on('click', function() {
|
|
|
let sku = $(this).data('sku');
|
|
|
let buy = $(this).data('buy');
|
|
|
|
|
|
if (sku) {
|
|
|
window.location.href = `/cart/magazine/ensure?sku=${sku}`;
|
|
|
window.location.href = buy ? `/cart/magazine/ensure?sku=${sku}` : downloadPage;
|
|
|
}
|
|
|
|
|
|
}); |
...
|
...
|
|