Ver Fonte

提交首页信息

wangming há 1 mês atrás
pai
commit
0ba2380c00
3 ficheiros alterados com 31 adições e 15 exclusões
  1. 0 1
      src/components/component/tenMinutes.vue
  2. 3 0
      src/manifest.json
  3. 28 14
      src/pages/home/home.vue

+ 0 - 1
src/components/component/tenMinutes.vue

@@ -375,7 +375,6 @@ export default {
             } catch (error) {
                 console.error(`getContactList error: `, error);
             }
-            wx.hideLoading();
         },
         async call(e) {
             this.alarmModel = false;

+ 3 - 0
src/manifest.json

@@ -56,6 +56,9 @@
         "permission": {
             "scope.websocket": {
                 "desc": "用于设备通信"
+            },
+            "scope.userLocation": {
+                "desc": "你的位置信息将用于小程序定位"
             }
         },
         "appid": "wx60b2cd643b46d5eb",

+ 28 - 14
src/pages/home/home.vue

@@ -245,9 +245,6 @@ export default {
                 });
         },
         getShareNum() {
-            // uni.showLoading({
-            //     title: "雷能守护中...",
-            // });
             this.$http
                 .post("wap/share/queryDevShare", {
                     userId: uni.getStorageSync("userId"),
@@ -259,7 +256,6 @@ export default {
         },
         // 获取天气接口
         getWeather() {
-            console.log("获取天气", 999999);
             uni.request({
                 url: "https://kp36x7gr79.re.qweatherapi.com/v7/weather/now", // 使用官方域名
                 data: {
@@ -314,6 +310,7 @@ export default {
             this.getperSonInfo();
             this.getShareNum();
             this.getWarmList();
+            this.getWeather();
             this.isInitAlarm = true;
             this.isIniTenMinutes = true;
         }
@@ -322,16 +319,33 @@ export default {
         if (!selectedService) {
             uni.setStorageSync("sercviceChoice", "aloneServe");
         }
-        uni.getLocation({
-            type: "wgs84",
-            success: (res) => {
-                if (res) {
-                    // this.weatherText = res.data.now.text;
-                    console.log(res, 99999);
-                }
-                this.getWeather();
-            },
-        });
+        // uni.getLocation({
+        //     type: "wgs84",
+        //     success: (res) => {
+        //         console.log(res, 999999);
+        //         if (res) {
+        //             uni.request({
+        //                 url: `https://apis.map.qq.com/ws/geocoder/v1/?location=${res.latitude},${res.longitude}&key=${key}&get_poi=0`,
+        //                 data: {
+        //                     // location: "101220101", // 城市ID
+        //                     // key: "72afe228cd7f436ebea7caa1345956f2", // 你的API Key
+        //                 },
+        //                 method: "GET",
+        //                 success: (res) => {
+        //                     console.log(res, 8870);
+        //                     if (res.statusCode === 200) {
+        //                         this.weatherText = res.data.now.text;
+        //                     }
+        //                 },
+        //                 fail: (err) => {
+        //                     console.error("网络错误:", err);
+        //                 },
+        //             });
+        //             console.log(res, 99999);
+        //         }
+        //         this.getWeather();
+        //     },
+        // });
     },
     onHide() {
         this.isInitAlarm = false;