Authored by 梁志锋

Merge branch 'feature/address' into 'develop'

修改地址页面优化

1. 修改地址表单提交时 弹出小键盘 问题修改;
2. 修改地址页面 省市区点击事件延迟绑定;
3. 地址修改页面 区域选择 点击小箭头出错.

See merge request !8
@@ -16,6 +16,7 @@ var $addressForm = $('.edit-address'), @@ -16,6 +16,7 @@ var $addressForm = $('.edit-address'),
16 $footer = $('#yoho-footer'), 16 $footer = $('#yoho-footer'),
17 $backBtn = $('.nav-back'), 17 $backBtn = $('.nav-back'),
18 $navTitle = $('.nav-title'), 18 $navTitle = $('.nav-title'),
  19 + $input = $('input, textarea'),
19 navTitle = $navTitle.html(), 20 navTitle = $navTitle.html(),
20 $area = $('.area'), 21 $area = $('.area'),
21 isSubmiting, 22 isSubmiting,
@@ -101,6 +102,7 @@ $addressForm.on('submit', function() { @@ -101,6 +102,7 @@ $addressForm.on('submit', function() {
101 }); 102 });
102 103
103 $submit.on('touchend', function() { 104 $submit.on('touchend', function() {
  105 + $input.blur();
104 $addressForm.submit(); 106 $addressForm.submit();
105 return false; 107 return false;
106 }).on('touchstart', function() { 108 }).on('touchstart', function() {
@@ -109,25 +111,25 @@ $submit.on('touchend', function() { @@ -109,25 +111,25 @@ $submit.on('touchend', function() {
109 $(this).removeClass('highlight'); 111 $(this).removeClass('highlight');
110 }); 112 });
111 113
112 -$('input, textarea').on('focus', function() { 114 +$input.on('focus', function() {
113 $footer.hide(); 115 $footer.hide();
114 }).on('blur', function() { 116 }).on('blur', function() {
115 $footer.show(); 117 $footer.show();
116 }); 118 });
117 119
118 -// 省市区  
119 -$area.on('touchend', function() { 120 +// 省市区列表异步加载
  121 +$.get('/home/locationList').then(function(html) {
  122 + $addressListPage.html(html);
  123 +
  124 + // 省市区
  125 + $area.on('touchend', function() {
120 $editAddressPage.hide(); 126 $editAddressPage.hide();
121 $addressListPage.show(1, function() { 127 $addressListPage.show(1, function() {
122 $footer.hide(); 128 $footer.hide();
123 }); 129 });
124 currentPage = 'list'; 130 currentPage = 'list';
125 $navTitle.html('地区选择'); 131 $navTitle.html('地区选择');
126 -});  
127 -  
128 -// 省市区列表异步加载  
129 -$.get('/home/locationList').then(function(html) {  
130 - $addressListPage.html(html); 132 + });
131 133
132 // touchend 在下滑的时候会触发 134 // touchend 在下滑的时候会触发
133 // 省市区联动 135 // 省市区联动
@@ -137,6 +139,9 @@ $.get('/home/locationList').then(function(html) { @@ -137,6 +139,9 @@ $.get('/home/locationList').then(function(html) {
137 addressHammer.on('tap', function(e) { 139 addressHammer.on('tap', function(e) {
138 var $this = $(e.target); 140 var $this = $(e.target);
139 141
  142 + if (e.target.tagName !== 'li') {
  143 + $this = $this.parent('li');
  144 + }
140 newArea.push($this.children('.caption').text()); 145 newArea.push($this.children('.caption').text());
141 $this.siblings().hide(); 146 $this.siblings().hide();
142 $this.children('ul').show().children('li').show(); 147 $this.children('ul').show().children('li').show();