|
@@ -13,11 +13,11 @@ var $addressForm = $('.edit-address'), |
|
@@ -13,11 +13,11 @@ var $addressForm = $('.edit-address'), |
13
|
$submit = $('.submit'),
|
13
|
$submit = $('.submit'),
|
14
|
$editAddressPage = $('.my-edit-address-page'),
|
14
|
$editAddressPage = $('.my-edit-address-page'),
|
15
|
$addressListPage = $('.my-address-list-page'),
|
15
|
$addressListPage = $('.my-address-list-page'),
|
16
|
- $area = $('.area'),
|
|
|
17
|
$footer = $('#yoho-footer'),
|
16
|
$footer = $('#yoho-footer'),
|
18
|
$backBtn = $('.nav-back'),
|
17
|
$backBtn = $('.nav-back'),
|
19
|
$navTitle = $('.nav-title'),
|
18
|
$navTitle = $('.nav-title'),
|
20
|
navTitle = $navTitle.html(),
|
19
|
navTitle = $navTitle.html(),
|
|
|
20
|
+ $area = $('.area'),
|
21
|
isSubmiting,
|
21
|
isSubmiting,
|
22
|
currentPage = 'edit',
|
22
|
currentPage = 'edit',
|
23
|
newArea = [];
|
23
|
newArea = [];
|
|
@@ -109,6 +109,12 @@ $submit.on('touchend', function() { |
|
@@ -109,6 +109,12 @@ $submit.on('touchend', function() { |
109
|
$(this).removeClass('highlight');
|
109
|
$(this).removeClass('highlight');
|
110
|
});
|
110
|
});
|
111
|
|
111
|
|
|
|
112
|
+$('input, textarea').on('focus', function() {
|
|
|
113
|
+ $footer.hide();
|
|
|
114
|
+}).on('blur', function() {
|
|
|
115
|
+ $footer.show();
|
|
|
116
|
+});
|
|
|
117
|
+
|
112
|
// 省市区
|
118
|
// 省市区
|
113
|
$area.on('touchend', function() {
|
119
|
$area.on('touchend', function() {
|
114
|
$editAddressPage.hide();
|
120
|
$editAddressPage.hide();
|
|
@@ -119,9 +125,13 @@ $area.on('touchend', function() { |
|
@@ -119,9 +125,13 @@ $area.on('touchend', function() { |
119
|
$navTitle.html('地区选择');
|
125
|
$navTitle.html('地区选择');
|
120
|
});
|
126
|
});
|
121
|
|
127
|
|
122
|
-// touchend 在下滑的时候会触发
|
|
|
123
|
-// 省市区联动
|
|
|
124
|
-$addressListPage.find('.address').each(function(i, elem) {
|
128
|
+// 省市区列表异步加载
|
|
|
129
|
+$.get('/home/locationList').then(function(html) {
|
|
|
130
|
+ $addressListPage.html(html);
|
|
|
131
|
+
|
|
|
132
|
+ // touchend 在下滑的时候会触发
|
|
|
133
|
+ // 省市区联动
|
|
|
134
|
+ $addressListPage.find('.address').each(function(i, elem) {
|
125
|
var addressHammer = new Hammer(elem);
|
135
|
var addressHammer = new Hammer(elem);
|
126
|
|
136
|
|
127
|
addressHammer.on('tap', function(e) {
|
137
|
addressHammer.on('tap', function(e) {
|
|
@@ -134,9 +144,9 @@ $addressListPage.find('.address').each(function(i, elem) { |
|
@@ -134,9 +144,9 @@ $addressListPage.find('.address').each(function(i, elem) { |
134
|
e.srcEvent.preventDefault();
|
144
|
e.srcEvent.preventDefault();
|
135
|
e.srcEvent.stopPropagation();
|
145
|
e.srcEvent.stopPropagation();
|
136
|
});
|
146
|
});
|
137
|
-});
|
147
|
+ });
|
138
|
|
148
|
|
139
|
-$addressListPage.find('.address-last').each(function(i, elem) {
|
149
|
+ $addressListPage.find('.address-last').each(function(i, elem) {
|
140
|
var addressLastHammer = new Hammer(elem);
|
150
|
var addressLastHammer = new Hammer(elem);
|
141
|
|
151
|
|
142
|
addressLastHammer.on('tap', function(e) {
|
152
|
addressLastHammer.on('tap', function(e) {
|
|
@@ -161,16 +171,13 @@ $addressListPage.find('.address-last').each(function(i, elem) { |
|
@@ -161,16 +171,13 @@ $addressListPage.find('.address-last').each(function(i, elem) { |
161
|
e.srcEvent.preventDefault();
|
171
|
e.srcEvent.preventDefault();
|
162
|
e.srcEvent.stopPropagation();
|
172
|
e.srcEvent.stopPropagation();
|
163
|
});
|
173
|
});
|
164
|
-});
|
174
|
+ });
|
165
|
|
175
|
|
166
|
-$addressListPage.on('touchstart', 'li', function() {
|
176
|
+ $addressListPage.on('touchstart', 'li', function() {
|
167
|
$(this).addClass('highlight');
|
177
|
$(this).addClass('highlight');
|
168
|
-}).on('touchend touchcancel', 'li', function() {
|
178
|
+ }).on('touchend touchcancel', 'li', function() {
|
169
|
$(this).removeClass('highlight');
|
179
|
$(this).removeClass('highlight');
|
170
|
-});
|
|
|
171
|
-
|
|
|
172
|
-$('input, textarea').on('focus', function() {
|
|
|
173
|
- $footer.hide();
|
|
|
174
|
-}).on('blur', function() {
|
|
|
175
|
- $footer.show();
|
180
|
+ });
|
|
|
181
|
+}).fail(function() {
|
|
|
182
|
+ tip.show('获取省市区列表失败');
|
176
|
}); |
183
|
}); |