shish vor 2 Monaten
Ursprung
Commit
d1ba656143

+ 3 - 3
ghsApp/src/components/app-area-sel.vue

@@ -10,7 +10,7 @@
 				<div class="map-search">
 					<app-search-module ref="aaaaa" fontSize="30" height="120" placeholder="请输入地址搜索" :focus="false" @input="searchFn" />
 					<view class="search-hint">
-						<text class="search-hint-text">建议搜:店名、建筑名、小区名、街道门牌号</text>
+						<text class="search-hint-text">建议搜:店名、建筑名、小区名、街道门牌号</text>
 						<text class="search-hint-example">例如:隆宇大厦、东昌小区、紫霞路70号</text>
 					</view>
 				</div>
@@ -195,8 +195,8 @@
 		.search-hint-text {
 			display: block;
 			color: #3d8b6e;
-			font-size: 30upx;
-			font-weight: 600;
+			font-size: 32upx;
+			font-weight: bold;
 			line-height: 44upx;
 		}
 		.search-hint-example {

+ 43 - 23
ghsApp/src/pagesClient/official/apply.vue

@@ -34,7 +34,7 @@
                 <view class="tui-input" v-if="form.province">{{ form.province + '-' + form.city }}</view>
                 <view class="tui-placeholder" v-else>请选择城市</view>
               </view>
-              <view class="city-locate-btn" @click.stop="openNearbyAddress">
+              <view class="city-locate-btn" @click.stop="locateCity">
                 <image class="city-locate-icon" src="/static/images/common/localposition.png" mode="aspectFit"></image>
               </view>
             </tui-list-cell>
@@ -301,12 +301,27 @@ export default {
       }
       this.modifyShow()
     },
-    async openNearbyAddress() {
-      if (this.locating) {
+    fillCityFromNearby(first) {
+      if (!first) {
         return false
       }
+      if (first.province) {
+        this.form.province = first.province
+      }
+      if (first.city) {
+        this.form.city = first.city
+      }
+      if (first.district) {
+        this.form.dist = first.district
+      }
+      this.modifyShow()
+    },
+    async loadNearbyAddressList(fillCity) {
+      if (this.locating) {
+        return []
+      }
       this.locating = true
-      uni.showLoading({ title: '定位中', mask: true })
+      uni.showLoading({ title: fillCity ? '定位中' : '加载中', mask: true })
       try {
         await this.ensureAppLocationPermission()
         const location = await this.getDeviceLocation()
@@ -316,35 +331,34 @@ export default {
           locationType: location.locationType || 'gcj02'
         })
         if (res.code != 1 || !res.data || !res.data.list || res.data.list.length === 0) {
-          this.$msg('未获取到附近地址,请手动填写')
-          return false
+          if (fillCity) {
+            this.$msg('未获取到位置,请手动选择城市')
+          }
+          return []
         }
         const list = res.data.list
-        const first = list[0]
-        if (first) {
-          if (first.province) {
-            this.form.province = first.province
-          }
-          if (first.city) {
-            this.form.city = first.city
-          }
-          if (first.district) {
-            this.form.dist = first.district
-          }
-          this.modifyShow()
+        if (fillCity) {
+          this.fillCityFromNearby(list[0])
         }
         this.addressInitialList = list
-        this.showRegion = true
-        return true
+        return list
       } catch (err) {
-        console.log('openNearbyAddress fail', err)
-        this.$msg((err && err.message) ? err.message : '定位失败,请手动填写')
-        return false
+        console.log('loadNearbyAddressList fail', err)
+        if (fillCity) {
+          this.$msg((err && err.message) ? err.message : '定位失败,请手动填写')
+        }
+        return []
       } finally {
         this.locating = false
         uni.hideLoading()
       }
     },
+    async locateCity() {
+      const list = await this.loadNearbyAddressList(true)
+      if (list.length > 0) {
+        this.$msg('已定位到当前城市')
+      }
+    },
     cancelAutoMobile() {
       this.$util.confirmModal({
         content: '取消后将清空已获取的手机号,需重新填写并验证,是否确认?',
@@ -497,6 +511,12 @@ export default {
         this.$msg('请先选择城市或点击定位图标')
         return false
       }
+      this.openAddressSelector()
+    },
+    async openAddressSelector() {
+      if (!this.addressInitialList || this.addressInitialList.length === 0) {
+        await this.loadNearbyAddressList(false)
+      }
       this.showRegion = true
     },
     changeAreaFn(e) {

+ 3 - 3
hdApp/src/components/app-area-sel.vue

@@ -10,7 +10,7 @@
 				<div class="map-search">
 					<app-search-module ref="aaaaa" placeholder="请填写地址搜索" :focus="false" @input="searchFn"/>
 					<view class="search-hint">
-						<text class="search-hint-text">建议搜:店名、建筑名、小区名、街道门牌号</text>
+						<text class="search-hint-text">建议搜:店名、建筑名、小区名、街道门牌号</text>
 						<text class="search-hint-example">例如:隆宇大厦、东昌小区、紫霞路70号</text>
 					</view>
 				</div>
@@ -195,8 +195,8 @@
 		.search-hint-text {
 			display: block;
 			color: #3d8b6e;
-			font-size: 30upx;
-			font-weight: 600;
+			font-size: 32upx;
+			font-weight: bold;
 			line-height: 44upx;
 		}
 		.search-hint-example {

+ 43 - 23
hdApp/src/pagesClient/official/apply.vue

@@ -23,7 +23,7 @@
                 <view class="tui-input" v-if="form.province">{{ form.province + '-' + form.city }}</view>
                 <view class="tui-placeholder" v-else>请选择城市</view>
               </view>
-              <view class="city-locate-btn" @click.stop="openNearbyAddress">
+              <view class="city-locate-btn" @click.stop="locateCity">
                 <image class="city-locate-icon" :src="iconSrc('general-location')" mode="aspectFit"></image>
               </view>
             </tui-list-cell>
@@ -317,12 +317,27 @@ export default {
       }
       this.modifyShow()
     },
-    async openNearbyAddress() {
-      if (this.locating) {
+    fillCityFromNearby(first) {
+      if (!first) {
         return false
       }
+      if (first.province) {
+        this.form.province = first.province
+      }
+      if (first.city) {
+        this.form.city = first.city
+      }
+      if (first.district) {
+        this.form.dist = first.district
+      }
+      this.modifyShow()
+    },
+    async loadNearbyAddressList(fillCity) {
+      if (this.locating) {
+        return []
+      }
       this.locating = true
-      uni.showLoading({ title: '定位中', mask: true })
+      uni.showLoading({ title: fillCity ? '定位中' : '加载中', mask: true })
       try {
         await this.ensureAppLocationPermission()
         const location = await this.getDeviceLocation()
@@ -332,35 +347,34 @@ export default {
           locationType: location.locationType || 'gcj02'
         })
         if (res.code != 1 || !res.data || !res.data.list || res.data.list.length === 0) {
-          this.$msg('未获取到附近地址,请手动填写')
-          return false
+          if (fillCity) {
+            this.$msg('未获取到位置,请手动选择城市')
+          }
+          return []
         }
         const list = res.data.list
-        const first = list[0]
-        if (first) {
-          if (first.province) {
-            this.form.province = first.province
-          }
-          if (first.city) {
-            this.form.city = first.city
-          }
-          if (first.district) {
-            this.form.dist = first.district
-          }
-          this.modifyShow()
+        if (fillCity) {
+          this.fillCityFromNearby(list[0])
         }
         this.addressInitialList = list
-        this.showRegion = true
-        return true
+        return list
       } catch (err) {
-        console.log('openNearbyAddress fail', err)
-        this.$msg((err && err.message) ? err.message : '定位失败,请手动填写')
-        return false
+        console.log('loadNearbyAddressList fail', err)
+        if (fillCity) {
+          this.$msg((err && err.message) ? err.message : '定位失败,请手动填写')
+        }
+        return []
       } finally {
         this.locating = false
         uni.hideLoading()
       }
     },
+    async locateCity() {
+      const list = await this.loadNearbyAddressList(true)
+      if (list.length > 0) {
+        this.$msg('已定位到当前城市')
+      }
+    },
     onHere(){
       this.form.province = '云南省'
       this.form.city = '昆明市'
@@ -522,6 +536,12 @@ export default {
         this.$msg('请先选择城市或点击定位图标')
         return false
       }
+      this.openAddressSelector()
+    },
+    async openAddressSelector() {
+      if (!this.addressInitialList || this.addressInitialList.length === 0) {
+        await this.loadNearbyAddressList(false)
+      }
       this.showRegion = true
     },
     changeAreaFn(e) {