Browse Source

更换地图api

xiaohaizhao 1 year ago
parent
commit
c340b70e9f
1 changed files with 28 additions and 17 deletions
  1. 28 17
      pages/index/modules/home.vue

+ 28 - 17
pages/index/modules/home.vue

@@ -9,7 +9,7 @@
 						{{ sitename }}
 					</navigator>
 					<view class="location u-line-1" @click.stop="setLocation">
-						<text class="iconfont icon-didian" />{{ place.address || '重新获取所在位置' }}
+						<text class="iconfont icon-didian" />{{ place.formatted_address || '重新获取所在位置' }}
 					</view>
 					<view class="weather-forecast">
 						<view class="tag">天气预报</view>
@@ -124,23 +124,34 @@ export default {
 			})
 		},
 		async getPlace() {
-			let res = this.location || await this.getLocation(),
-				that = this;
+			let res = this.location || await this.getLocation();
 			this.__proto__.location = res;
-			qqmapsdk = new QQMapWX({
-				key: 'UVVBZ-UOGWZ-ZUWXC-TJQMT-TUWLO-IVFTN'
-			});
-			qqmapsdk.reverseGeocoder({
-				location: {
-					latitude: res.latitude,
-					longitude: res.longitude
-				},
-				success(res) {
-					console.log("逆解析结果", res.result)
-					that.place = res.result;
-				},
-				fail: res => console.error(res)
-			});
+			this.$Http.basic({
+				"id": "10027201",
+				"content": {
+					"lon": res.longitude,
+					"lat": res.latitude
+				}
+			}).then(s => {
+				console.log("定位", s)
+				this.place = s.data.result;
+			})
+
+
+			/* 			qqmapsdk = new QQMapWX({
+							key: 'UVVBZ-UOGWZ-ZUWXC-TJQMT-TUWLO-IVFTN'
+						});
+						qqmapsdk.reverseGeocoder({
+							location: {
+								latitude: res.latitude,
+								longitude: res.longitude
+							},
+							success(res) {
+								console.log("逆解析结果", res.result)
+								that.place = res.result;
+							},
+							fail: res => console.error(res)
+						}); */
 		},
 		setCustomBar(num) {
 			const Dustom = this.$refs.Dustom;