Răsfoiți Sursa

地址获取bug修改

15102826049 1 săptămână în urmă
părinte
comite
7715ef190c
2 a modificat fișierele cu 20 adăugiri și 9 ștergeri
  1. 2 2
      .env.development
  2. 18 7
      src/pagesOne/winner/index.vue

+ 2 - 2
.env.development

@@ -11,6 +11,6 @@ VITE_APP_BASE_API = ''
 VITE_CLI_BABEL_TRANSPILE_MODULES = true
 
 # VITE_API_URL=http://192.168.168.104:8090
-VITE_API_URL=https://test-coupon.qiuyutech.com.cn/stage-api
-# VITE_API_URL=https://coupon.qiuyutech.com.cn/prod-api
+# VITE_API_URL=https://test-coupon.qiuyutech.com.cn/stage-api
+VITE_API_URL=https://coupon.qiuyutech.com.cn/prod-api
 

+ 18 - 7
src/pagesOne/winner/index.vue

@@ -270,9 +270,25 @@ const handledUpload = async () => {
         uni.authorize({
           scope: "scope.userLocation",
           success() {
-            showUpload.value = true;
-
             // 用户同意授权
+            uni.getLocation({
+              type: "wgs84",
+              success: function (res) {
+                console.log("当前位置的经度:" + res.longitude);
+                console.log("当前位置的纬度:" + res.latitude);
+                uni.setStorageSync("location", JSON.stringify(res));
+                setTimeout(() => {
+                  showUpload.value = true;
+                }, 500);
+              },
+              fail(error) {
+                uni.showToast({
+                  title: "请勿频繁调用!",
+                  icon: "none",
+                });
+              },
+            });
+            showUpload.value = true;
           },
           fail() {
             // 用户拒绝授权
@@ -292,11 +308,6 @@ const handledUpload = async () => {
             console.log("当前位置的经度:" + res.longitude);
             console.log("当前位置的纬度:" + res.latitude);
             uni.setStorageSync("location", JSON.stringify(res));
-            // uni.showToast({
-            //   title: "当前位置的经纬度:" + res.longitude + "," + res.latitude,
-            //   icon: "success",
-            //   mask: true,
-            // });
             setTimeout(() => {
               showUpload.value = true;
             }, 500);