|
@@ -19,7 +19,9 @@ var activeType = $navLi.filter('.active').data('type'); //当前active的项的i |
|
@@ -19,7 +19,9 @@ var activeType = $navLi.filter('.active').data('type'); //当前active的项的i |
19
|
|
19
|
|
20
|
var orderPage = {};
|
20
|
var orderPage = {};
|
21
|
|
21
|
|
22
|
-var loading = false;
|
22
|
+var inAjax = false;
|
|
|
23
|
+
|
|
|
24
|
+var loading = require('../plugin/loading');
|
23
|
|
25
|
|
24
|
var navHammer, orderHammer;
|
26
|
var navHammer, orderHammer;
|
25
|
|
27
|
|
|
@@ -30,10 +32,13 @@ function getOrders() { |
|
@@ -30,10 +32,13 @@ function getOrders() { |
30
|
page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1
|
32
|
page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1
|
31
|
};
|
33
|
};
|
32
|
|
34
|
|
33
|
- if (loading) {
|
35
|
+ if (inAjax) {
|
34
|
return;
|
36
|
return;
|
35
|
}
|
37
|
}
|
36
|
|
38
|
|
|
|
39
|
+ inAjax = true;
|
|
|
40
|
+ loading.show();
|
|
|
41
|
+
|
37
|
$.ajax({
|
42
|
$.ajax({
|
38
|
type: 'GET',
|
43
|
type: 'GET',
|
39
|
url: '/home/getOrders',
|
44
|
url: '/home/getOrders',
|
|
@@ -55,6 +60,9 @@ function getOrders() { |
|
@@ -55,6 +60,9 @@ function getOrders() { |
55
|
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy'));
|
60
|
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy'));
|
56
|
}
|
61
|
}
|
57
|
}
|
62
|
}
|
|
|
63
|
+
|
|
|
64
|
+ inAjax = false;
|
|
|
65
|
+ loading.hide();
|
58
|
}
|
66
|
}
|
59
|
});
|
67
|
});
|
60
|
}
|
68
|
}
|
|
@@ -73,6 +81,8 @@ lazyLoad(); |
|
@@ -73,6 +81,8 @@ lazyLoad(); |
73
|
$navLi.width(100 / liCount + '%');
|
81
|
$navLi.width(100 / liCount + '%');
|
74
|
}());
|
82
|
}());
|
75
|
|
83
|
|
|
|
84
|
+loading.init();
|
|
|
85
|
+
|
76
|
//导航切换
|
86
|
//导航切换
|
77
|
navHammer = new Hammer(document.getElementById('order-nav'));
|
87
|
navHammer = new Hammer(document.getElementById('order-nav'));
|
78
|
navHammer.on('tap', function(e) {
|
88
|
navHammer.on('tap', function(e) {
|