jiangfeng 5 лет назад
Родитель
Сommit
051a5cc2be
2 измененных файлов с 29 добавлено и 0 удалено
  1. 9 0
      hdApp/src/api/map/index.js
  2. 20 0
      hdApp/src/pagesClient/official/apply.vue

+ 9 - 0
hdApp/src/api/map/index.js

@@ -0,0 +1,9 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+/** *
+ * 经纬度解析地址  jiangfneg  2021-06-26
+ */
+export const mapResolve = data => {
+	return https.get('/map/resolve', data)
+}
+

+ 20 - 0
hdApp/src/pagesClient/official/apply.vue

@@ -157,6 +157,7 @@ import AppUploader from "@/components/app-uploader";
 import AppBindInfo from "@/components/app-bind-info";
 const form = require("@/utils/formValidation.js");
 import { getIntroduce, applyRegister } from "@/api/official";
+import { mapResolve } from "@/api/map";
 export default {
   name: "apply-data",
   components: {
@@ -199,6 +200,25 @@ export default {
     };
   },
   onLoad() {},
+  onShow() {
+  	let self = this
+			uni.getLocation({
+				type: 'wgs84',
+				success: function (res) {
+					mapResolve({lat:res.latitude,long:res.longitude}).then((obj) => {
+						console.log(obj)
+						self.form.longitude=res.longitude,
+						self.form.latitude=res.latitude,
+						self.form.province = obj.data.province
+						self.form.city = obj.data.city
+						self.form.address = obj.data.address
+						self.form.showAddress = obj.data.showAddress
+					})
+					// console.log('当前位置的经度:' + res.longitude);
+					// console.log('当前位置的纬度:' + res.latitude);
+				}
+			});
+		},
   methods: {
     //图片地址
     resultData(val) {