Переглянути джерело

设计page9测报灯业务页面

niujiuru 6 днів тому
батько
коміт
125d6bf46f

+ 1 - 0
web-ui.service/web/app.html

@@ -42,6 +42,7 @@
   <symbol id="i-trend" viewBox="0 0 24 24"><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/><polyline points="17 6 23 6 23 12"/></symbol>
   <symbol id="i-trend" viewBox="0 0 24 24"><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/><polyline points="17 6 23 6 23 12"/></symbol>
   <symbol id="i-refresh" viewBox="0 0 24 24"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></symbol>
   <symbol id="i-refresh" viewBox="0 0 24 24"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></symbol>
   <symbol id="i-cbd" viewBox="0 0 24 24"><rect x="8" y="7" width="8" height="13" rx="4"/><path d="M9 7a3 3 0 0 1 6 0"/><line x1="12" y1="2" x2="12" y2="4"/><line x1="8.5" y1="11" x2="3" y2="11"/><line x1="8.5" y1="15" x2="3" y2="15"/><line x1="8.5" y1="18" x2="4" y2="20"/><line x1="15.5" y1="11" x2="21" y2="11"/><line x1="15.5" y1="15" x2="21" y2="15"/><line x1="15.5" y1="18" x2="20" y2="20"/><line x1="12" y1="11" x2="12" y2="20"/></symbol>
   <symbol id="i-cbd" viewBox="0 0 24 24"><rect x="8" y="7" width="8" height="13" rx="4"/><path d="M9 7a3 3 0 0 1 6 0"/><line x1="12" y1="2" x2="12" y2="4"/><line x1="8.5" y1="11" x2="3" y2="11"/><line x1="8.5" y1="15" x2="3" y2="15"/><line x1="8.5" y1="18" x2="4" y2="20"/><line x1="15.5" y1="11" x2="21" y2="11"/><line x1="15.5" y1="15" x2="21" y2="15"/><line x1="15.5" y1="18" x2="20" y2="20"/><line x1="12" y1="11" x2="12" y2="20"/></symbol>
+  <symbol id="i-unlock" viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0 1 9.9-1"/></symbol>
 </svg>
 </svg>
 
 
 <div id="loading-mask">
 <div id="loading-mask">

+ 113 - 45
web-ui.service/web/pages/page9.html

@@ -2,61 +2,129 @@
 <html lang="zh-CN">
 <html lang="zh-CN">
 
 
 <head>
 <head>
-<meta charset="utf-8">
-<title>虫情测报</title>
+  <meta charset="utf-8">
+  <title>虫情测报</title>
 </head>
 </head>
 
 
 <body>
 <body>
-<div class="app">
-  <main class="view page-cbd">
-    <div class="panes">
-      <!-- 左栏 -->
-      <div class="left-pane">
-        <div class="card command-card">
-          <div class="card-header">
-            <h2>常用指令</h2>
-          </div>
-          <div class="command-content">
-          </div>
-        </div>
-        <div class="card firmware-card">
-          <div class="card-header">
-            <h2>固件升级</h2>
+  <div class="app">
+    <main class="view page-cbd">
+      <div class="panes">
+        <!-- 左栏 -->
+        <div class="left-pane">
+          <!-- 设备控制 -->
+          <div class="card command-card">
+            <div class="card-header">
+              <h2>设备控制</h2>
+              <button class="btn auth-btn" id="p9AuthBtn" title="点击授权解锁操作" onclick="enableP9Buttons()">
+                <svg class="icon">
+                  <use href="#i-unlock" xlink:href="#i-unlock"/>
+                </svg>
+              </button>
+            </div>
+
+            <div class="command-content">
+              <!-- 通信状态 -->
+              <div class="comm-status">
+                <div class="comm-item">
+                  <span>控制板最后活动时间</span>
+                  <strong id="text1">--</strong>
+                </div>
+                <div class="comm-item">
+                  <span>服务器最后交互时间</span>
+                  <strong id="text2">--</strong>
+                </div>
+              </div>
+
+              <!-- 灯光控制 -->
+              <div class="command-group">
+                <h3>灯光控制</h3>
+                <div class="command-buttons">
+                  <button class="cmd-btn cmd-btn-1" id="p9btn01" onclick="onP9Btn01Click()" disabled>打开灯管</button>
+                  <button class="cmd-btn cmd-btn-0" id="p9btn02" onclick="onP9Btn02Click()" disabled>关闭灯管</button>
+                  <button class="cmd-btn cmd-btn-1" id="p9btn03" onclick="onP9Btn03Click()" disabled>打开补光</button>
+                  <button class="cmd-btn cmd-btn-0" id="p9btn04" onclick="onP9Btn04Click()" disabled>关闭补光</button>
+                </div>
+              </div>
+
+              <!-- 仓门控制 -->
+              <div class="command-group">
+                <h3>仓门控制</h3>
+                <div class="command-buttons">
+                  <button class="cmd-btn cmd-btn-1" id="p9btn05" onclick="onP9Btn05Click()" disabled>打开上仓</button>
+                  <button class="cmd-btn cmd-btn-0" id="p9btn06" onclick="onP9Btn06Click()" disabled>关闭上仓</button>
+                  <button class="cmd-btn cmd-btn-1" id="p9btn07" onclick="onP9Btn07Click()" disabled>打开下仓</button>
+                  <button class="cmd-btn cmd-btn-0" id="p9btn08" onclick="onP9Btn08Click()" disabled>关闭下仓</button>
+                </div>
+              </div>
+
+              <!-- 加热控制 -->
+              <div class="command-group">
+                <h3>加热控制</h3>
+                <div class="command-buttons">
+                  <button class="cmd-btn cmd-btn-1" id="p9btn09" onclick="onP9Btn09Click()" disabled>开始加热</button>
+                  <button class="cmd-btn cmd-btn-0" id="p9btn10" onclick="onP9Btn10Click()" disabled>停止加热</button>
+                </div>
+              </div>
+
+              <!-- 清扫控制 -->
+              <div class="command-group">
+                <h3>清扫控制</h3>
+                <div class="command-buttons">
+                  <button class="cmd-btn cmd-btn-1" id="p9btn11" onclick="onP9Btn11Click()" disabled>执行清扫</button>
+                </div>
+              </div>
+
+              <!-- 拍照测试 -->
+              <div class="command-group">
+                <h3>拍照测试</h3>
+                <div class="command-buttons">
+                  <button class="cmd-btn cmd-btn-1" id="p9btn12" onclick="onP9Btn12Click()" disabled>执行拍照</button>
+                </div>
+              </div>
+            </div>
           </div>
           </div>
-          <div class="firmware-content">
+
+          <!-- 固件升级 -->
+          <div class="card firmware-card">
+            <div class="card-header">
+              <h2>固件升级</h2>
+            </div>
+            <div class="firmware-content">
+            </div>
           </div>
           </div>
         </div>
         </div>
-      </div>
-      <!-- 右栏 -->
-      <div class="right-pane">
-        <div class="card log-card">
-          <div class="card-header">
-            <h2>应用日志</h2>
-            <div class="log-actions">
-              <select class="log-level-select" id="logLevel" title="当前服务日志级别" onchange="setCBDLogLevel()">
-                <option value="trace">trace</option>
-                <option value="debug">debug</option>
-                <option value="info" selected>info</option>
-                <option value="error">error</option>
-                <option value="fatal">fatal</option>
-              </select>
-              <span style="margin:0 1px;"></span>
-              <button class="btn" title="复制当前屏显日志" onclick="copyLog('text4')">复制</button>
-              <span style="margin:0 1px;"></span>
-              <button class="btn" title="清除当前屏显日志" onclick="clearLog('text4')">清除</button>
-              <span style="margin:0 1px;"></span>
-              <button class="btn" title="下载服务日志文件" onclick="downloadCBDLogFile(event)">下载</button>
-              <span style="margin:0 1px;"></span>
-              <button class="btn" title="点击重启用户应用" onclick="restartCBDService(event)">重启</button>
+
+        <!-- 右栏 -->
+        <div class="right-pane">
+          <!-- 应用日志 -->
+          <div class="card log-card">
+            <div class="card-header">
+              <h2>应用日志</h2>
+              <div class="log-actions">
+                <select class="log-level-select" id="logLevel" title="当前服务日志级别" onchange="setCBDLogLevel()">
+                  <option value="trace">trace</option>
+                  <option value="debug">debug</option>
+                  <option value="info" selected>info</option>
+                  <option value="error">error</option>
+                  <option value="fatal">fatal</option>
+                </select>
+                <span style="margin:0 1px;"></span>
+                <button class="btn" title="复制当前屏显日志" onclick="copyLog('text4')">复制</button>
+                <span style="margin:0 1px;"></span>
+                <button class="btn" title="清除当前屏显日志" onclick="clearLog('text4')">清除</button>
+                <span style="margin:0 1px;"></span>
+                <button class="btn" title="下载服务日志文件" onclick="downloadCBDLogFile(event)">下载</button>
+                <span style="margin:0 1px;"></span>
+                <button class="btn" title="点击重启用户应用" onclick="restartCBDService(event)">重启</button>
+              </div>
             </div>
             </div>
+            <div class="output" id="text4">自动实时获取数据...</div>
           </div>
           </div>
-          <div class="output" id="text4">自动实时获取数据...</div>
         </div>
         </div>
       </div>
       </div>
-      <!-- 结束 -->
-    </div>
-  </main>
-</div>
+    </main>
+  </div>
 </body>
 </body>
 
 
 </html>
 </html>

+ 141 - 1
web-ui.service/web/static/css/page9.css

@@ -34,7 +34,7 @@
     overflow: hidden;
     overflow: hidden;
 }
 }
 
 
-/* 常用指令:占2/3 */
+/* 设备控制:占2/3 */
 .page-cbd .command-card {
 .page-cbd .command-card {
     flex: 2;
     flex: 2;
 }
 }
@@ -52,6 +52,131 @@
     overflow: auto;
     overflow: auto;
 }
 }
 
 
+/* 设备控制内容 */
+.page-cbd .command-content {
+    padding: 0;
+}
+
+/* 通信状态 */
+.page-cbd .comm-status {
+    display: grid;
+    grid-template-columns: repeat(2, minmax(0, 1fr));
+    gap: 12px;
+    margin-bottom: 12px;
+    padding: 12px 14px;
+    border: 1px solid #263650;
+    border-radius: 6px;
+    background: #151f33;
+}
+
+.page-cbd .comm-item {
+    display: flex;
+    flex-direction: column;
+    gap: 6px;
+    min-width: 0;
+}
+
+.page-cbd .comm-item span {
+    color: #94a3b8;
+    font-size: 12px;
+}
+
+.page-cbd .comm-item strong {
+    color: #dbeafe;
+    font-size: 13px;
+    font-weight: 500;
+    font-variant-numeric: tabular-nums;
+    overflow-wrap: anywhere;
+}
+
+/* 控制分组 */
+.page-cbd .command-group {
+    padding: 14px;
+    margin-bottom: 12px;
+    border: 1px solid #263650;
+    border-radius: 6px;
+    background: #151f33;
+}
+
+.page-cbd .command-group:last-child {
+    margin-bottom: 0;
+}
+
+/* 分组标题 */
+.page-cbd .command-group h3 {
+    margin: 0 0 12px;
+    padding-left: 9px;
+    border-left: 3px solid #3b82f6;
+    color: #dbeafe;
+    font-size: 14px;
+    font-weight: 600;
+    line-height: 18px;
+}
+
+/* 指令按钮布局 */
+.page-cbd .command-buttons {
+    display: grid;
+    grid-template-columns: repeat(2, minmax(0, 1fr));
+    gap: 8px;
+}
+
+/* 指令按钮 */
+.page-cbd .cmd-btn {
+    position: relative;
+    width: 100%;
+    min-width: 0;
+    min-height: 38px;
+    padding: 6px 8px 6px 18px;
+    border: 1px solid #34445f;
+    border-radius: 5px;
+    background: #1c2940;
+    color: #cbd5e1;
+    font-size: 13px;
+    cursor: pointer;
+    white-space: nowrap;
+    transition: background 0.15s, border-color 0.15s, color 0.15s;
+}
+
+.page-cbd .cmd-btn::before {
+    content: "";
+    position: absolute;
+    left: 8px;
+    top: 50%;
+    width: 5px;
+    height: 5px;
+    border-radius: 50%;
+    transform: translateY(-50%);
+}
+
+.page-cbd .cmd-btn-1::before {
+    background: #36b99a;
+}
+
+.page-cbd .cmd-btn-0::before {
+    background: #df826e;
+}
+
+.page-cbd .cmd-btn:hover {
+    border-color: #52749c;
+    background: #243750;
+    color: #e2e8f0;
+}
+
+.page-cbd .cmd-btn:active {
+    background: #293e58;
+    color: #fff;
+}
+
+.page-cbd .cmd-btn:disabled {
+    opacity: 0.5;
+    cursor: not-allowed;
+}
+
+/* 固件升级内容 */
+.page-cbd .firmware-content {
+    padding: 12px;
+}
+
 /* 右栏:应用日志 */
 /* 右栏:应用日志 */
 .page-cbd .right-pane {
 .page-cbd .right-pane {
     flex: 1;
     flex: 1;
@@ -103,3 +228,18 @@
         min-height: 400px;
         min-height: 400px;
     }
     }
 }
 }
+
+/* ================= 小屏适配 (≤480px) ================= */
+@media (max-width: 480px) {
+    .page-cbd .command-buttons {
+        grid-template-columns: 1fr;
+    }
+
+    .page-cbd .comm-status {
+        grid-template-columns: 1fr;
+    }
+
+    .page-cbd .log-actions {
+        gap: 4px;
+    }
+}

+ 22 - 0
web-ui.service/web/static/js/page9.js

@@ -100,7 +100,29 @@ function restartCBDService(event) {
         });
         });
 }
 }
 
 
+function disableP9Buttons() {
+    for (var i = 1; i <= 12; i++) {
+        setBtnStatus("p9btn" + (i < 10 ? "0" : "") + i, false, "page9");
+    }
+}
+
+function enableP9Buttons() {
+    var password = prompt("请输入操作密码:");
+    if (password === null) {
+        return;
+    }
+    if (password !== "8888") {
+        alert("操作密码错误!");
+        return;
+    }
+    for (var i = 1; i <= 12; i++) {
+        setBtnStatus("p9btn" + (i < 10 ? "0" : "") + i, true, "page9");
+    }
+    setBtnStatus("p9AuthBtn", false, "page9"); // 解锁成功后禁用开锁按钮
+}
+
 function initPage9() {
 function initPage9() {
+  disableP9Buttons()
   connectLog("yfkj-user-app.service", "text4");
   connectLog("yfkj-user-app.service", "text4");
   getCBDLogLevel()
   getCBDLogLevel()
 }
 }