Merge branch 'feature/address4' into 'release/5.4.1'
去掉旧的地址加载 See merge request !241
Showing
1 changed file
with
4 additions
and
75 deletions
@@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
4 | * @date: 2015/11/30 | 4 | * @date: 2015/11/30 |
5 | */ | 5 | */ |
6 | var $ = require('yoho-jquery'), | 6 | var $ = require('yoho-jquery'), |
7 | - Hammer = require('yoho-hammer'), | ||
8 | tip = require('../plugin/tip'), | 7 | tip = require('../plugin/tip'), |
9 | security = require('../plugin/security'), | 8 | security = require('../plugin/security'), |
10 | loading = require('../plugin/loading'); | 9 | loading = require('../plugin/loading'); |
@@ -19,8 +18,7 @@ var $addressForm = $('.edit-address'), | @@ -19,8 +18,7 @@ var $addressForm = $('.edit-address'), | ||
19 | navTitle = $navTitle.html(), | 18 | navTitle = $navTitle.html(), |
20 | $area = $('.area'), | 19 | $area = $('.area'), |
21 | isSubmiting, | 20 | isSubmiting, |
22 | - currentPage = 'edit', | ||
23 | - newArea = []; | 21 | + currentPage = 'edit'; |
24 | 22 | ||
25 | var Vue = require('vue'); | 23 | var Vue = require('vue'); |
26 | var vueAddressAct = require('home/address/address-act.vue'); | 24 | var vueAddressAct = require('home/address/address-act.vue'); |
@@ -54,7 +52,6 @@ $backBtn.on('touchend', function(e) { | @@ -54,7 +52,6 @@ $backBtn.on('touchend', function(e) { | ||
54 | $addressListPage.hide(); | 52 | $addressListPage.hide(); |
55 | $addressListPage.find('ul').hide().find('li').removeClass('highlight'); | 53 | $addressListPage.find('ul').hide().find('li').removeClass('highlight'); |
56 | $addressListPage.children('ul').show().children('li').show(); | 54 | $addressListPage.children('ul').show().children('li').show(); |
57 | - newArea = []; | ||
58 | } else { | 55 | } else { |
59 | window.history.go(-1); | 56 | window.history.go(-1); |
60 | } | 57 | } |
@@ -138,75 +135,7 @@ $submit.on('touchend', function() { | @@ -138,75 +135,7 @@ $submit.on('touchend', function() { | ||
138 | $(this).removeClass('highlight'); | 135 | $(this).removeClass('highlight'); |
139 | }); | 136 | }); |
140 | 137 | ||
141 | -function bindAddressListEvent(html) { | ||
142 | - $addressListPage.html(html); | ||
143 | - | ||
144 | - // 省市区 | ||
145 | - $area.on('touchend', function() { | ||
146 | - addressVact.$children[0].show = true; | ||
147 | - }); | ||
148 | - | ||
149 | - // touchend 在下滑的时候会触发 | ||
150 | - // 省市区联动 | ||
151 | - $addressListPage.find('.address').each(function(i, elem) { | ||
152 | - var addressHammer = new Hammer(elem); | ||
153 | - | ||
154 | - addressHammer.on('tap', function(e) { | ||
155 | - var $this = $(e.target); | ||
156 | - | ||
157 | - if (e.target.tagName.toLowerCase() !== 'li') { | ||
158 | - $this = $this.parent('li'); | ||
159 | - } | ||
160 | - newArea.push($this.children('.caption').text().trim()); | ||
161 | - $this.siblings().hide(); | ||
162 | - $this.children('ul').show().children('li').show(); | ||
163 | - | ||
164 | - e.srcEvent.preventDefault(); | ||
165 | - e.srcEvent.stopPropagation(); | ||
166 | - }); | ||
167 | - }); | ||
168 | - | ||
169 | - $addressListPage.find('.address-last').each(function(i, elem) { | ||
170 | - var addressLastHammer = new Hammer(elem); | ||
171 | - | ||
172 | - addressLastHammer.on('tap', function(e) { | ||
173 | - var $this = $(e.target); | ||
174 | - | ||
175 | - // 填结果到 html | ||
176 | - newArea.push($this.text().trim()); | ||
177 | - $('[name="area"]').val(newArea.join(' ')); | ||
178 | - $('[name="area_code"]').val($this.data('id')); | ||
179 | - | ||
180 | - $editAddressPage.show(); | ||
181 | - currentPage = 'edit'; | ||
182 | - $navTitle.html(navTitle); | ||
183 | - | ||
184 | - // 恢复默认的三级选择 | ||
185 | - $addressListPage.hide(); | ||
186 | - $addressListPage.find('ul').hide().find('li').removeClass('highlight'); | ||
187 | - $addressListPage.children('ul').show().children('li').show(); | ||
188 | - newArea = []; | ||
189 | - | ||
190 | - e.srcEvent.preventDefault(); | ||
191 | - e.srcEvent.stopPropagation(); | ||
192 | - }); | ||
193 | - }); | ||
194 | - | ||
195 | - $addressListPage.on('touchstart', 'li', function() { | ||
196 | - $(this).addClass('highlight'); | ||
197 | - }).on('touchend touchcancel', 'li', function() { | ||
198 | - $(this).removeClass('highlight'); | ||
199 | - }); | ||
200 | -} | ||
201 | - | ||
202 | -// 省市区列表异步加载 | ||
203 | -$.ajax({ | ||
204 | - method: 'GET', | ||
205 | - url: '/home/locationList', | ||
206 | - timeout: 60000, | ||
207 | - cache: true | ||
208 | -}).then(function(html) { | ||
209 | - bindAddressListEvent(html); | ||
210 | -}).fail(function() { | ||
211 | - tip.show('获取省市区列表失败'); | 138 | +// 省市区 |
139 | +$area.on('touchend', function() { | ||
140 | + addressVact.$children[0].show = true; | ||
212 | }); | 141 | }); |
-
Please register or login to post a comment