From 5eabef51347443517b9f04bf67f60772ae658a85 Mon Sep 17 00:00:00 2001 From: Kai Date: Wed, 21 Jul 2021 16:18:27 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E9=9B=BB=E7=AB=99=E7=B8=BD=E8=A6=BD=20?= =?UTF-8?q?=E5=8D=B3=E6=99=82=E8=B3=87=E8=A8=8A=E5=8A=A0=E5=85=A5=E9=9B=BB?= =?UTF-8?q?=E7=AB=99=E7=8B=80=E6=85=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StationOverviewController.cs | 1 + SolarPower/Models/Overview.cs | 1 + .../StationOverview/StationOverviewInfo.cshtml | 17 ++++++++++++----- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/SolarPower/Controllers/StationOverviewController.cs b/SolarPower/Controllers/StationOverviewController.cs index 11f682d..f95e50b 100644 --- a/SolarPower/Controllers/StationOverviewController.cs +++ b/SolarPower/Controllers/StationOverviewController.cs @@ -182,6 +182,7 @@ namespace SolarPower.Controllers stationOverview.TodayWeatherTemp = powerStation.TodayWeatherTemp; stationOverview.RateOfRain = powerStation.RateOfRain; stationOverview.StationName = powerStation.Name; + stationOverview.HealthStatus = powerStation.HealthStatus; apiResult.Code = "0000"; apiResult.Data = stationOverview; diff --git a/SolarPower/Models/Overview.cs b/SolarPower/Models/Overview.cs index 7777442..29616cb 100644 --- a/SolarPower/Models/Overview.cs +++ b/SolarPower/Models/Overview.cs @@ -61,6 +61,7 @@ namespace SolarPower.Models public double TodayWeatherTemp { get; set; } public string StationName { get; set; } public string CityName { get; set; } + public byte HealthStatus { get; set; } } public class ChartUptoDate diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index ef2f5e8..623bf82 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -21,11 +21,7 @@

- - - - - + 新竹巨城站

@@ -195,7 +191,18 @@ $("#today_carbon").html(stationOverview.today_carbon.toFixed(2)); $("#total_carbon").html(stationOverview.total_carbon.toFixed(2)); $("#update_at").html(stationOverview.updatedAt); + + var statusicon; + switch (stationOverview.healthStatus) { + case 1: statusicon = ""; break; + case 2: statusicon = ""; break; + case 3: statusicon = ""; break; + default: + statusicon = ''; break; + } + $('#power-station-healthStatus').html(statusicon); $('#power-station-title').html(stationOverview.stationName); + $('#weather-temp').html(stationOverview.todayWeatherTemp + '°C
降雨幾率: ' + stationOverview.rateOfRain + '%'); $('#weather-icon')[0].setAttribute("class", 'fal fa-' + stationOverview.todayWeather + ' fa-3x'); $('#breadcrumbname').html(stationOverview.stationName);