From 8fc47cda4a841395deb71ae7c5659f8d3d7ca19e Mon Sep 17 00:00:00 2001
From: qinbo <qinbo@shsening.com>
Date: 星期四, 28 十月 2021 15:30:31 +0800
Subject: [PATCH] 天气图标 bug fix
---
widgetsTS/weather/widget.js | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/widgetsTS/weather/widget.js b/widgetsTS/weather/widget.js
index 474e45b..8251dba 100644
--- a/widgetsTS/weather/widget.js
+++ b/widgetsTS/weather/widget.js
@@ -30,7 +30,7 @@
reloadData(params) {
$.getJSON(mars3d.global_variables.nodejs_url_predix + "dataapi/Bdata?bid=get_weather_" + mars3d.global_variables.queryDataType + "&datatime=" + mars3d.global_variables.queryDataTStart + "&siteid=" + mars3d.global_variables.weathercitycode, (result) => {
- if (result.data.result.length > 0 ){
+ if (result.data.result.length > 0 && mars3d.global_variables.queryDataType == "hour"){
var current_weather = result.data.result[0];
//var current_weather = { "temp": "25", "feelsLike": "29", "icon": "150", "text": "鏅�", "wind360": "90", "windDir": "涓滈", "windScale": "0", "windSpeed": "0", "humidity": "88", "precip": "0.0", "pressure": "1009", "vis": "16", "cloud": "3", "dew": "23" };
$("#weather_temp").html(current_weather.temp);
@@ -50,7 +50,28 @@
var wind = this.map.getLayerById(2001);
wind.data = this.createWindData();
+ }else if(result.data.result.length > 0 && mars3d.global_variables.queryDataType == "day"){
+ var current_weather = result.data.result[0];
+ $("#weather_temp").html(current_weather.temp);
+ $("#weather_text").html(current_weather.textday);
+ $("#weather_icon").attr('src', './img/qweather/' + current_weather.iconday + '.svg');
+ $("#weather_windScale").html(current_weather.windscaleday);
+ $("#weather_windDir").html(current_weather.winddirday);
+ $("#weather_feelsLike").html(current_weather.feelslike);
+ $("#weather_humidity").html(current_weather.humidity);
+ $("#weather_pressure").html(current_weather.pressure);
+ $("#weather_precip").html(current_weather.precip);
+ $("#weather_vis").html(current_weather.vis);
+ $("#weather_dew").html(current_weather.dew);
+
+ mars3d.global_variables.wind360 = current_weather.wind360day;
+ mars3d.global_variables.windSpeed = current_weather.windSpeed==0?1:current_weather.windspeedday;
+
+ var wind = this.map.getLayerById(2001);
+ wind.data = this.createWindData();
}
+
+
});
}
--
Gitblit v1.9.1