Showing
3 changed files
with
74 additions
and
74 deletions
@@ -104,9 +104,9 @@ const _shop = (req, res, shopId) => { | @@ -104,9 +104,9 @@ const _shop = (req, res, shopId) => { | ||
104 | shopHeadHide: true, | 104 | shopHeadHide: true, |
105 | gender: req.query.gender, | 105 | gender: req.query.gender, |
106 | channel: req.query.channel, | 106 | channel: req.query.channel, |
107 | - pageHeader: headerModel.setNav({ | ||
108 | - navTitle: result.storeName | ||
109 | - }), | 107 | + // pageHeader: headerModel.setNav({ |
108 | + // navTitle: result.storeName | ||
109 | + // }), | ||
110 | title: result.storeName + '|' + result.storeName + '潮流服装服饰-Yoho!Buy有货', | 110 | title: result.storeName + '|' + result.storeName + '潮流服装服饰-Yoho!Buy有货', |
111 | keywords: result.storeName + ',' + result.storeName + '服装服饰,' + result.storeName + '潮流服装服饰', | 111 | keywords: result.storeName + ',' + result.storeName + '服装服饰,' + result.storeName + '潮流服装服饰', |
112 | description: result.storeName + '|Yoho!Buy有货' + result.storeName + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。', | 112 | description: result.storeName + '|Yoho!Buy有货' + result.storeName + '潮流服饰官方授权店!100%品牌正品保证,支持货到付款。', |
@@ -305,7 +305,10 @@ const shopIntro = (req, res, next) => { | @@ -305,7 +305,10 @@ const shopIntro = (req, res, next) => { | ||
305 | * opt 操作标识("ok":表示收藏,"cancel":表示取消收藏) | 305 | * opt 操作标识("ok":表示收藏,"cancel":表示取消收藏) |
306 | */ | 306 | */ |
307 | const favoriteBrand = (req, res, next) => { | 307 | const favoriteBrand = (req, res, next) => { |
308 | - res.setHeader('Access-Control-Allow-Origin', req.protocol + '://' + req.headers.origin); | 308 | + let allowOrigin = _.get(req, 'headers.origin', null) ? |
309 | + req.headers.origin : req.protocol + '://' + req.headers.host; | ||
310 | + | ||
311 | + res.setHeader('Access-Control-Allow-Origin', allowOrigin); | ||
309 | res.setHeader('Access-Control-Allow-Credentials', 'true'); | 312 | res.setHeader('Access-Control-Allow-Credentials', 'true'); |
310 | 313 | ||
311 | let id = req.query.id; | 314 | let id = req.query.id; |
@@ -313,29 +316,28 @@ const favoriteBrand = (req, res, next) => { | @@ -313,29 +316,28 @@ const favoriteBrand = (req, res, next) => { | ||
313 | let opt = req.query.opt || 'ok'; | 316 | let opt = req.query.opt || 'ok'; |
314 | let type = req.query.type || 'product'; | 317 | let type = req.query.type || 'product'; |
315 | let appVersion = req.query.appVersion || false; | 318 | let appVersion = req.query.appVersion || false; |
316 | - let url = helpers.urlFormat('/signin.html') + '?refer=' + decodeURI(req.cookies.refer); | 319 | + let refer = req.get('Referer') || `${global.yoho.config.siteUrl}/${req.cookies._Channel || ''}`; |
320 | + let url = helpers.urlFormat('/signin.html') + '?refer=' + refer; | ||
317 | 321 | ||
318 | if (appVersion === 'true') { | 322 | if (appVersion === 'true') { |
319 | uid = req.cookies.appUid; | 323 | uid = req.cookies.appUid; |
320 | url = `${url}&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":${decodeURI(req.cookies.refer)},"param":{}},"requesturl":{"param":{},"url":""},"priority":"Y"}}`; // eslint-disable-line | 324 | url = `${url}&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":${decodeURI(req.cookies.refer)},"param":{}},"requesturl":{"param":{},"url":""},"priority":"Y"}}`; // eslint-disable-line |
321 | } | 325 | } |
322 | 326 | ||
323 | - if (_.isNumber(id)) { | ||
324 | - res.json({ | 327 | + if (!id) { |
328 | + return res.json({ | ||
325 | code: 401, | 329 | code: 401, |
326 | message: '参数不正确', | 330 | message: '参数不正确', |
327 | data: false | 331 | data: false |
328 | }); | 332 | }); |
329 | - return false; | ||
330 | } | 333 | } |
331 | 334 | ||
332 | if (!uid) { | 335 | if (!uid) { |
333 | - res.json({ | 336 | + return res.json({ |
334 | code: 400, | 337 | code: 400, |
335 | message: '未登录', | 338 | message: '未登录', |
336 | data: url | 339 | data: url |
337 | }); | 340 | }); |
338 | - return false; | ||
339 | } | 341 | } |
340 | 342 | ||
341 | if (opt !== 'ok') { // 取消收藏 | 343 | if (opt !== 'ok') { // 取消收藏 |
@@ -72,7 +72,7 @@ require('../../common'); | @@ -72,7 +72,7 @@ require('../../common'); | ||
72 | ellipsis.init(); | 72 | ellipsis.init(); |
73 | 73 | ||
74 | // pageCache 获取是否收藏 | 74 | // pageCache 获取是否收藏 |
75 | -(function() { | 75 | +(function () { |
76 | if ($('.domain').val()) { | 76 | if ($('.domain').val()) { |
77 | $.ajax({ | 77 | $.ajax({ |
78 | url: '/product/index/brandFav', | 78 | url: '/product/index/brandFav', |
@@ -80,12 +80,12 @@ ellipsis.init(); | @@ -80,12 +80,12 @@ ellipsis.init(); | ||
80 | domain: $('.domain').val() | 80 | domain: $('.domain').val() |
81 | }, | 81 | }, |
82 | dataType: 'json', | 82 | dataType: 'json', |
83 | - success: function(data) { | 83 | + success: function (data) { |
84 | if (data.collected) { | 84 | if (data.collected) { |
85 | $('.brand-header .btn-col').addClass('coled'); | 85 | $('.brand-header .btn-col').addClass('coled'); |
86 | } | 86 | } |
87 | }, | 87 | }, |
88 | - error: function() { | 88 | + error: function () { |
89 | tip.show('网络断开连接了~'); | 89 | tip.show('网络断开连接了~'); |
90 | } | 90 | } |
91 | }); | 91 | }); |
@@ -96,12 +96,12 @@ ellipsis.init(); | @@ -96,12 +96,12 @@ ellipsis.init(); | ||
96 | shopId: $('.shopId').val() | 96 | shopId: $('.shopId').val() |
97 | }, | 97 | }, |
98 | dataType: 'json', | 98 | dataType: 'json', |
99 | - success: function(data) { | 99 | + success: function (data) { |
100 | if (data.collect) { | 100 | if (data.collect) { |
101 | $('.brand-header .btn-col').addClass('coled'); | 101 | $('.brand-header .btn-col').addClass('coled'); |
102 | } | 102 | } |
103 | }, | 103 | }, |
104 | - error: function() { | 104 | + error: function () { |
105 | tip.show('网络断开连接了~'); | 105 | tip.show('网络断开连接了~'); |
106 | } | 106 | } |
107 | }); | 107 | }); |
@@ -114,7 +114,7 @@ function inputAction() { | @@ -114,7 +114,7 @@ function inputAction() { | ||
114 | var $icon = $('.search-icon'); | 114 | var $icon = $('.search-icon'); |
115 | var $searchItems = $('.search-items'); | 115 | var $searchItems = $('.search-items'); |
116 | 116 | ||
117 | - $input.on('input', function() { | 117 | + $input.on('input', function () { |
118 | if ($input.val() === '') { | 118 | if ($input.val() === '') { |
119 | $icon.css('color', '#b2b2b2'); | 119 | $icon.css('color', '#b2b2b2'); |
120 | $clear.addClass('hide'); | 120 | $clear.addClass('hide'); |
@@ -134,7 +134,7 @@ function inputAction() { | @@ -134,7 +134,7 @@ function inputAction() { | ||
134 | keyword: $input.val() | 134 | keyword: $input.val() |
135 | }, | 135 | }, |
136 | dataType: 'json', | 136 | dataType: 'json', |
137 | - success: function(data) { | 137 | + success: function (data) { |
138 | var ajaxHtml = ''; | 138 | var ajaxHtml = ''; |
139 | var i; | 139 | var i; |
140 | 140 | ||
@@ -150,12 +150,12 @@ function inputAction() { | @@ -150,12 +150,12 @@ function inputAction() { | ||
150 | $searchAssociate.html(''); | 150 | $searchAssociate.html(''); |
151 | } | 151 | } |
152 | 152 | ||
153 | - $searchAssociate.find('li').on('touchend', function() { | 153 | + $searchAssociate.find('li').on('touchend', function () { |
154 | $buriedpoint.val($(this).find('.keyword').html()); | 154 | $buriedpoint.val($(this).find('.keyword').html()); |
155 | $search.closest('form').submit(); | 155 | $search.closest('form').submit(); |
156 | }); | 156 | }); |
157 | }, | 157 | }, |
158 | - error: function() { | 158 | + error: function () { |
159 | tip.show('网络断开连接了~'); | 159 | tip.show('网络断开连接了~'); |
160 | } | 160 | } |
161 | }); | 161 | }); |
@@ -164,14 +164,14 @@ function inputAction() { | @@ -164,14 +164,14 @@ function inputAction() { | ||
164 | 164 | ||
165 | inputAction(); | 165 | inputAction(); |
166 | 166 | ||
167 | -$clear.on('touchend', function() { | 167 | +$clear.on('touchend', function () { |
168 | $input.val('').trigger('input'); | 168 | $input.val('').trigger('input'); |
169 | }); | 169 | }); |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * 手动触发搜索 | 172 | * 手动触发搜索 |
173 | */ | 173 | */ |
174 | -$search.on('touchend', function() { | 174 | +$search.on('touchend', function () { |
175 | $(this).closest('form').submit(); | 175 | $(this).closest('form').submit(); |
176 | return false; | 176 | return false; |
177 | }); | 177 | }); |
@@ -344,7 +344,7 @@ function search(opt) { | @@ -344,7 +344,7 @@ function search(opt) { | ||
344 | type: 'GET', | 344 | type: 'GET', |
345 | url: location.protocol + '//m.yohobuy.com/product/search/search', | 345 | url: location.protocol + '//m.yohobuy.com/product/search/search', |
346 | data: setting, | 346 | data: setting, |
347 | - success: function(data) { | 347 | + success: function (data) { |
348 | var noResult = '<p class="no-result">未找到相关搜索结果</p>', | 348 | var noResult = '<p class="no-result">未找到相关搜索结果</p>', |
349 | num, | 349 | num, |
350 | $container; | 350 | $container; |
@@ -391,7 +391,7 @@ function search(opt) { | @@ -391,7 +391,7 @@ function search(opt) { | ||
391 | 391 | ||
392 | window.rePosFooter(); | 392 | window.rePosFooter(); |
393 | 393 | ||
394 | - $('.good-detail-text .name').each(function() { | 394 | + $('.good-detail-text .name').each(function () { |
395 | $this = $(this); | 395 | $this = $(this); |
396 | $title = $this.find('a'); | 396 | $title = $this.find('a'); |
397 | 397 | ||
@@ -433,13 +433,13 @@ $.ajax({ | @@ -433,13 +433,13 @@ $.ajax({ | ||
433 | type: 'GET', | 433 | type: 'GET', |
434 | url: location.protocol + '//m.yohobuy.com/product/search/filter', | 434 | url: location.protocol + '//m.yohobuy.com/product/search/filter', |
435 | data: defaultOpt, | 435 | data: defaultOpt, |
436 | - success: function(data) { | 436 | + success: function (data) { |
437 | $goodsContainer.append(data); | 437 | $goodsContainer.append(data); |
438 | 438 | ||
439 | // 初始化filter&注册filter回调 | 439 | // 初始化filter&注册filter回调 |
440 | filter.initFilter({ | 440 | filter.initFilter({ |
441 | fCbFn: search, | 441 | fCbFn: search, |
442 | - hCbFn: function() { | 442 | + hCbFn: function () { |
443 | 443 | ||
444 | // 切换active状态到$pre上 | 444 | // 切换active状态到$pre上 |
445 | $pre.addClass('active'); | 445 | $pre.addClass('active'); |
@@ -460,11 +460,11 @@ writeSearch.bindWirteLocal($('#search-form')); | @@ -460,11 +460,11 @@ writeSearch.bindWirteLocal($('#search-form')); | ||
460 | // 4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态 | 460 | // 4.筛选有active时点击隐藏筛选面板并恢复点击筛选前active项的active状态 |
461 | // 5.当前active为筛选并且点击其他项时,隐藏筛选面板 | 461 | // 5.当前active为筛选并且点击其他项时,隐藏筛选面板 |
462 | 462 | ||
463 | -$listNav.bind('contextmenu', function() { | 463 | +$listNav.bind('contextmenu', function () { |
464 | return false; | 464 | return false; |
465 | }); | 465 | }); |
466 | 466 | ||
467 | -$listNav.on('touchend touchcancel', function(e) { | 467 | +$listNav.on('touchend touchcancel', function (e) { |
468 | var $this = $(e.target).closest('li'), | 468 | var $this = $(e.target).closest('li'), |
469 | nav, | 469 | nav, |
470 | navType, | 470 | navType, |
@@ -566,7 +566,7 @@ function scrollHandler() { | @@ -566,7 +566,7 @@ function scrollHandler() { | ||
566 | } | 566 | } |
567 | 567 | ||
568 | // srcoll to load more | 568 | // srcoll to load more |
569 | -$(window).scroll(function() { | 569 | +$(window).scroll(function () { |
570 | window.requestAnimationFrame(scrollHandler); | 570 | window.requestAnimationFrame(scrollHandler); |
571 | }); | 571 | }); |
572 | 572 | ||
@@ -574,7 +574,7 @@ if ($brandHeader.length > 0) { | @@ -574,7 +574,7 @@ if ($brandHeader.length > 0) { | ||
574 | 574 | ||
575 | // 品牌介绍 | 575 | // 品牌介绍 |
576 | btnIntroHammer = new Hammer($brandHeader.children('.btn-intro')[0]); | 576 | btnIntroHammer = new Hammer($brandHeader.children('.btn-intro')[0]); |
577 | - btnIntroHammer.on('tap', function() { | 577 | + btnIntroHammer.on('tap', function () { |
578 | $introBox.removeClass('hide'); | 578 | $introBox.removeClass('hide'); |
579 | 579 | ||
580 | // 防止混合scroll发生 | 580 | // 防止混合scroll发生 |
@@ -583,7 +583,7 @@ if ($brandHeader.length > 0) { | @@ -583,7 +583,7 @@ if ($brandHeader.length > 0) { | ||
583 | 583 | ||
584 | // 关闭品牌介绍 | 584 | // 关闭品牌介绍 |
585 | introHammer = new Hammer(document.getElementById('intro-box')); | 585 | introHammer = new Hammer(document.getElementById('intro-box')); |
586 | - introHammer.on('tap', function(e) { | 586 | + introHammer.on('tap', function (e) { |
587 | var $this = $(e.target); | 587 | var $this = $(e.target); |
588 | 588 | ||
589 | e.srcEvent.preventDefault(); | 589 | e.srcEvent.preventDefault(); |
@@ -597,7 +597,7 @@ if ($brandHeader.length > 0) { | @@ -597,7 +597,7 @@ if ($brandHeader.length > 0) { | ||
597 | 597 | ||
598 | // 品牌收藏 | 598 | // 品牌收藏 |
599 | brandColHammer = new Hammer($brandHeader.children('.btn-col')[0]); | 599 | brandColHammer = new Hammer($brandHeader.children('.btn-col')[0]); |
600 | - brandColHammer.on('tap', function(e) { | 600 | + brandColHammer.on('tap', function (e) { |
601 | var $this = $(e.target).closest('.btn-col'); | 601 | var $this = $(e.target).closest('.btn-col'); |
602 | 602 | ||
603 | var id = $brandHeader.data('id'), | 603 | var id = $brandHeader.data('id'), |
@@ -619,8 +619,8 @@ if ($brandHeader.length > 0) { | @@ -619,8 +619,8 @@ if ($brandHeader.length > 0) { | ||
619 | }, | 619 | }, |
620 | xhrFields: { | 620 | xhrFields: { |
621 | withCredentials: true | 621 | withCredentials: true |
622 | -}, | ||
623 | - success: function(data) { | 622 | + }, |
623 | + success: function (data) { | ||
624 | if (data.code === 200) { | 624 | if (data.code === 200) { |
625 | $this.toggleClass('coled'); | 625 | $this.toggleClass('coled'); |
626 | 626 | ||
@@ -636,7 +636,7 @@ if ($brandHeader.length > 0) { | @@ -636,7 +636,7 @@ if ($brandHeader.length > 0) { | ||
636 | tip.show(data.message); | 636 | tip.show(data.message); |
637 | } | 637 | } |
638 | }, | 638 | }, |
639 | - error: function() { | 639 | + error: function () { |
640 | tip.show('网络断开连接了~'); | 640 | tip.show('网络断开连接了~'); |
641 | } | 641 | } |
642 | }); | 642 | }); |
@@ -646,9 +646,9 @@ if ($brandHeader.length > 0) { | @@ -646,9 +646,9 @@ if ($brandHeader.length > 0) { | ||
646 | // 初始请求最新第一页数据 | 646 | // 初始请求最新第一页数据 |
647 | search(); | 647 | search(); |
648 | 648 | ||
649 | -$listNav.on('touchstart', 'li', function() { | 649 | +$listNav.on('touchstart', 'li', function () { |
650 | $listNav.find('li').removeClass('bytouch'); | 650 | $listNav.find('li').removeClass('bytouch'); |
651 | $(this).addClass('bytouch'); | 651 | $(this).addClass('bytouch'); |
652 | -}).on('touchend touchcancel', 'li', function() { | 652 | +}).on('touchend touchcancel', 'li', function () { |
653 | $listNav.find('li').removeClass('bytouch'); | 653 | $listNav.find('li').removeClass('bytouch'); |
654 | }); | 654 | }); |
@@ -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(); |
@@ -273,12 +273,10 @@ function tabChange(dom, index) { | @@ -273,12 +273,10 @@ function tabChange(dom, index) { | ||
273 | } | 273 | } |
274 | 274 | ||
275 | 275 | ||
276 | - | ||
277 | - | ||
278 | // 首页导航 | 276 | // 首页导航 |
279 | -(function(nav, posNav, main) { | 277 | +(function (nav, posNav, main) { |
280 | 278 | ||
281 | - $(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() { | 279 | + $(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function () { |
282 | 280 | ||
283 | var index = $(this).index(), | 281 | var index = $(this).index(), |
284 | activeTab = $(this).attr('tab'); | 282 | activeTab = $(this).attr('tab'); |
@@ -376,7 +374,7 @@ function scrollHandler() { | @@ -376,7 +374,7 @@ function scrollHandler() { | ||
376 | } | 374 | } |
377 | 375 | ||
378 | if (sTop + winH * 2 > scH) { | 376 | if (sTop + winH * 2 > scH) { |
379 | - scrollCall = function() { | 377 | + scrollCall = function () { |
380 | var translate = 'translate3d(0, ' + (-scH) + 'px, 0)'; | 378 | var translate = 'translate3d(0, ' + (-scH) + 'px, 0)'; |
381 | $nav1.css({ | 379 | $nav1.css({ |
382 | transform: translate, | 380 | transform: translate, |
@@ -468,7 +466,7 @@ function scrollHandler() { | @@ -468,7 +466,7 @@ function scrollHandler() { | ||
468 | $('#scroller').trigger('scroll'); | 466 | $('#scroller').trigger('scroll'); |
469 | } | 467 | } |
470 | 468 | ||
471 | -document.addEventListener('touchmove', function(e) { | 469 | +document.addEventListener('touchmove', function (e) { |
472 | // sub classify不阻止默认事件 | 470 | // sub classify不阻止默认事件 |
473 | if ($(e.target).closest('.sub-classify').length === 0) { | 471 | if ($(e.target).closest('.sub-classify').length === 0) { |
474 | e.preventDefault(); | 472 | e.preventDefault(); |
@@ -477,11 +475,11 @@ document.addEventListener('touchmove', function(e) { | @@ -477,11 +475,11 @@ document.addEventListener('touchmove', function(e) { | ||
477 | 475 | ||
478 | /* if (!isIphone) { | 476 | /* if (!isIphone) { |
479 | return; | 477 | return; |
480 | -}*/ | 478 | + }*/ |
481 | 479 | ||
482 | 480 | ||
483 | // window ready 后重新refresh iscroll | 481 | // window ready 后重新refresh iscroll |
484 | -$(window).ready(function() { | 482 | +$(window).ready(function () { |
485 | // myScroll && myScroll.refresh(); | 483 | // myScroll && myScroll.refresh(); |
486 | imgH = $('#nav-top').outerHeight(); | 484 | imgH = $('#nav-top').outerHeight(); |
487 | nav1H = $('#nav').outerHeight(); | 485 | nav1H = $('#nav').outerHeight(); |
@@ -497,14 +495,14 @@ $(window).ready(function() { | @@ -497,14 +495,14 @@ $(window).ready(function() { | ||
497 | click: true | 495 | click: true |
498 | }); | 496 | }); |
499 | 497 | ||
500 | - setTimeout(function() { | 498 | + setTimeout(function () { |
501 | scH = $('#scroller').outerHeight(); | 499 | scH = $('#scroller').outerHeight(); |
502 | }, 500); | 500 | }, 500); |
503 | 501 | ||
504 | 502 | ||
505 | myScroll.on('scroll', scrollHandler); | 503 | myScroll.on('scroll', scrollHandler); |
506 | 504 | ||
507 | - myScroll.on('scrollStart', function() { | 505 | + myScroll.on('scrollStart', function () { |
508 | 506 | ||
509 | // stop auto play when scroll | 507 | // stop auto play when scroll |
510 | bannerSwiper && bannerSwiper.stopAutoplay(); | 508 | bannerSwiper && bannerSwiper.stopAutoplay(); |
@@ -512,7 +510,7 @@ $(window).ready(function() { | @@ -512,7 +510,7 @@ $(window).ready(function() { | ||
512 | multiSwiper && multiSwiper.stopAutoplay(); | 510 | multiSwiper && multiSwiper.stopAutoplay(); |
513 | }); | 511 | }); |
514 | 512 | ||
515 | - myScroll.on('scrollEnd', function() { | 513 | + myScroll.on('scrollEnd', function () { |
516 | 514 | ||
517 | // start auto play when scroll end | 515 | // start auto play when scroll end |
518 | bannerSwiper && bannerSwiper.startAutoplay(); | 516 | bannerSwiper && bannerSwiper.startAutoplay(); |
@@ -657,7 +655,7 @@ function search(opt) { | @@ -657,7 +655,7 @@ function search(opt) { | ||
657 | type: 'GET', | 655 | type: 'GET', |
658 | url: opt.url ? opt.url : '', | 656 | url: opt.url ? opt.url : '', |
659 | data: setting, | 657 | data: setting, |
660 | - success: function(data) { | 658 | + success: function (data) { |
661 | var $container, | 659 | var $container, |
662 | num; | 660 | num; |
663 | 661 | ||
@@ -707,7 +705,7 @@ function search(opt) { | @@ -707,7 +705,7 @@ function search(opt) { | ||
707 | 705 | ||
708 | bindGoodThumbClick(); | 706 | bindGoodThumbClick(); |
709 | }, | 707 | }, |
710 | - error: function() { | 708 | + error: function () { |
711 | tip.show('网络断开连接了~'); | 709 | tip.show('网络断开连接了~'); |
712 | searching = false; | 710 | searching = false; |
713 | loading.hideLoadingMask(); | 711 | loading.hideLoadingMask(); |
@@ -716,11 +714,11 @@ function search(opt) { | @@ -716,11 +714,11 @@ function search(opt) { | ||
716 | } | 714 | } |
717 | 715 | ||
718 | 716 | ||
719 | -$listNav.bind('contextmenu', function(e) { | 717 | +$listNav.bind('contextmenu', function (e) { |
720 | return false; | 718 | return false; |
721 | }); | 719 | }); |
722 | 720 | ||
723 | -$subNav.on('touchend touchcancel', function(e) { | 721 | +$subNav.on('touchend touchcancel', function (e) { |
724 | var $this = $(e.target).closest('li'), | 722 | var $this = $(e.target).closest('li'), |
725 | cname, | 723 | cname, |
726 | nav, | 724 | nav, |
@@ -863,11 +861,11 @@ $subNav.on('touchend touchcancel', function(e) { | @@ -863,11 +861,11 @@ $subNav.on('touchend touchcancel', function(e) { | ||
863 | }); | 861 | }); |
864 | 862 | ||
865 | filter.initFilter({ | 863 | filter.initFilter({ |
866 | - fCbFn: function(option) { | 864 | + fCbFn: function (option) { |
867 | search(option); | 865 | search(option); |
868 | myScroll && myScroll.enable(); | 866 | myScroll && myScroll.enable(); |
869 | }, | 867 | }, |
870 | - hCbFn: function() { | 868 | + hCbFn: function () { |
871 | 869 | ||
872 | // 切换active状态到$pre上 | 870 | // 切换active状态到$pre上 |
873 | $pre.addClass('active'); | 871 | $pre.addClass('active'); |
@@ -878,17 +876,17 @@ filter.initFilter({ | @@ -878,17 +876,17 @@ filter.initFilter({ | ||
878 | missStatus: true | 876 | missStatus: true |
879 | }); | 877 | }); |
880 | 878 | ||
881 | -$listNav.on('touchstart', 'li', function(e) { | 879 | +$listNav.on('touchstart', 'li', function (e) { |
882 | $(this).addClass('bytouch'); | 880 | $(this).addClass('bytouch'); |
883 | -}).on('touchend touchcancel', function() { | 881 | +}).on('touchend touchcancel', function () { |
884 | $listNav.find('li').removeClass('bytouch'); | 882 | $listNav.find('li').removeClass('bytouch'); |
885 | 883 | ||
886 | // myScroll && myScroll.refresh(); | 884 | // myScroll && myScroll.refresh(); |
887 | }); | 885 | }); |
888 | 886 | ||
889 | -$nav2.on('touchstart', 'li', function(e) { | 887 | +$nav2.on('touchstart', 'li', function (e) { |
890 | $(this).addClass('bytouch'); | 888 | $(this).addClass('bytouch'); |
891 | -}).on('touchend touchcancel', function() { | 889 | +}).on('touchend touchcancel', function () { |
892 | $nav2.find('li').removeClass('bytouch'); | 890 | $nav2.find('li').removeClass('bytouch'); |
893 | 891 | ||
894 | // myScroll && myScroll.refresh(); | 892 | // myScroll && myScroll.refresh(); |
@@ -896,7 +894,7 @@ $nav2.on('touchstart', 'li', function(e) { | @@ -896,7 +894,7 @@ $nav2.on('touchstart', 'li', function(e) { | ||
896 | 894 | ||
897 | // 底部导航点击 | 895 | // 底部导航点击 |
898 | function fotterClick(group) { | 896 | function fotterClick(group) { |
899 | - $(group + ' li').on('touchstart', function() { | 897 | + $(group + ' li').on('touchstart', function () { |
900 | $('.sub-group').addClass('hide'); | 898 | $('.sub-group').addClass('hide'); |
901 | $(this).find('.sub-group').removeClass('hide'); | 899 | $(this).find('.sub-group').removeClass('hide'); |
902 | }); | 900 | }); |
@@ -912,16 +910,16 @@ function stopPropagation(e) { | @@ -912,16 +910,16 @@ function stopPropagation(e) { | ||
912 | } | 910 | } |
913 | } | 911 | } |
914 | 912 | ||
915 | -$(document).bind('touchstart', function() { | 913 | +$(document).bind('touchstart', function () { |
916 | $('.sub-group').addClass('hide'); | 914 | $('.sub-group').addClass('hide'); |
917 | }); | 915 | }); |
918 | 916 | ||
919 | -$('.shop-foot-wrapper').bind('touchstart', function(e) { | 917 | +$('.shop-foot-wrapper').bind('touchstart', function (e) { |
920 | stopPropagation(e); | 918 | stopPropagation(e); |
921 | }); | 919 | }); |
922 | 920 | ||
923 | // 店铺收藏 || 取消收藏 | 921 | // 店铺收藏 || 取消收藏 |
924 | -$collect.on('touchstart', function() { | 922 | +$collect.on('touchstart', function () { |
925 | var opt; | 923 | var opt; |
926 | 924 | ||
927 | if (searching) { | 925 | if (searching) { |
@@ -946,8 +944,8 @@ $collect.on('touchstart', function() { | @@ -946,8 +944,8 @@ $collect.on('touchstart', function() { | ||
946 | }, | 944 | }, |
947 | xhrFields: { | 945 | xhrFields: { |
948 | withCredentials: true | 946 | withCredentials: true |
949 | -}, | ||
950 | - success: function(data) { | 947 | + }, |
948 | + success: function (data) { | ||
951 | var url = ''; | 949 | var url = ''; |
952 | 950 | ||
953 | if (data.code === 200) { | 951 | if (data.code === 200) { |
@@ -961,20 +959,20 @@ $collect.on('touchstart', function() { | @@ -961,20 +959,20 @@ $collect.on('touchstart', function() { | ||
961 | } | 959 | } |
962 | 960 | ||
963 | if (data.code === 400) { | 961 | if (data.code === 400) { |
964 | - url = data; | 962 | + url = data.data; |
965 | if ($('#jump-login').length <= 0) { | 963 | if ($('#jump-login').length <= 0) { |
966 | $('body').append('<a href=\'' + url + '\'><span id="jump-login"><span></a>'); | 964 | $('body').append('<a href=\'' + url + '\'><span id="jump-login"><span></a>'); |
967 | } | 965 | } |
968 | $('#jump-login').click(); | 966 | $('#jump-login').click(); |
969 | } | 967 | } |
970 | 968 | ||
971 | - setTimeout(function() { | 969 | + setTimeout(function () { |
972 | myScroll && myScroll.refresh(); | 970 | myScroll && myScroll.refresh(); |
973 | scH = $('#scroller').outerHeight(); | 971 | scH = $('#scroller').outerHeight(); |
974 | }, 500); | 972 | }, 500); |
975 | searching = false; | 973 | searching = false; |
976 | }, | 974 | }, |
977 | - error: function() { | 975 | + error: function () { |
978 | tip.show('网络断开连接了~'); | 976 | tip.show('网络断开连接了~'); |
979 | searching = false; | 977 | searching = false; |
980 | } | 978 | } |
-
Please register or login to post a comment