Authored by Rock Zhang

打包最新的静态资源

@@ -4547,7 +4547,6 @@ var goodsSwiper; @@ -4547,7 +4547,6 @@ var goodsSwiper;
4547 require("js/product/detail/desc"); 4547 require("js/product/detail/desc");
4548 require("js/product/detail/comments-consults"); 4548 require("js/product/detail/comments-consults");
4549 require("js/product/detail/like"); 4549 require("js/product/detail/like");
4550 -require("js/product/recommend-for-you");  
4551 4550
4552 lazyLoad($('img.lazy')); 4551 lazyLoad($('img.lazy'));
4553 4552
@@ -4586,9 +4585,6 @@ $('.goodsDiscount .dropdown').on('click', function() { @@ -4586,9 +4585,6 @@ $('.goodsDiscount .dropdown').on('click', function() {
4586 $('.goodsDiscount .discount-folder').slideUp(); 4585 $('.goodsDiscount .discount-folder').slideUp();
4587 } 4586 }
4588 }); 4587 });
4589 -  
4590 -  
4591 -  
4592 }); 4588 });
4593 define("js/product/detail/desc", ["jquery","lazyload","swiper","index"], function(require, exports, module){ 4589 define("js/product/detail/desc", ["jquery","lazyload","swiper","index"], function(require, exports, module){
4594 /** 4590 /**
@@ -4640,15 +4636,6 @@ function search() { @@ -4640,15 +4636,6 @@ function search() {
4640 slidesPerView: 'auto' 4636 slidesPerView: 'auto'
4641 }); 4637 });
4642 4638
4643 - //优选  
4644 - // recommendSwiper = new Swiper('#swiper-recommend', {  
4645 - // slidesPerView: 'auto',  
4646 - // grabCursor: true,  
4647 - // slideElement: 'li',  
4648 - // lazyLoading: true,  
4649 - // watchSlidesVisibility: true  
4650 - // });  
4651 -  
4652 searching = false; 4639 searching = false;
4653 end = true; 4640 end = true;
4654 loading.hideLoadingMask(); 4641 loading.hideLoadingMask();
@@ -4694,7 +4681,7 @@ $.get('/home/preference').then(function(html) { @@ -4694,7 +4681,7 @@ $.get('/home/preference').then(function(html) {
4694 recommendSwiper = new Swiper('#swiper-recommend', { 4681 recommendSwiper = new Swiper('#swiper-recommend', {
4695 slidesPerView: 'auto', 4682 slidesPerView: 'auto',
4696 grabCursor: true, 4683 grabCursor: true,
4697 - slideElement: 'li', 4684 + slideElement: 'a',
4698 lazyLoading: true, 4685 lazyLoading: true,
4699 watchSlidesVisibility: true 4686 watchSlidesVisibility: true
4700 }); 4687 });
@@ -4763,11 +4750,12 @@ var $ = require("jquery"), @@ -4763,11 +4750,12 @@ var $ = require("jquery"),
4763 Hammer = require("hammer"), 4750 Hammer = require("hammer"),
4764 tip = require("js/plugin/tip"); 4751 tip = require("js/plugin/tip");
4765 4752
4766 -var likeHammer = new Hammer('#likeBtn'); 4753 +var likeHammer = new Hammer(document.getElementById('likeBtn'));
4767 4754
4768 likeHammer.on('tap', function(e) { 4755 likeHammer.on('tap', function(e) {
4769 var productId = $('#productId').val(), 4756 var productId = $('#productId').val(),
4770 opt; 4757 opt;
  4758 +
4771 var $this = $(this); 4759 var $this = $(this);
4772 4760
4773 if ($this.hasClass('liked')) { 4761 if ($this.hasClass('liked')) {
@@ -4796,7 +4784,12 @@ likeHammer.on('tap', function(e) { @@ -4796,7 +4784,12 @@ likeHammer.on('tap', function(e) {
4796 tip.show('网络断开连接了~'); 4784 tip.show('网络断开连接了~');
4797 } 4785 }
4798 }); 4786 });
  4787 +
4799 }); 4788 });
  4789 +
  4790 +// $('#likeBtn').on('click', function(e) {
  4791 +// return false;
  4792 +// });
4800 }); 4793 });
4801 define("js/me/entry", ["jquery","hammer","lazyload","swiper","handlebars","source-map","index"], function(require, exports, module){ 4794 define("js/me/entry", ["jquery","hammer","lazyload","swiper","handlebars","source-map","index"], function(require, exports, module){
4802 /** 4795 /**
@@ -4811,6 +4804,7 @@ require("js/me/fav"); @@ -4811,6 +4804,7 @@ require("js/me/fav");
4811 require("js/me/index"); 4804 require("js/me/index");
4812 require("js/me/coupons"); 4805 require("js/me/coupons");
4813 require("js/me/online-service"); 4806 require("js/me/online-service");
  4807 +require("js/me/address");
4814 }); 4808 });
4815 define("js/me/order", ["jquery","hammer","lazyload"], function(require, exports, module){ 4809 define("js/me/order", ["jquery","hammer","lazyload"], function(require, exports, module){
4816 /** 4810 /**
@@ -5240,12 +5234,17 @@ define("js/me/index", ["jquery","swiper","index"], function(require, exports, mo @@ -5240,12 +5234,17 @@ define("js/me/index", ["jquery","swiper","index"], function(require, exports, mo
5240 var $ = require("jquery"); 5234 var $ = require("jquery");
5241 var $userAvatar = $('.user-avatar'), 5235 var $userAvatar = $('.user-avatar'),
5242 $listItem = $('.list-item'); 5236 $listItem = $('.list-item');
5243 -var myImage = new Image(); 5237 +var myImage = new Image(),
  5238 + avatar;
5244 5239
5245 require("js/product/recommend-for-you"); 5240 require("js/product/recommend-for-you");
5246 -myImage.src = $userAvatar.attr('src');  
5247 -myImage.onerror = function() {  
5248 - $userAvatar.attr('src', 'http://static.dev.yohobuy.com/img/me/index/user-avatar.png'); 5241 +require("js/product/suspend-cart");
  5242 +
  5243 +// 部分老用户没有头像,显示默认头像
  5244 +avatar = $userAvatar.data('avatar');
  5245 +myImage.src = avatar;
  5246 +myImage.onload = function() {
  5247 + $userAvatar.css('background-image', 'url(' + avatar + ')');
5249 }; 5248 };
5250 5249
5251 $('.yoho-page').on('touchstart', '.list-item, .type-item', function() { 5250 $('.yoho-page').on('touchstart', '.list-item, .type-item', function() {
@@ -5292,3 +5291,161 @@ $questionTab.on('touchend', function() { @@ -5292,3 +5291,161 @@ $questionTab.on('touchend', function() {
5292 }); 5291 });
5293 5292
5294 }); 5293 });
  5294 +define("js/me/address", ["jquery"], function(require, exports, module){
  5295 +/**
  5296 + * 地址管理
  5297 + * @author: bikai<kai.bi@yoho.cn>
  5298 + * @date: 2015/11/17
  5299 + */
  5300 +
  5301 +var $ = require("jquery"),
  5302 + tip = require("js/plugin/tip");
  5303 +
  5304 +var $action = $('.action'),
  5305 + $addressForm = $('.edit-address'),
  5306 + $submit = $('.submit'),
  5307 + $addAddress = $('.add-address'),
  5308 + $editAddressPage = $('.my-edit-address-page'),
  5309 + $addressListPage = $('.my-address-list-page'),
  5310 + $area = $('.area'),
  5311 + $footer = $('#yoho-footer'),
  5312 + $confim = $('.confim-mask'),
  5313 + isSubmiting,
  5314 + deleteId,
  5315 + newArea = [];
  5316 +
  5317 +function editAddress(data) {
  5318 + data = data || {};
  5319 + $addressForm.find('[name="id"]').val(data.id || '');
  5320 + $addressForm.find('[name="consignee"]').val(data.consignee || '');
  5321 + $addressForm.find('[name="mobile"]').val(data.mobile || '');
  5322 + $addressForm.find('[name="area_code"]').val(data.areaCode || '');
  5323 + $addressForm.find('[name="area"]').val(data.area || '');
  5324 + $addressForm.find('[name="address"]').val(data.address || '');
  5325 + $editAddressPage.show();
  5326 +
  5327 + // $addressForm.find('[name="address"]').blur();
  5328 + // $addressForm.find('[name="consignee"]').focus();
  5329 +}
  5330 +
  5331 +$confim.on('touchend', '.cancel', function() {
  5332 + deleteId = null;
  5333 + $confim.hide();
  5334 +}).on('touchend', '.confim', function() {
  5335 + $.ajax({
  5336 + method: 'POST',
  5337 + url: '/home/deladdress',
  5338 + data: {
  5339 + id: deleteId
  5340 + }
  5341 + }).then(function(res) {
  5342 + if ($.type(res) !== 'object') {
  5343 + res = {};
  5344 + }
  5345 + if (res.code !== 200) {
  5346 + tip.show(res.message || '网络出了点问题~');
  5347 + } else {
  5348 + window.location.reload();
  5349 + }
  5350 + }).fail(function() {
  5351 + tip.show('网络出了点问题~');
  5352 + }).always(function() {
  5353 + deleteId = null;
  5354 + $confim.hide();
  5355 + });
  5356 +});
  5357 +
  5358 +// 添加地址
  5359 +$addAddress.on('touchend', function() {
  5360 + editAddress();
  5361 +});
  5362 +
  5363 +// 编辑或删除
  5364 +$action.on('touchend', '.edit', function() {
  5365 + editAddress($(this).data());
  5366 +}).on('touchend', '.del', function() {
  5367 + deleteId = $(this).data('id');
  5368 + $confim.show();
  5369 +});
  5370 +
  5371 +$submit.on('touchend', function() {
  5372 + $addressForm.submit();
  5373 + return false;
  5374 +});
  5375 +
  5376 +$addressForm.on('submit', function() {
  5377 + if (isSubmiting) {
  5378 + return false;
  5379 + }
  5380 +
  5381 + // 简单的表单校验
  5382 + if (!$(this).find('[name="consignee"]').val()) {
  5383 + tip.show('收件人不能为空');
  5384 + $(this).find('[name="consignee"]').focus();
  5385 + return false;
  5386 + }
  5387 + if (!$(this).find('[name="mobile"]').val()) {
  5388 + tip.show('手机号不能为空');
  5389 + $(this).find('[name="mobile"]').focus();
  5390 + return false;
  5391 + }
  5392 + if (!$(this).find('[name="area_code"]').val() || !$(this).find('[name="area"]').val()) {
  5393 + tip.show('省市区不能为空');
  5394 + return false;
  5395 + }
  5396 + if (!$(this).find('[name="address"]').val()) {
  5397 + tip.show('地址不能为空');
  5398 + $(this).find('[name="address"]').focus();
  5399 + return false;
  5400 + }
  5401 +
  5402 + isSubmiting = true;
  5403 + $.ajax({
  5404 + method: 'POST',
  5405 + url: '/home/saveaddress',
  5406 + data: $(this).serialize()
  5407 + }).then(function(res) {
  5408 + if ($.type(res) !== 'object') {
  5409 + res = {};
  5410 + }
  5411 + if (res.code !== 200) {
  5412 + tip.show(res.message || '网络出了点问题~');
  5413 + } else {
  5414 + window.location.reload();
  5415 + }
  5416 + }).fail(function() {
  5417 + tip.show('网络出了点问题~');
  5418 + }).always(function() {
  5419 + isSubmiting = false;
  5420 + });
  5421 + return false;
  5422 +});
  5423 +
  5424 +// 省市区
  5425 +$area.on('touchend', function() {
  5426 + $footer.hide();
  5427 + $addressListPage.show();
  5428 +});
  5429 +
  5430 +$addressListPage.on('touchend', '.address', function() {
  5431 + newArea.push($(this).children('.caption').text());
  5432 + $(this).siblings().hide();
  5433 + $(this).children('ul').show();
  5434 + return false;
  5435 +}).on('touchend', '.address-last', function() {
  5436 +
  5437 + // 填结果到 html
  5438 + newArea.push($(this).children('.caption').text());
  5439 + $('[name="area"]').val(newArea.join(' '));
  5440 + $('[name="area_code"]').val($(this).data('id'));
  5441 +
  5442 + // 恢复默认的三级选择
  5443 + $addressListPage.hide();
  5444 + $addressListPage.find('ul').hide();
  5445 + $addressListPage.children('ul').show().children('li').show();
  5446 + $footer.show();
  5447 + newArea = [];
  5448 + return false;
  5449 +});
  5450 +
  5451 +});
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.