Pārlūkot izejas kodu

fix:sk的天气数据修改

chenzhen2 1 gadu atpakaļ
vecāks
revīzija
44ab0945e7
2 mainītis faili ar 11 papildinājumiem un 6 dzēšanām
  1. 4 2
      src/utils/index.ts
  2. 7 4
      src/views/weather/index.vue

+ 4 - 2
src/utils/index.ts

@@ -110,7 +110,8 @@ export const setQueryConfig = function (queryConfig: any) {
 export const getUserInfo = function () {
   // debugger
   const paramsInfo: any = {
-    projectId: 'Pj1101080259'
+    // projectId: 'Pj1101080259',
+    projectId: 'Pj1101050050'
   }
 
   return paramsInfo
@@ -120,7 +121,8 @@ export const getUserInfo = function () {
 // 地址通用参赛携带
 export const getComparams = function () {
   const paramsInfo: any = {
-    projectId: 'Pj1101080259'
+    // projectId: 'Pj1101080259', 
+    projectId: 'Pj1101050050'
   }
 }
 

+ 7 - 4
src/views/weather/index.vue

@@ -229,8 +229,10 @@ export default defineComponent({
         getWeather().then((res) => {
           let resResult: any = res;
           let content: any = resResult.content;
-          proxyData.temperature = content.temperature;
-          proxyData.setWeatherKey(content);
+          if (content) {
+            proxyData.temperature = content.temperature;
+            proxyData.setWeatherKey(content);
+          }
         });
       },
       timer: timer,
@@ -294,13 +296,14 @@ export default defineComponent({
       clearTimeout(proxyData.times);
     });
     onMounted(() => {
+      // 页面跳转修改
+      proxyData.changePage();
+      // 设置当前时间
       proxyData.setNowDate();
       // 获取天气数据
       proxyData.getWeatherData();
       // 获取环境数据
       proxyData.queryEnvCurrent();
-      proxyData.changePage();
-      // proxyData.setTimer();
     });
     return {
       ...toRefs(proxyData),