From 7f48ad7939773a9bc02aad98dbc5e11a35d132e1 Mon Sep 17 00:00:00 2001
From: zuoxiao <zuoxiao>
Date: 星期二, 19 八月 2025 15:42:32 +0800
Subject: [PATCH] 更新项目配置,启用URL检查功能;修改监测页面状态管理逻辑,优化在线状态的判断方式,提升用户体验和代码可读性。

---
 pages/stationMonitor/stationMonitor.wxml |   91 +++++++++++++++++++--------------------------
 1 files changed, 38 insertions(+), 53 deletions(-)

diff --git a/pages/stationMonitor/stationMonitor.wxml b/pages/stationMonitor/stationMonitor.wxml
index 1aa0714..7723357 100644
--- a/pages/stationMonitor/stationMonitor.wxml
+++ b/pages/stationMonitor/stationMonitor.wxml
@@ -47,8 +47,8 @@
         <!-- 鐘舵�佹爮 -->
         <view class="status-bar">
           <view class="status-item">
-            <view class="status-indicator {{currentWeatherStation.online ? 'online' : 'offline'}}"></view>
-            <text class="status-text">{{currentWeatherStation.online ? '鍦ㄧ嚎' : '绂荤嚎'}}</text>
+            <view class="status-indicator {{currentWeatherStation.onLine === true ? 'online' : 'offline'}}"></view>
+            <text class="status-text">{{currentWeatherStation.onLine === true ? '鍦ㄧ嚎' : '绂荤嚎'}}</text>
           </view>
           <view class="refresh-btn" bind:tap="refreshWeatherData">
             <image class="refresh-icon" src="/images/refresh.svg" />
@@ -65,7 +65,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">绌烘皵婀垮害(%)</text>
-              <text class="data-value">{{currentWeatherStation.humidity || '--'}}%</text>
+              <text class="data-value">{{currentWeatherStation.humidity !== null && currentWeatherStation.humidity !== undefined ? currentWeatherStation.humidity : '--'}}%</text>
             </view>
           </view>
 
@@ -76,7 +76,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">绌烘皵娓╁害(鈩�)</text>
-              <text class="data-value">{{currentWeatherStation.temperature || '--'}}掳C</text>
+              <text class="data-value">{{currentWeatherStation.temperature !== null && currentWeatherStation.temperature !== undefined ? currentWeatherStation.temperature : '--'}}掳C</text>
             </view>
           </view>
 
@@ -87,7 +87,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">绱绾�(mW/m虏)</text>
-              <text class="data-value">{{currentWeatherStation.uv || '--'}}</text>
+              <text class="data-value">{{currentWeatherStation.uv !== null && currentWeatherStation.uv !== undefined ? currentWeatherStation.uv : '--'}}</text>
             </view>
           </view>
 
@@ -98,7 +98,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍏夌収寮哄害(lm/銕�)</text>
-              <text class="data-value">{{currentWeatherStation.light || '--'}} lux</text>
+              <text class="data-value">{{currentWeatherStation.light !== null && currentWeatherStation.light !== undefined ? currentWeatherStation.light : '--'}} lux</text>
             </view>
           </view>
 
@@ -109,7 +109,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">闆ㄩ噺(mm)</text>
-              <text class="data-value">{{currentWeatherStation.rainfall || '--'}} mm</text>
+              <text class="data-value">{{currentWeatherStation.rainfall !== null && currentWeatherStation.rainfall !== undefined ? currentWeatherStation.rainfall : '--'}} mm</text>
             </view>
           </view>
 
@@ -120,7 +120,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">椋庨��(m/s)</text>
-              <text class="data-value">{{currentWeatherStation.windSpeed || '--'}} m/s</text>
+              <text class="data-value">{{currentWeatherStation.windSpeed !== null && currentWeatherStation.windSpeed !== undefined ? currentWeatherStation.windSpeed : '--'}} m/s</text>
             </view>
           </view>
 
@@ -133,7 +133,7 @@
               <text class="data-label">椋庡悜</text>
               <view class="wind-direction-display">
                 <!-- <image class="wind-arrow" src="/images/wind-arrow.svg" style="transform: rotate({{currentWeatherStation.windDirectionAngle || 0}}deg)" /> -->
-                <text class="data-value">{{currentWeatherStation.windDirection || '--'}}</text>
+                <text class="data-value">{{currentWeatherStation.windDirection !== null && currentWeatherStation.windDirection !== undefined ? currentWeatherStation.windDirection : '--'}}</text>
               </view>
             </view>
           </view>
@@ -166,14 +166,14 @@
           </view>
         </picker>
       </view>
-      
+
       <!-- 鍦熷¥澧掓儏淇℃伅鍗$墖 -->
       <view wx:if="{{currentSoilStation}}" class="weather-info-card">
         <!-- 鐘舵�佹爮 -->
         <view class="status-bar">
           <view class="status-item">
-            <view class="status-indicator {{currentSoilStation.online ? 'online' : 'offline'}}"></view>
-            <text class="status-text">{{currentSoilStation.online ? '鍦ㄧ嚎' : '绂荤嚎'}}</text>
+            <view class="status-indicator {{currentSoilStation.onLine === true ? 'online' : 'offline'}}"></view>
+            <text class="status-text">{{currentSoilStation.onLine === true ? '鍦ㄧ嚎' : '绂荤嚎'}}</text>
           </view>
           <view class="refresh-btn" bind:tap="refreshSoilData">
             <image class="refresh-icon" src="/images/refresh.svg" />
@@ -190,7 +190,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥婀垮害1(%)</text>
-              <text class="data-value">{{currentSoilStation.soilHumidity1 || '--'}}%</text>
+              <text class="data-value">{{currentSoilStation.soilHumidity1 !== null && currentSoilStation.soilHumidity1 !== undefined ? currentSoilStation.soilHumidity1 : '--'}}%</text>
             </view>
           </view>
 
@@ -200,7 +200,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥娓╁害1(鈩�)</text>
-              <text class="data-value">{{currentSoilStation.soilTemperature1 || '--'}}掳C</text>
+              <text class="data-value">{{currentSoilStation.soilTemperature1 !== null && currentSoilStation.soilTemperature1 !== undefined ? currentSoilStation.soilTemperature1 : '--'}}掳C</text>
             </view>
           </view>
 
@@ -211,7 +211,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥婀垮害2(%)</text>
-              <text class="data-value">{{currentSoilStation.soilHumidity2 || '--'}}%</text>
+              <text class="data-value">{{currentSoilStation.soilHumidity2 !== null && currentSoilStation.soilHumidity2 !== undefined ? currentSoilStation.soilHumidity2 : '--'}}%</text>
             </view>
           </view>
 
@@ -221,7 +221,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥娓╁害2(鈩�)</text>
-              <text class="data-value">{{currentSoilStation.soilTemperature2 || '--'}}掳C</text>
+              <text class="data-value">{{currentSoilStation.soilTemperature2 !== null && currentSoilStation.soilTemperature2 !== undefined ? currentSoilStation.soilTemperature2 : '--'}}掳C</text>
             </view>
           </view>
 
@@ -232,7 +232,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥婀垮害3(%)</text>
-              <text class="data-value">{{currentSoilStation.soilHumidity3 || '--'}}%</text>
+              <text class="data-value">{{currentSoilStation.soilHumidity3 !== null && currentSoilStation.soilHumidity3 !== undefined ? currentSoilStation.soilHumidity3 : '--'}}%</text>
             </view>
           </view>
 
@@ -242,7 +242,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥娓╁害3(鈩�)</text>
-              <text class="data-value">{{currentSoilStation.soilTemperature3 || '--'}}掳C</text>
+              <text class="data-value">{{currentSoilStation.soilTemperature3 !== null && currentSoilStation.soilTemperature3 !== undefined ? currentSoilStation.soilTemperature3 : '--'}}掳C</text>
             </view>
           </view>
 
@@ -253,7 +253,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥婀垮害4(%)</text>
-              <text class="data-value">{{currentSoilStation.soilHumidity4 || '--'}}%</text>
+              <text class="data-value">{{currentSoilStation.soilHumidity4 !== null && currentSoilStation.soilHumidity4 !== undefined ? currentSoilStation.soilHumidity4 : '--'}}%</text>
             </view>
           </view>
 
@@ -263,7 +263,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥娓╁害4(鈩�)</text>
-              <text class="data-value">{{currentSoilStation.soilTemperature4 || '--'}}掳C</text>
+              <text class="data-value">{{currentSoilStation.soilTemperature4 !== null && currentSoilStation.soilTemperature4 !== undefined ? currentSoilStation.soilTemperature4 : '--'}}掳C</text>
             </view>
           </view>
 
@@ -274,7 +274,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥婀垮害5(%)</text>
-              <text class="data-value">{{currentSoilStation.soilHumidity5 || '--'}}%</text>
+              <text class="data-value">{{currentSoilStation.soilHumidity5 !== null && currentSoilStation.soilHumidity5 !== undefined ? currentSoilStation.soilHumidity5 : '--'}}%</text>
             </view>
           </view>
 
@@ -284,7 +284,7 @@
             </view>
             <view class="data-content">
               <text class="data-label">鍦熷¥娓╁害5(鈩�)</text>
-              <text class="data-value">{{currentSoilStation.soilTemperature5 || '--'}}掳C</text>
+              <text class="data-value">{{currentSoilStation.soilTemperature5 !== null && currentSoilStation.soilTemperature5 !== undefined ? currentSoilStation.soilTemperature5 : '--'}}掳C</text>
             </view>
           </view>
         </view>
@@ -324,8 +324,8 @@
         <!-- 鐘舵�佹爮 -->
         <view class="status-bar">
           <view class="status-item">
-            <view class="status-indicator {{currentFertilizerStation.onLine === 1 ? 'online' : 'offline'}}"></view>
-            <text class="status-text">{{currentFertilizerStation.onLine === 1 ? '鍦ㄧ嚎' : '绂荤嚎'}}</text>
+            <view class="status-indicator {{currentFertilizerStation.onLine === true ? 'online' : 'offline'}}"></view>
+            <text class="status-text">{{currentFertilizerStation.onLine === true ? '鍦ㄧ嚎' : '绂荤嚎'}}</text>
           </view>
           <view class="refresh-btn" bind:tap="refreshFertilizerData">
             <image class="refresh-icon" src="/images/refresh.svg" />
@@ -340,13 +340,13 @@
             <!-- 鎼呮媽寮�鍏� -->
             <view class="switch-item">
               <text class="switch-label">鎼呮媽</text>
-              <switch class="custom-switch" checked="{{currentFertilizerStation.mixingEnabled}}" bindchange="toggleMixing" disabled="{{currentFertilizerStation.onLine !== 1}}" color="#07c160" />
+              <switch class="custom-switch" checked="{{currentFertilizerStation.mixingEnabled}}" bindchange="toggleMixing" disabled="{{currentFertilizerStation.onLine !== true}}" color="#07c160" />
             </view>
 
             <!-- 娉ㄨ偉寮�鍏� -->
             <view class="switch-item">
               <text class="switch-label">娉ㄨ偉</text>
-              <switch class="custom-switch" checked="{{currentFertilizerStation.fertilizingEnabled}}" bindchange="toggleFertilizing" disabled="{{currentFertilizerStation.onLine !== 1}}" color="#07c160" />
+              <switch class="custom-switch" checked="{{currentFertilizerStation.fertilizingEnabled}}" bindchange="toggleFertilizing" disabled="{{currentFertilizerStation.onLine !== true}}" color="#07c160" />
             </view>
           </view>
         </view>
@@ -362,7 +362,7 @@
               </view>
               <view class="data-content">
                 <text class="data-label">鑲ユ枡娴侀噺(鍗�)</text>
-                <text class="data-value">{{currentFertilizerStation.manureFlow || '--'}} L</text>
+                <text class="data-value">{{currentFertilizerStation.manureFlow !== null && currentFertilizerStation.manureFlow !== undefined ? currentFertilizerStation.manureFlow : '--'}} L</text>
               </view>
             </view>
 
@@ -373,7 +373,7 @@
               </view>
               <view class="data-content">
                 <text class="data-label">娉ㄨ偉鏃堕暱(绉�)</text>
-                <text class="data-value">{{currentFertilizerStation.manureTime || '--'}} s</text>
+                <text class="data-value">{{currentFertilizerStation.manureTime !== null && currentFertilizerStation.manureTime !== undefined ? currentFertilizerStation.manureTime : '--'}} s</text>
               </view>
             </view>
 
@@ -384,7 +384,7 @@
               </view>
               <view class="data-content">
                 <text class="data-label">鎼呮媽鏃堕暱(绉�)</text>
-                <text class="data-value">{{currentFertilizerStation.stirTime || '--'}} s</text>
+                <text class="data-value">{{currentFertilizerStation.stirTime !== null && currentFertilizerStation.stirTime !== undefined ? currentFertilizerStation.stirTime : '--'}} s</text>
               </view>
             </view>
 
@@ -395,7 +395,7 @@
               </view>
               <view class="data-content">
                 <text class="data-label">鎼呮媽璁惧畾鏃堕棿(绉�)</text>
-                <text class="data-value">{{currentFertilizerStation.stirDuration || '--'}} s</text>
+                <text class="data-value">{{currentFertilizerStation.stirDuration !== null && currentFertilizerStation.stirDuration !== undefined ? currentFertilizerStation.stirDuration : '--'}} s</text>
               </view>
             </view>
 
@@ -406,7 +406,7 @@
               </view>
               <view class="data-content">
                 <text class="data-label">娉ㄨ偉璁惧畾鏃堕棿(绉�)</text>
-                <text class="data-value">{{currentFertilizerStation.injectDuration || '--'}} s</text>
+                <text class="data-value">{{currentFertilizerStation.injectDuration !== null && currentFertilizerStation.injectDuration !== undefined ? currentFertilizerStation.injectDuration : '--'}} s</text>
               </view>
             </view>
           </view>
@@ -435,13 +435,13 @@
           <!-- 鎽勫儚澶村悕绉� -->
           <view class="camera-header">
             <text class="camera-name">{{item.name}}</text>
-            <view class="camera-status {{item.online ? 'online' : 'offline'}}">
-              <text>{{item.online ? '鍦ㄧ嚎' : '绂荤嚎'}}</text>
+            <view class="camera-status {{item.onLine === true ? 'online' : 'offline'}}">
+              <text>{{item.onLine === true ? '鍦ㄧ嚎' : '绂荤嚎'}}</text>
             </view>
           </view>
 
           <!-- 鎽勫儚澶磋棰� -->
-          <view class="camera-video-container" style="height: {{deviceSpecificConfig.videoHeight}}rpx;">
+          <view class="camera-video-container" >
             <!-- 鍔犺浇鐘舵�� -->
             <view wx:if="{{item.isLoadingUrl}}" class="video-loading">
               <view class="loading-spinner"></view>
@@ -459,28 +459,13 @@
             </view>
 
             <!-- 姝e父鎾斁鐘舵�� -->
-            <view wx:elif="{{item.online && item.hslUrl}}" class="video-wrapper">
+            <view wx:elif="{{item.onLine && item.hslUrl}}" class="video-wrapper">
               <!-- 鐩存挱鎾斁鍣ㄧ粍浠� -->
-              <ezplayer 
-                id="ezplayer-{{item.id}}" 
-                accessToken="{{item.accessToken}}" 
-                url="{{item.hslUrl}}" 
-                deviceSerial="{{item.deviceSerial}}"
-                channelNo="1"
-                width="300rpx"
-                height="300rpx"
-                plugins="talk,voice,capture,ptz,privacy,mirror" 
-                watermark="澶х"
-                autoPlay="{{true}}"
-                theme="{{ { showFullScreenBtn: true, showHdBtn: true, showTimeLine: true } }}" 
-                bind:handleError="handleError" 
-                bind:onControlEvent="onControlEvent"
-                style="width: 100vw; height: 100%; max-width: 100vw; min-width: 100vw; position: absolute; left: 0; right: 0; top: 0; bottom: 0; overflow: hidden; margin: 0; padding: 0; transform: none; border: none; border-radius: 0; box-shadow: none; background: transparent;"
-              />
+              <ezplayer class="video-wrapper-ezplayer" id="ezplayer-{{item.id}}" accessToken="{{item.accessToken}}" url="{{item.hslUrl}}" deviceSerial="{{item.deviceSerial}}" channelNo="1" plugins="capture,ptz,mirror" watermark="澶х" autoPlay="{{true}}" theme="{{ { showFullScreenBtn: true, showHdBtn: true, showTimeLine: true } }}" bind:handleError="handleError" bind:onControlEvent="onControlEvent" />
             </view>
 
             <!-- 绂荤嚎鐘舵�佹樉绀� -->
-            <view wx:elif="{{!item.online}}" class="video-offline">
+            <view wx:elif="{{!item.onLine}}" class="video-offline">
               <image class="offline-icon" src="/images/camera.svg" />
               <text class="offline-text">璁惧绂荤嚎</text>
             </view>
@@ -492,7 +477,7 @@
             </view>
           </view>
 
-         
+
         </view>
       </view>
 

--
Gitblit v1.8.0