Authored by 郭成尧

'shop-fav'

@@ -43,7 +43,7 @@ var winH = $(window).height(), @@ -43,7 +43,7 @@ var winH = $(window).height(),
43 require('../../common'); 43 require('../../common');
44 44
45 // pagecache判断app设置cookie,判断是否收藏 45 // pagecache判断app设置cookie,判断是否收藏
46 -(function () { 46 +(function() {
47 var param = location.search; 47 var param = location.search;
48 var isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1; 48 var isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
49 49
@@ -51,7 +51,7 @@ require('../../common'); @@ -51,7 +51,7 @@ require('../../common');
51 $.ajax({ 51 $.ajax({
52 type: 'GET', 52 type: 'GET',
53 url: '/product/index/shopAppCookie', 53 url: '/product/index/shopAppCookie',
54 - error: function () { 54 + error: function() {
55 tip.show('网络断开连接了~'); 55 tip.show('网络断开连接了~');
56 } 56 }
57 }); 57 });
@@ -63,12 +63,12 @@ require('../../common'); @@ -63,12 +63,12 @@ require('../../common');
63 data: { 63 data: {
64 shopId: $('.shopid').val(), 64 shopId: $('.shopid').val(),
65 }, 65 },
66 - success: function (data) { 66 + success: function(data) {
67 if (data.collect) { 67 if (data.collect) {
68 $collect.attr('class', 'already-collect'); 68 $collect.attr('class', 'already-collect');
69 } 69 }
70 }, 70 },
71 - error: function () { 71 + error: function() {
72 tip.show('网络断开连接了~'); 72 tip.show('网络断开连接了~');
73 } 73 }
74 }); 74 });
@@ -191,14 +191,14 @@ function getPageGoods(info) { @@ -191,14 +191,14 @@ function getPageGoods(info) {
191 type: 'GET', 191 type: 'GET',
192 url: info.url, 192 url: info.url,
193 data: info.data, 193 data: info.data,
194 - success: function (data) { 194 + success: function(data) {
195 if (data === ' ') { 195 if (data === ' ') {
196 nav.end = true; 196 nav.end = true;
197 } 197 }
198 198
199 info.callBack(data); 199 info.callBack(data);
200 }, 200 },
201 - error: function () { 201 + error: function() {
202 tip.show('网络断开连接了~'); 202 tip.show('网络断开连接了~');
203 searching = false; 203 searching = false;
204 } 204 }
@@ -228,7 +228,7 @@ function newData(callback) { @@ -228,7 +228,7 @@ function newData(callback) {
228 228
229 getParam(req); 229 getParam(req);
230 230
231 - req.callBack = function (data) { 231 + req.callBack = function(data) {
232 $('#new-arrival').append(data); 232 $('#new-arrival').append(data);
233 navInfo.new.page++; 233 navInfo.new.page++;
234 myScroll && myScroll.refresh(); 234 myScroll && myScroll.refresh();
@@ -253,7 +253,7 @@ function hotData(callback) { @@ -253,7 +253,7 @@ function hotData(callback) {
253 253
254 getParam(req); 254 getParam(req);
255 255
256 - req.callBack = function (data) { 256 + req.callBack = function(data) {
257 $('#popularity').append(data); 257 $('#popularity').append(data);
258 navInfo.hot.page++; 258 navInfo.hot.page++;
259 myScroll && myScroll.refresh(); 259 myScroll && myScroll.refresh();
@@ -274,9 +274,9 @@ function tabChange(dom, index) { @@ -274,9 +274,9 @@ function tabChange(dom, index) {
274 274
275 275
276 // 首页导航 276 // 首页导航
277 -(function (nav, posNav, main) { 277 +(function(nav, posNav, main) {
278 278
279 - $(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function () { 279 + $(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() {
280 280
281 var index = $(this).index(), 281 var index = $(this).index(),
282 activeTab = $(this).attr('tab'); 282 activeTab = $(this).attr('tab');
@@ -374,7 +374,7 @@ function scrollHandler() { @@ -374,7 +374,7 @@ function scrollHandler() {
374 } 374 }
375 375
376 if (sTop + winH * 2 > scH) { 376 if (sTop + winH * 2 > scH) {
377 - scrollCall = function () { 377 + scrollCall = function() {
378 var translate = 'translate3d(0, ' + (-scH) + 'px, 0)'; 378 var translate = 'translate3d(0, ' + (-scH) + 'px, 0)';
379 $nav1.css({ 379 $nav1.css({
380 transform: translate, 380 transform: translate,
@@ -466,7 +466,7 @@ function scrollHandler() { @@ -466,7 +466,7 @@ function scrollHandler() {
466 $('#scroller').trigger('scroll'); 466 $('#scroller').trigger('scroll');
467 } 467 }
468 468
469 -document.addEventListener('touchmove', function (e) { 469 +document.addEventListener('touchmove', function(e) {
470 // sub classify不阻止默认事件 470 // sub classify不阻止默认事件
471 if ($(e.target).closest('.sub-classify').length === 0) { 471 if ($(e.target).closest('.sub-classify').length === 0) {
472 e.preventDefault(); 472 e.preventDefault();
@@ -479,7 +479,7 @@ document.addEventListener('touchmove', function (e) { @@ -479,7 +479,7 @@ document.addEventListener('touchmove', function (e) {
479 479
480 480
481 // window ready 后重新refresh iscroll 481 // window ready 后重新refresh iscroll
482 -$(window).ready(function () { 482 +$(window).ready(function() {
483 // myScroll && myScroll.refresh(); 483 // myScroll && myScroll.refresh();
484 imgH = $('#nav-top').outerHeight(); 484 imgH = $('#nav-top').outerHeight();
485 nav1H = $('#nav').outerHeight(); 485 nav1H = $('#nav').outerHeight();
@@ -495,14 +495,14 @@ $(window).ready(function () { @@ -495,14 +495,14 @@ $(window).ready(function () {
495 click: true 495 click: true
496 }); 496 });
497 497
498 - setTimeout(function () { 498 + setTimeout(function() {
499 scH = $('#scroller').outerHeight(); 499 scH = $('#scroller').outerHeight();
500 }, 500); 500 }, 500);
501 501
502 502
503 myScroll.on('scroll', scrollHandler); 503 myScroll.on('scroll', scrollHandler);
504 504
505 - myScroll.on('scrollStart', function () { 505 + myScroll.on('scrollStart', function() {
506 506
507 // stop auto play when scroll 507 // stop auto play when scroll
508 bannerSwiper && bannerSwiper.stopAutoplay(); 508 bannerSwiper && bannerSwiper.stopAutoplay();
@@ -510,7 +510,7 @@ $(window).ready(function () { @@ -510,7 +510,7 @@ $(window).ready(function () {
510 multiSwiper && multiSwiper.stopAutoplay(); 510 multiSwiper && multiSwiper.stopAutoplay();
511 }); 511 });
512 512
513 - myScroll.on('scrollEnd', function () { 513 + myScroll.on('scrollEnd', function() {
514 514
515 // start auto play when scroll end 515 // start auto play when scroll end
516 bannerSwiper && bannerSwiper.startAutoplay(); 516 bannerSwiper && bannerSwiper.startAutoplay();
@@ -655,7 +655,7 @@ function search(opt) { @@ -655,7 +655,7 @@ function search(opt) {
655 type: 'GET', 655 type: 'GET',
656 url: opt.url ? opt.url : '', 656 url: opt.url ? opt.url : '',
657 data: setting, 657 data: setting,
658 - success: function (data) { 658 + success: function(data) {
659 var $container, 659 var $container,
660 num; 660 num;
661 661
@@ -705,7 +705,7 @@ function search(opt) { @@ -705,7 +705,7 @@ function search(opt) {
705 705
706 bindGoodThumbClick(); 706 bindGoodThumbClick();
707 }, 707 },
708 - error: function () { 708 + error: function() {
709 tip.show('网络断开连接了~'); 709 tip.show('网络断开连接了~');
710 searching = false; 710 searching = false;
711 loading.hideLoadingMask(); 711 loading.hideLoadingMask();
@@ -714,11 +714,11 @@ function search(opt) { @@ -714,11 +714,11 @@ function search(opt) {
714 } 714 }
715 715
716 716
717 -$listNav.bind('contextmenu', function (e) { 717 +$listNav.bind('contextmenu', function(e) {
718 return false; 718 return false;
719 }); 719 });
720 720
721 -$subNav.on('touchend touchcancel', function (e) { 721 +$subNav.on('touchend touchcancel', function(e) {
722 var $this = $(e.target).closest('li'), 722 var $this = $(e.target).closest('li'),
723 cname, 723 cname,
724 nav, 724 nav,
@@ -861,11 +861,11 @@ $subNav.on('touchend touchcancel', function (e) { @@ -861,11 +861,11 @@ $subNav.on('touchend touchcancel', function (e) {
861 }); 861 });
862 862
863 filter.initFilter({ 863 filter.initFilter({
864 - fCbFn: function (option) { 864 + fCbFn: function(option) {
865 search(option); 865 search(option);
866 myScroll && myScroll.enable(); 866 myScroll && myScroll.enable();
867 }, 867 },
868 - hCbFn: function () { 868 + hCbFn: function() {
869 869
870 // 切换active状态到$pre上 870 // 切换active状态到$pre上
871 $pre.addClass('active'); 871 $pre.addClass('active');
@@ -876,17 +876,17 @@ filter.initFilter({ @@ -876,17 +876,17 @@ filter.initFilter({
876 missStatus: true 876 missStatus: true
877 }); 877 });
878 878
879 -$listNav.on('touchstart', 'li', function (e) { 879 +$listNav.on('touchstart', 'li', function(e) {
880 $(this).addClass('bytouch'); 880 $(this).addClass('bytouch');
881 -}).on('touchend touchcancel', function () { 881 +}).on('touchend touchcancel', function() {
882 $listNav.find('li').removeClass('bytouch'); 882 $listNav.find('li').removeClass('bytouch');
883 883
884 // myScroll && myScroll.refresh(); 884 // myScroll && myScroll.refresh();
885 }); 885 });
886 886
887 -$nav2.on('touchstart', 'li', function (e) { 887 +$nav2.on('touchstart', 'li', function(e) {
888 $(this).addClass('bytouch'); 888 $(this).addClass('bytouch');
889 -}).on('touchend touchcancel', function () { 889 +}).on('touchend touchcancel', function() {
890 $nav2.find('li').removeClass('bytouch'); 890 $nav2.find('li').removeClass('bytouch');
891 891
892 // myScroll && myScroll.refresh(); 892 // myScroll && myScroll.refresh();
@@ -894,7 +894,7 @@ $nav2.on('touchstart', 'li', function (e) { @@ -894,7 +894,7 @@ $nav2.on('touchstart', 'li', function (e) {
894 894
895 // 底部导航点击 895 // 底部导航点击
896 function fotterClick(group) { 896 function fotterClick(group) {
897 - $(group + ' li').on('touchstart', function () { 897 + $(group + ' li').on('touchstart', function() {
898 $('.sub-group').addClass('hide'); 898 $('.sub-group').addClass('hide');
899 $(this).find('.sub-group').removeClass('hide'); 899 $(this).find('.sub-group').removeClass('hide');
900 }); 900 });
@@ -910,16 +910,16 @@ function stopPropagation(e) { @@ -910,16 +910,16 @@ function stopPropagation(e) {
910 } 910 }
911 } 911 }
912 912
913 -$(document).bind('touchstart', function () { 913 +$(document).bind('touchstart', function() {
914 $('.sub-group').addClass('hide'); 914 $('.sub-group').addClass('hide');
915 }); 915 });
916 916
917 -$('.shop-foot-wrapper').bind('touchstart', function (e) { 917 +$('.shop-foot-wrapper').bind('touchstart', function(e) {
918 stopPropagation(e); 918 stopPropagation(e);
919 }); 919 });
920 920
921 // 店铺收藏 || 取消收藏 921 // 店铺收藏 || 取消收藏
922 -$collect.on('touchstart', function () { 922 +$collect.on('touchstart', function() {
923 var opt; 923 var opt;
924 924
925 if (searching) { 925 if (searching) {
@@ -945,7 +945,7 @@ $collect.on('touchstart', function () { @@ -945,7 +945,7 @@ $collect.on('touchstart', function () {
945 xhrFields: { 945 xhrFields: {
946 withCredentials: true 946 withCredentials: true
947 }, 947 },
948 - success: function (data) { 948 + success: function(data) {
949 var url = ''; 949 var url = '';
950 950
951 if (data.code === 200) { 951 if (data.code === 200) {
@@ -966,13 +966,13 @@ $collect.on('touchstart', function () { @@ -966,13 +966,13 @@ $collect.on('touchstart', function () {
966 $('#jump-login').click(); 966 $('#jump-login').click();
967 } 967 }
968 968
969 - setTimeout(function () { 969 + setTimeout(function() {
970 myScroll && myScroll.refresh(); 970 myScroll && myScroll.refresh();
971 scH = $('#scroller').outerHeight(); 971 scH = $('#scroller').outerHeight();
972 }, 500); 972 }, 500);
973 searching = false; 973 searching = false;
974 }, 974 },
975 - error: function () { 975 + error: function() {
976 tip.show('网络断开连接了~'); 976 tip.show('网络断开连接了~');
977 searching = false; 977 searching = false;
978 } 978 }