...
|
...
|
@@ -3188,9 +3188,10 @@ require("js/product/newsale/newarrival"); |
|
|
require("js/product/newsale/discount");
|
|
|
require("js/product/list");
|
|
|
require("js/product/detail/detail");
|
|
|
require("js/product/detail/desc");
|
|
|
require("js/product/detail/loadmore");
|
|
|
require("js/product/detail/consultform");
|
|
|
});
|
|
|
define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","index"], function(require, exports, module){
|
|
|
define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 新品到着
|
|
|
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
|
...
|
...
|
@@ -3578,7 +3579,7 @@ $listNav.on('touchstart', 'li', function(e) { |
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/plugin/filter", ["jquery"], function(require, exports, module){
|
|
|
define("js/plugin/filter", ["jquery","hammer"], function(require, exports, module){
|
|
|
/**
|
|
|
* 筛选JS
|
|
|
* 暴露三个接口:注册回调、显示filter、隐藏filter
|
...
|
...
|
@@ -3586,9 +3587,8 @@ define("js/plugin/filter", ["jquery"], function(require, exports, module){ |
|
|
* @date: 2015/10/19
|
|
|
*/
|
|
|
|
|
|
var $ = require("jquery");
|
|
|
|
|
|
// Hammer = require('yoho.hammer');
|
|
|
var $ = require("jquery"),
|
|
|
Hammer = require("hammer");
|
|
|
|
|
|
var $filter;
|
|
|
|
...
|
...
|
@@ -3694,8 +3694,7 @@ function subClassifyTapEvt($this) { |
|
|
|
|
|
//初始化筛选
|
|
|
function initFilter(opt) {
|
|
|
|
|
|
// var filterHammer;
|
|
|
var filterHammer;
|
|
|
|
|
|
//注册回调
|
|
|
fCbFn = opt.fCbFn;
|
...
|
...
|
@@ -3708,8 +3707,8 @@ function initFilter(opt) { |
|
|
|
|
|
$filter = $('.filter-mask');
|
|
|
|
|
|
// filterHammer = new Hammer($filter[0]);
|
|
|
$filter.on('touchend', function(e) {
|
|
|
filterHammer = new Hammer($filter[0]);
|
|
|
filterHammer.on('tap', function(e) {
|
|
|
var $this = $(e.target),
|
|
|
$cur;
|
|
|
|
...
|
...
|
@@ -3728,7 +3727,7 @@ function initFilter(opt) { |
|
|
//tap classify
|
|
|
$cur = $this.closest('.classify-item');
|
|
|
|
|
|
e.stopPropagation();
|
|
|
e.srcEvent.stopPropagation();
|
|
|
|
|
|
classifyTapEvt($cur);
|
|
|
}
|
...
|
...
|
@@ -3765,6 +3764,7 @@ exports.showFilter = showFilter; |
|
|
exports.hideFilter = hideFilter;
|
|
|
|
|
|
exports.resetFilter = resetFilter;
|
|
|
|
|
|
});
|
|
|
define("js/product/extract-url", [], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -3833,7 +3833,7 @@ $.ajax({ |
|
|
}
|
|
|
});
|
|
|
});
|
|
|
define("js/product/newsale/discount", ["jquery","swiper","lazyload","index"], function(require, exports, module){
|
|
|
define("js/product/newsale/discount", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 商品列表页
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
...
|
...
|
@@ -4912,10 +4912,9 @@ var $ = require("jquery"), |
|
|
Hammer = require("hammer"),
|
|
|
tip = require("js/plugin/tip");
|
|
|
|
|
|
var likeHammer = new Hammer(document.getElementById('likeBtn'));
|
|
|
var addToCartHammer = new Hammer(document.getElementById('addtoCart'));
|
|
|
|
|
|
var productId = $('#productId').val();
|
|
|
var likeHammer = new Hammer(document.getElementById('likeBtn')),
|
|
|
addToCartHammer = new Hammer(document.getElementById('addtoCart')),
|
|
|
productId = $('#productId').val();
|
|
|
|
|
|
likeHammer.on('tap', function(e) {
|
|
|
var opt,
|
...
|
...
|
@@ -4981,6 +4980,189 @@ addToCartHammer.on('tap', function(e) { |
|
|
|
|
|
|
|
|
});
|
|
|
define("js/product/detail/loadmore", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 商品详情 --滚动页面加载
|
|
|
* @author: Lynnic
|
|
|
* @date: 2015/11/25
|
|
|
*/
|
|
|
var $ = require("jquery"),
|
|
|
loading = require("js/plugin/loading"),
|
|
|
tip = require("js/plugin/tip");
|
|
|
|
|
|
var loadMoreUrl = $('#loadMoreUrl').val(),
|
|
|
$commentsDiv = $('#goods-comments'),
|
|
|
$consultsDiv = $('#goods-consults'),
|
|
|
winH = $(window).height(),
|
|
|
searching = false,
|
|
|
end = false;
|
|
|
|
|
|
var jsonObj;
|
|
|
|
|
|
//插入评论列表底部
|
|
|
function insertCommentsDiv(json) {
|
|
|
var html = '';
|
|
|
var i;
|
|
|
|
|
|
|
|
|
for (i = 0; i < json.length; i++) {
|
|
|
html += '<div class="comment-item">';
|
|
|
html += '<span class="user-name">' + json[i].userName + '</span>';
|
|
|
html += '<span class="goods-spec">' + json[i].desc + '</span>';
|
|
|
html += '<span class="goods-spec">' + json[i].content + '</span>';
|
|
|
html += '<span class="goods-spec">' + json[i].time + '</span>';
|
|
|
}
|
|
|
$commentsDiv.append(html);
|
|
|
}
|
|
|
|
|
|
//插入咨询列表底部
|
|
|
function insertConsultsDiv(json) {
|
|
|
var html = '';
|
|
|
var i;
|
|
|
|
|
|
|
|
|
for (i = 0; i < json.length; i++) {
|
|
|
html += '<div class="consult-item"> ';
|
|
|
html += '<div class="question"> ';
|
|
|
html += '<span class="iconfont"></span> ';
|
|
|
html += '<p> ';
|
|
|
html += json[i].question + '<br> ';
|
|
|
html += '<span class="time">' + json[i].time + '</span> ';
|
|
|
html += '</p> ';
|
|
|
html += '</div> ';
|
|
|
|
|
|
html += '<div class="answer"> ';
|
|
|
html += '<span class="iconfont"></span> ';
|
|
|
html += '<p>' + json[i].answer + '</p> ';
|
|
|
html += '</div> ';
|
|
|
html += '</div> ';
|
|
|
}
|
|
|
$consultsDiv.append(html);
|
|
|
}
|
|
|
|
|
|
function search() {
|
|
|
if (searching || end) {
|
|
|
return;
|
|
|
}
|
|
|
searching = true;
|
|
|
|
|
|
loading.showLoadingMask();
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: loadMoreUrl,
|
|
|
success: function(data) {
|
|
|
if (data.length > 0) {
|
|
|
jsonObj = JSON.parse(data);
|
|
|
if ($commentsDiv.length > 0) {
|
|
|
insertCommentsDiv(jsonObj);
|
|
|
} else if ($consultsDiv.length > 0) {
|
|
|
insertConsultsDiv(jsonObj);
|
|
|
}
|
|
|
}
|
|
|
searching = false;
|
|
|
end = true;
|
|
|
loading.hideLoadingMask();
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
searching = false;
|
|
|
loading.hideLoadingMask();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
function scrollHandler() {
|
|
|
if (!end || $(window).scrollTop() + winH >= $(document).height() - 50) {
|
|
|
search();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//srcoll to load more
|
|
|
$(window).scroll(function() {
|
|
|
window.requestAnimationFrame(scrollHandler);
|
|
|
});
|
|
|
});
|
|
|
define("js/product/detail/consultform", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 我要咨询提交页面
|
|
|
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
|
|
|
* @date: 2015/12/01
|
|
|
*/
|
|
|
var $ = require("jquery"),
|
|
|
tip = require("js/plugin/tip"),
|
|
|
loading = require("js/plugin/loading");
|
|
|
|
|
|
var $consultForm = $('.consult-form'),
|
|
|
$submit = $('#submit'),
|
|
|
$content = $('#content'),
|
|
|
productId = $('#product_id').val(),
|
|
|
isSubmiting;
|
|
|
|
|
|
$submit.on('touchend', function() {
|
|
|
$content.blur();
|
|
|
$consultForm.submit();
|
|
|
return false;
|
|
|
}).on('touchstart', function() {
|
|
|
$(this).addClass('highlight');
|
|
|
}).on('touchend touchcancel', function() {
|
|
|
$(this).removeClass('highlight');
|
|
|
});
|
|
|
|
|
|
$content.on('focus', function() {
|
|
|
if ($content.val() === '请输入咨询内容') {
|
|
|
$content.val('');
|
|
|
}
|
|
|
}).on('blur', function() {
|
|
|
if ($content.val() === '') {
|
|
|
$content.val('请输入咨询内容');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 提交表单请求
|
|
|
$consultForm.on('submit', function() {
|
|
|
var content;
|
|
|
|
|
|
if (isSubmiting) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
// 简单的表单校验
|
|
|
content = $content.val();
|
|
|
if (!content || content === '请输入咨询内容') {
|
|
|
tip.show('咨询内容不能为空');
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
isSubmiting = true;
|
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
method: 'POST',
|
|
|
url: '/product/detail/consultsubmit',
|
|
|
data: {
|
|
|
product_id: productId,
|
|
|
content: content
|
|
|
}
|
|
|
}).then(function(res) {
|
|
|
if ($.type(res) !== 'object') {
|
|
|
res = {};
|
|
|
}
|
|
|
if (res.code !== 200) {
|
|
|
tip.show(res.message || '网络出了点问题~');
|
|
|
isSubmiting = false;
|
|
|
loading.hideLoadingMask();
|
|
|
} else {
|
|
|
window.history.go(-1);
|
|
|
}
|
|
|
}).fail(function() {
|
|
|
tip.show('网络出了点问题~');
|
|
|
isSubmiting = false;
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){
|
|
|
/**
|
|
|
* 个人中心js打包入口文件
|
...
|
...
|
|