Authored by Rock Zhang

更新到201512041158静态资源

@@ -3188,9 +3188,10 @@ require("js/product/newsale/newarrival"); @@ -3188,9 +3188,10 @@ require("js/product/newsale/newarrival");
3188 require("js/product/newsale/discount"); 3188 require("js/product/newsale/discount");
3189 require("js/product/list"); 3189 require("js/product/list");
3190 require("js/product/detail/detail"); 3190 require("js/product/detail/detail");
3191 -require("js/product/detail/desc"); 3191 +require("js/product/detail/loadmore");
  3192 +require("js/product/detail/consultform");
3192 }); 3193 });
3193 -define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","index"], function(require, exports, module){ 3194 +define("js/product/newsale/newarrival", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){
3194 /** 3195 /**
3195 * 新品到着 3196 * 新品到着
3196 * @author: liangzhifeng<zhifeng.liang@yoho.cn> 3197 * @author: liangzhifeng<zhifeng.liang@yoho.cn>
@@ -3578,7 +3579,7 @@ $listNav.on('touchstart', 'li', function(e) { @@ -3578,7 +3579,7 @@ $listNav.on('touchstart', 'li', function(e) {
3578 }); 3579 });
3579 3580
3580 }); 3581 });
3581 -define("js/plugin/filter", ["jquery"], function(require, exports, module){ 3582 +define("js/plugin/filter", ["jquery","hammer"], function(require, exports, module){
3582 /** 3583 /**
3583 * 筛选JS 3584 * 筛选JS
3584 * 暴露三个接口:注册回调、显示filter、隐藏filter 3585 * 暴露三个接口:注册回调、显示filter、隐藏filter
@@ -3586,9 +3587,8 @@ define("js/plugin/filter", ["jquery"], function(require, exports, module){ @@ -3586,9 +3587,8 @@ define("js/plugin/filter", ["jquery"], function(require, exports, module){
3586 * @date: 2015/10/19 3587 * @date: 2015/10/19
3587 */ 3588 */
3588 3589
3589 -var $ = require("jquery");  
3590 -  
3591 -// Hammer = require('yoho.hammer'); 3590 +var $ = require("jquery"),
  3591 + Hammer = require("hammer");
3592 3592
3593 var $filter; 3593 var $filter;
3594 3594
@@ -3694,8 +3694,7 @@ function subClassifyTapEvt($this) { @@ -3694,8 +3694,7 @@ function subClassifyTapEvt($this) {
3694 3694
3695 //初始化筛选 3695 //初始化筛选
3696 function initFilter(opt) { 3696 function initFilter(opt) {
3697 -  
3698 - // var filterHammer; 3697 + var filterHammer;
3699 3698
3700 //注册回调 3699 //注册回调
3701 fCbFn = opt.fCbFn; 3700 fCbFn = opt.fCbFn;
@@ -3708,8 +3707,8 @@ function initFilter(opt) { @@ -3708,8 +3707,8 @@ function initFilter(opt) {
3708 3707
3709 $filter = $('.filter-mask'); 3708 $filter = $('.filter-mask');
3710 3709
3711 - // filterHammer = new Hammer($filter[0]);  
3712 - $filter.on('touchend', function(e) { 3710 + filterHammer = new Hammer($filter[0]);
  3711 + filterHammer.on('tap', function(e) {
3713 var $this = $(e.target), 3712 var $this = $(e.target),
3714 $cur; 3713 $cur;
3715 3714
@@ -3728,7 +3727,7 @@ function initFilter(opt) { @@ -3728,7 +3727,7 @@ function initFilter(opt) {
3728 //tap classify 3727 //tap classify
3729 $cur = $this.closest('.classify-item'); 3728 $cur = $this.closest('.classify-item');
3730 3729
3731 - e.stopPropagation(); 3730 + e.srcEvent.stopPropagation();
3732 3731
3733 classifyTapEvt($cur); 3732 classifyTapEvt($cur);
3734 } 3733 }
@@ -3765,6 +3764,7 @@ exports.showFilter = showFilter; @@ -3765,6 +3764,7 @@ exports.showFilter = showFilter;
3765 exports.hideFilter = hideFilter; 3764 exports.hideFilter = hideFilter;
3766 3765
3767 exports.resetFilter = resetFilter; 3766 exports.resetFilter = resetFilter;
  3767 +
3768 }); 3768 });
3769 define("js/product/extract-url", [], function(require, exports, module){ 3769 define("js/product/extract-url", [], function(require, exports, module){
3770 /** 3770 /**
@@ -3833,7 +3833,7 @@ $.ajax({ @@ -3833,7 +3833,7 @@ $.ajax({
3833 } 3833 }
3834 }); 3834 });
3835 }); 3835 });
3836 -define("js/product/newsale/discount", ["jquery","swiper","lazyload","index"], function(require, exports, module){ 3836 +define("js/product/newsale/discount", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){
3837 /** 3837 /**
3838 * 商品列表页 3838 * 商品列表页
3839 * @author: xuqi<qi.xu@yoho.cn> 3839 * @author: xuqi<qi.xu@yoho.cn>
@@ -4912,10 +4912,9 @@ var $ = require("jquery"), @@ -4912,10 +4912,9 @@ var $ = require("jquery"),
4912 Hammer = require("hammer"), 4912 Hammer = require("hammer"),
4913 tip = require("js/plugin/tip"); 4913 tip = require("js/plugin/tip");
4914 4914
4915 -var likeHammer = new Hammer(document.getElementById('likeBtn'));  
4916 -var addToCartHammer = new Hammer(document.getElementById('addtoCart'));  
4917 -  
4918 -var productId = $('#productId').val(); 4915 +var likeHammer = new Hammer(document.getElementById('likeBtn')),
  4916 + addToCartHammer = new Hammer(document.getElementById('addtoCart')),
  4917 + productId = $('#productId').val();
4919 4918
4920 likeHammer.on('tap', function(e) { 4919 likeHammer.on('tap', function(e) {
4921 var opt, 4920 var opt,
@@ -4981,6 +4980,189 @@ addToCartHammer.on('tap', function(e) { @@ -4981,6 +4980,189 @@ addToCartHammer.on('tap', function(e) {
4981 4980
4982 4981
4983 }); 4982 });
  4983 +define("js/product/detail/loadmore", ["jquery"], function(require, exports, module){
  4984 +/**
  4985 + * 商品详情 --滚动页面加载
  4986 + * @author: Lynnic
  4987 + * @date: 2015/11/25
  4988 + */
  4989 +var $ = require("jquery"),
  4990 + loading = require("js/plugin/loading"),
  4991 + tip = require("js/plugin/tip");
  4992 +
  4993 +var loadMoreUrl = $('#loadMoreUrl').val(),
  4994 + $commentsDiv = $('#goods-comments'),
  4995 + $consultsDiv = $('#goods-consults'),
  4996 + winH = $(window).height(),
  4997 + searching = false,
  4998 + end = false;
  4999 +
  5000 +var jsonObj;
  5001 +
  5002 +//插入评论列表底部
  5003 +function insertCommentsDiv(json) {
  5004 + var html = '';
  5005 + var i;
  5006 +
  5007 +
  5008 + for (i = 0; i < json.length; i++) {
  5009 + html += '<div class="comment-item">';
  5010 + html += '<span class="user-name">' + json[i].userName + '</span>';
  5011 + html += '<span class="goods-spec">' + json[i].desc + '</span>';
  5012 + html += '<span class="goods-spec">' + json[i].content + '</span>';
  5013 + html += '<span class="goods-spec">' + json[i].time + '</span>';
  5014 + }
  5015 + $commentsDiv.append(html);
  5016 +}
  5017 +
  5018 +//插入咨询列表底部
  5019 +function insertConsultsDiv(json) {
  5020 + var html = '';
  5021 + var i;
  5022 +
  5023 +
  5024 + for (i = 0; i < json.length; i++) {
  5025 + html += '<div class="consult-item"> ';
  5026 + html += '<div class="question"> ';
  5027 + html += '<span class="iconfont">&#xe639;</span> ';
  5028 + html += '<p> ';
  5029 + html += json[i].question + '<br> ';
  5030 + html += '<span class="time">' + json[i].time + '</span> ';
  5031 + html += '</p> ';
  5032 + html += '</div> ';
  5033 +
  5034 + html += '<div class="answer"> ';
  5035 + html += '<span class="iconfont">&#xe63c;</span> ';
  5036 + html += '<p>' + json[i].answer + '</p> ';
  5037 + html += '</div> ';
  5038 + html += '</div> ';
  5039 + }
  5040 + $consultsDiv.append(html);
  5041 +}
  5042 +
  5043 +function search() {
  5044 + if (searching || end) {
  5045 + return;
  5046 + }
  5047 + searching = true;
  5048 +
  5049 + loading.showLoadingMask();
  5050 +
  5051 + $.ajax({
  5052 + type: 'GET',
  5053 + url: loadMoreUrl,
  5054 + success: function(data) {
  5055 + if (data.length > 0) {
  5056 + jsonObj = JSON.parse(data);
  5057 + if ($commentsDiv.length > 0) {
  5058 + insertCommentsDiv(jsonObj);
  5059 + } else if ($consultsDiv.length > 0) {
  5060 + insertConsultsDiv(jsonObj);
  5061 + }
  5062 + }
  5063 + searching = false;
  5064 + end = true;
  5065 + loading.hideLoadingMask();
  5066 + },
  5067 + error: function() {
  5068 + tip.show('网络断开连接了~');
  5069 + searching = false;
  5070 + loading.hideLoadingMask();
  5071 + }
  5072 + });
  5073 +}
  5074 +
  5075 +
  5076 +function scrollHandler() {
  5077 + if (!end || $(window).scrollTop() + winH >= $(document).height() - 50) {
  5078 + search();
  5079 + }
  5080 +}
  5081 +
  5082 +//srcoll to load more
  5083 +$(window).scroll(function() {
  5084 + window.requestAnimationFrame(scrollHandler);
  5085 +});
  5086 +});
  5087 +define("js/product/detail/consultform", ["jquery"], function(require, exports, module){
  5088 +/**
  5089 + * 我要咨询提交页面
  5090 + * @author: liangzhifeng<zhifeng.liang@yoho.cn>
  5091 + * @date: 2015/12/01
  5092 + */
  5093 +var $ = require("jquery"),
  5094 + tip = require("js/plugin/tip"),
  5095 + loading = require("js/plugin/loading");
  5096 +
  5097 +var $consultForm = $('.consult-form'),
  5098 + $submit = $('#submit'),
  5099 + $content = $('#content'),
  5100 + productId = $('#product_id').val(),
  5101 + isSubmiting;
  5102 +
  5103 +$submit.on('touchend', function() {
  5104 + $content.blur();
  5105 + $consultForm.submit();
  5106 + return false;
  5107 +}).on('touchstart', function() {
  5108 + $(this).addClass('highlight');
  5109 +}).on('touchend touchcancel', function() {
  5110 + $(this).removeClass('highlight');
  5111 +});
  5112 +
  5113 +$content.on('focus', function() {
  5114 + if ($content.val() === '请输入咨询内容') {
  5115 + $content.val('');
  5116 + }
  5117 +}).on('blur', function() {
  5118 + if ($content.val() === '') {
  5119 + $content.val('请输入咨询内容');
  5120 + }
  5121 +});
  5122 +
  5123 +// 提交表单请求
  5124 +$consultForm.on('submit', function() {
  5125 + var content;
  5126 +
  5127 + if (isSubmiting) {
  5128 + return false;
  5129 + }
  5130 +
  5131 + // 简单的表单校验
  5132 + content = $content.val();
  5133 + if (!content || content === '请输入咨询内容') {
  5134 + tip.show('咨询内容不能为空');
  5135 + return false;
  5136 + }
  5137 +
  5138 + isSubmiting = true;
  5139 + loading.showLoadingMask();
  5140 + $.ajax({
  5141 + method: 'POST',
  5142 + url: '/product/detail/consultsubmit',
  5143 + data: {
  5144 + product_id: productId,
  5145 + content: content
  5146 + }
  5147 + }).then(function(res) {
  5148 + if ($.type(res) !== 'object') {
  5149 + res = {};
  5150 + }
  5151 + if (res.code !== 200) {
  5152 + tip.show(res.message || '网络出了点问题~');
  5153 + isSubmiting = false;
  5154 + loading.hideLoadingMask();
  5155 + } else {
  5156 + window.history.go(-1);
  5157 + }
  5158 + }).fail(function() {
  5159 + tip.show('网络出了点问题~');
  5160 + isSubmiting = false;
  5161 + });
  5162 + return false;
  5163 +});
  5164 +
  5165 +});
4984 define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){ 5166 define("js/me/entry", ["jquery","hammer","lazyload","handlebars","source-map","swiper","mlellipsis","index"], function(require, exports, module){
4985 /** 5167 /**
4986 * 个人中心js打包入口文件 5168 * 个人中心js打包入口文件
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.