Forráskód Böngészése

修改首页地图、获取region接口信息

zxl 1 éve
szülő
commit
c5aa6fb642
2 módosított fájl, 26 hozzáadás és 29 törlés
  1. 13 21
      package-lock.json
  2. 13 8
      src/pages/client/tabBar/home/index.vue

+ 13 - 21
package-lock.json

@@ -4169,27 +4169,6 @@
         "whatwg-fetch": "^3.6.2"
       },
       "dependencies": {
-        "@vue/vue-loader-v15": {
-          "version": "npm:vue-loader@15.11.1",
-          "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-15.11.1.tgz",
-          "integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
-          "dev": true,
-          "requires": {
-            "@vue/component-compiler-utils": "^3.1.0",
-            "hash-sum": "^1.0.2",
-            "loader-utils": "^1.1.0",
-            "vue-hot-reload-api": "^2.3.0",
-            "vue-style-loader": "^4.1.0"
-          },
-          "dependencies": {
-            "hash-sum": {
-              "version": "1.0.2",
-              "resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz",
-              "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
-              "dev": true
-            }
-          }
-        },
         "acorn": {
           "version": "8.8.2",
           "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.8.2.tgz",
@@ -4325,6 +4304,19 @@
       "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.4.tgz",
       "integrity": "sha512-abSgiVRhfjfl3JALR/cSuBl74hGJ3SePgf1mKzodf1eMWLwHZbfEGxT2cNJSsNiw44jEgrO7bNkhchaWA7RwNw=="
     },
+    "@vue/vue-loader-v15": {
+      "version": "npm:vue-loader@15.11.1",
+      "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-15.11.1.tgz",
+      "integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
+      "dev": true,
+      "requires": {
+        "@vue/component-compiler-utils": "^3.1.0",
+        "hash-sum": "^1.0.2",
+        "loader-utils": "^1.1.0",
+        "vue-hot-reload-api": "^2.3.0",
+        "vue-style-loader": "^4.1.0"
+      }
+    },
     "@vue/web-component-wrapper": {
       "version": "1.3.0",
       "resolved": false,

+ 13 - 8
src/pages/client/tabBar/home/index.vue

@@ -168,11 +168,17 @@
 		methods: {
 			// 获取当前编码region
 			handlerGetRegion(longitude, latitude) {
-				getCurrentLocation({ latitude, longitude }).then(res => {
-					console.log("getCurrentLocation",res)
-					let { district, id } = res.data
-					this.queryParams.region = id;
-					this.nowAddress = district.name
+        let point = `${latitude},${longitude}`
+				getCurrentLocation({point}).then(res => {
+					let { city , district, id } = res.data
+          this.queryParams.region = res.data.id;
+          if(district){
+            this.nowAddress = district.name
+          }else if(city){
+            this.nowAddress = district.name
+          }else{
+            this.nowAddress = '地图'
+          }
 					this.getHomeData(this.queryParams)
 					this.$store.commit('SET_LOCATION', {
 						longitude: longitude,
@@ -204,14 +210,13 @@
 				// getMapLocation()
 				uni.chooseLocation({
 					success: res => {
-						console.log("chooseLocation",res)
 						let { longitude , latitude } = res
 						this.queryParams.longitude = longitude.toFixed(5);
 						this.queryParams.latitude = latitude.toFixed(5);
 						this.handlerGetRegion(longitude.toFixed(5) , latitude.toFixed(5))
 					},
 					fail: err => {
-						
+						console.log("@@err")
 					}
 				});
 			},
@@ -265,4 +270,4 @@
 
 <style lang="scss" scoped>
 	@import './index.scss';
-</style>
+</style>