|
|
var $ = require('jquery'),
|
|
|
lazyLoad = require('./common/lazyload'),
|
|
|
Swiper = require('yoho-idangerous.swiper');
|
|
|
ellipsis = require('mlellipsis');
|
|
|
|
|
|
|
|
|
new Swiper('.swiper-container', {
|
|
|
pagination: '.swiper-pagination'
|
...
|
...
|
@@ -12,8 +10,8 @@ new Swiper('.swiper-container', { |
|
|
/**
|
|
|
* 初始化页面功能
|
|
|
*/
|
|
|
exports.init = function() {
|
|
|
$(function() {
|
|
|
exports.init = function () {
|
|
|
$(function () {
|
|
|
var isLogin = $('#is-login').val();
|
|
|
isLogin = isLogin ? isLogin : 'N';
|
|
|
//登录提示变量
|
...
|
...
|
@@ -28,7 +26,7 @@ exports.init = function() { |
|
|
$imgs = imgs;
|
|
|
}
|
|
|
$imgs.lazyload({
|
|
|
effect : 'fadeIn',
|
|
|
effect: 'fadeIn',
|
|
|
effect_speed: 10,
|
|
|
placeholder: 'data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=='
|
|
|
});
|
...
|
...
|
@@ -37,7 +35,7 @@ exports.init = function() { |
|
|
lazyLoad();
|
|
|
|
|
|
//绑定商品信息的收藏和取消收藏事件(相关推荐和搭配模块)
|
|
|
$('.new-arrival-content').delegate('.good-islike', 'touchstart', function(e) {
|
|
|
$('.new-arrival-content').delegate('.good-islike', 'touchstart', function (e) {
|
|
|
var $cur,
|
|
|
$good,
|
|
|
id;
|
...
|
...
|
@@ -53,20 +51,20 @@ exports.init = function() { |
|
|
st: 0,
|
|
|
product_skn: id
|
|
|
}
|
|
|
}).then(function(data) {
|
|
|
}).then(function (data) {
|
|
|
if (data.code === 200) {
|
|
|
$cur.toggleClass('good-like');
|
|
|
} else if (data.code === 400) {
|
|
|
//提示登录信息
|
|
|
$('#login-tip').fadeIn(500, function() {
|
|
|
setTimeout(function() {
|
|
|
$('#login-tip').fadeIn(500, function () {
|
|
|
setTimeout(function () {
|
|
|
$('#login-tip').fadeOut(500);
|
|
|
}, 1000);
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}).delegate('.good-islike', 'click', function(e) {
|
|
|
}).delegate('.good-islike', 'click', function (e) {
|
|
|
if (isLogin === 'N') {
|
|
|
e.preventDefault();
|
|
|
}
|
...
|
...
|
|