Authored by ccbikai(👎🏻🍜)

分类页面优化

@@ -16,15 +16,15 @@ module.exports = { @@ -16,15 +16,15 @@ module.exports = {
16 siteUrl: '//m.yohobuy.com', 16 siteUrl: '//m.yohobuy.com',
17 assetUrl: '//localhost:5001', 17 assetUrl: '//localhost:5001',
18 domains: { 18 domains: {
19 - // api: 'http://api.yoho.cn/',  
20 - // service: 'http://service.yoho.cn/',  
21 - // liveApi: 'http://api.live.yoho.cn/',  
22 - // singleApi: 'http://single.yoho.cn/' 19 + api: 'http://api.yoho.cn/',
  20 + service: 'http://service.yoho.cn/',
  21 + liveApi: 'http://api.live.yoho.cn/',
  22 + singleApi: 'http://single.yoho.cn/'
23 23
24 - api: 'http://api-test3.yohops.com:9999/',  
25 - service: 'http://service-test3.yohops.com:9999/',  
26 - liveApi: 'http://testapi.live.yohops.com:9999/',  
27 - singleApi: 'http://api-test3.yohops.com:9999/' 24 + // api: 'http://api-test3.yohops.com:9999/',
  25 + // service: 'http://service-test3.yohops.com:9999/',
  26 + // liveApi: 'http://testapi.live.yohops.com:9999/',
  27 + // singleApi: 'http://api-test3.yohops.com:9999/'
28 28
29 // favApi: 'http://192.168.102.31:8092/brower', 29 // favApi: 'http://192.168.102.31:8092/brower',
30 // api: 'http://192.168.102.205:8080/gateway/', 30 // api: 'http://192.168.102.205:8080/gateway/',
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 */ 5 */
6 6
7 var $ = require('yoho-jquery'); 7 var $ = require('yoho-jquery');
  8 +var FastClick = require('yoho-fastclick');
8 9
9 var $nav = $('.category-nav'), 10 var $nav = $('.category-nav'),
10 $search = $('#search-input'), 11 $search = $('#search-input'),
@@ -15,6 +16,10 @@ var $nav = $('.category-nav'), @@ -15,6 +16,10 @@ var $nav = $('.category-nav'),
15 16
16 require('../common'); 17 require('../common');
17 18
  19 +$(function() {
  20 + FastClick.attach(document.body);
  21 +})
  22 +
18 function resetHeight() { 23 function resetHeight() {
19 var h = document.body.scrollHeight - $search.outerHeight() - $nav.outerHeight(); 24 var h = document.body.scrollHeight - $search.outerHeight() - $nav.outerHeight();
20 25
@@ -47,7 +52,7 @@ $nav.on('touchend touchcancel', function(e) { @@ -47,7 +52,7 @@ $nav.on('touchend touchcancel', function(e) {
47 $contents.filter(selector).removeClass('hide'); 52 $contents.filter(selector).removeClass('hide');
48 }); 53 });
49 54
50 -$categoryContainer.on('touchend', function(e) { 55 +$categoryContainer.on('click', function(e) {
51 var $this = $(e.target), 56 var $this = $(e.target),
52 $subLevel, 57 $subLevel,
53 $cur, index; 58 $cur, index;
@@ -59,6 +64,14 @@ $categoryContainer.on('touchend', function(e) { @@ -59,6 +64,14 @@ $categoryContainer.on('touchend', function(e) {
59 e.preventDefault(); 64 e.preventDefault();
60 } 65 }
61 66
  67 + if ($this[0] && $this[0].tagName === 'LI' && $this.find('a').attr('href')) {
  68 + location.href = $this.find('a').attr('href');
  69 + }
  70 +
  71 + if ($this[0] && $this[0].tagName === 'A' && $this.attr('href')) {
  72 + location.href = $this.attr('href');
  73 + }
  74 +
62 if ($cur.length > 0) { 75 if ($cur.length > 0) {
63 index = $cur.index(); 76 index = $cur.index();
64 $subLevel = $this.closest('.content').find('.sub-level'); 77 $subLevel = $this.closest('.content').find('.sub-level');
@@ -73,14 +86,6 @@ $categoryContainer.on('touchend', function(e) { @@ -73,14 +86,6 @@ $categoryContainer.on('touchend', function(e) {
73 $subLevel.not('.hide').addClass('hide'); 86 $subLevel.not('.hide').addClass('hide');
74 $subLevel.eq(index).removeClass('hide'); 87 $subLevel.eq(index).removeClass('hide');
75 } 88 }
76 -  
77 - if ($this[0] && $this[0].tagName === 'LI' && $this.find('a').attr('href')) {  
78 - location.href = $this.find('a').attr('href');  
79 - }  
80 -  
81 - if ($this[0] && $this[0].tagName === 'A' && $this.attr('href')) {  
82 - location.href = $this.attr('href');  
83 - }  
84 }); 89 });
85 90
86 $categoryContainer.find('.primary-level').on('touchstart touchend touchcancel', 'li', function() { 91 $categoryContainer.find('.primary-level').on('touchstart touchend touchcancel', 'li', function() {