Browse Source

forest天气接口

qinhouyu 1 year ago
parent
commit
b113e5cddb
2 changed files with 27 additions and 19 deletions
  1. 14 7
      src/api/forest.js
  2. 13 12
      src/views/forest.vue

+ 14 - 7
src/api/forest.js

@@ -14,6 +14,13 @@ export function selectByMenuId(data) {
     data: data
   })
 }
+export function getWeather(param) {
+  return request({
+    url: '/center-data/weatherinformation/getWeather',
+    method: 'post',
+    data: param
+  })
+}
 // 获取日历颜色状态
 export function getEventByCalendar(param) {
   return request({
@@ -96,13 +103,13 @@ export function getDeptEventCount(param,loading) {
   })
 }
 // 右侧获取天气
-export function getWeather(param) {
-  return request({
-    url: '/center-emergency/VisuEmergencyCloudMapController/getWeather',
-    method: 'post',
-    data: param
-  })
-}
+// export function getWeather(param) {
+//   return request({
+//     url: '/center-emergency/VisuEmergencyCloudMapController/getWeather',
+//     method: 'post',
+//     data: param
+//   })
+// }
 // 任务接口
 export function selectTaskBO(data) {
   return request({

+ 13 - 12
src/views/forest.vue

@@ -939,23 +939,24 @@ export default {
       })
     },
     getWeather(day) {
-      let that = this
       //右侧获取天气信息
-      getWeather({ day: day }).then(res => {
+      getWeather({
+        day: day
+      }).then(res => {
         if (res.code == 200) {
-          if (res.msg == '天气未添加') {
+          if (res.data.length == 0) {
             this.todatWeather = false
           } else {
             this.todatWeather = true
-            this.weatherinformationDirection = res.data.weatherinformationDirection
-            this.weatherinformationHigh = res.data.weatherinformationHigh
-            this.weatherinformationLevel = res.data.weatherinformationLevel
-            this.weatherinformationLevelValue = res.data.weatherinformationLevelValue
-            this.weatherinformationLow = res.data.weatherinformationLow
-            this.weatherinformationPower = res.data.weatherinformationPower
-            this.weatherinformationTemperature = res.data.weatherinformationTemperature
-            this.weatherinformationTime = res.data.weatherinformationTime
-            this.weatherinformationWeather = res.data.weatherinformationWeather
+            this.weatherinformationDirection = res.data[0].weatherinformationDirection
+            this.weatherinformationHigh = res.data[0].weatherinformationHigh
+            this.weatherinformationLevel = res.data[0].weatherinformationLevel
+            this.weatherinformationLevelValue = res.data[0].weatherinformationLevelValue
+            this.weatherinformationLow = res.data[0].weatherinformationLow
+            this.weatherinformationPower = res.data[0].weatherinformationPower
+            this.weatherinformationTemperature = res.data[0].weatherinformationTemperature
+            this.weatherinformationTime = res.data[0].weatherinformationTime
+            this.weatherinformationWeather = res.data[0].weatherinformationWeather
           }
         } else {
           this.todatWeather = false