Просмотр исходного кода

继续编辑page9测报灯业务页面

niujiuru 2 дней назад
Родитель
Сommit
c9ed972610

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

@@ -43,6 +43,7 @@
   <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-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>
+  <symbol id="i-server-config" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><path d="M14 2v6h6"/><path d="M11 11c-2 0-2 1-2 2v1c0 1-1 1-2 1 1 0 2 0 2 1v1c0 1 0 2 2 2M13 11c2 0 2 1 2 2v1c0 1 1 1 2 1-1 0-2 0-2 1v1c0 1 0 2-2 2"/></symbol>
 </svg>
 
 <div id="loading-mask">

+ 20 - 1
web-ui.service/web/pages/page9.html

@@ -18,6 +18,11 @@
           <div class="card status-card">
             <div class="card-header">
               <h2>设备状态</h2>
+              <button class="btn" title="点击查看服务器配置" onclick="viewCBDServerConfig()">
+                <svg class="icon">
+                  <use href="#i-server-config" xlink:href="#i-server-config"/>
+                </svg>
+              </button>
             </div>
             <div class="status-content">
               <div class="status-group">
@@ -41,7 +46,7 @@
           <div class="card command-card">
             <div class="card-header">
               <h2>设备控制</h2>
-              <button class="btn auth-btn" id="p9AuthBtn" title="点击授权解锁操作" onclick="enableP9CtrlCmdButtons()">
+              <button class="btn" id="p9AuthBtn" title="点击授权解锁操作" onclick="enableP9CtrlCmdButtons()">
                 <svg class="icon">
                   <use href="#i-unlock" xlink:href="#i-unlock"/>
                 </svg>
@@ -136,6 +141,20 @@
           </div>
         </div>
       </div>
+
+      <!-- 服务器配置弹窗 -->
+      <div class="config-modal" id="p9ConfigModal">
+        <div class="config-dialog">
+          <div class="config-header">
+            <h2>服务器配置</h2>
+            <button class="config-close" onclick="closeCBDServerConfig()">&times;</button>
+          </div>
+          <div class="config-body">
+            <pre id="p9ConfigContent">正在加载...</pre>
+          </div>
+        </div>
+      </div>
+
     </main>
   </div>
 </body>

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

@@ -1,3 +1,4 @@
+
 /* 页面整体布局 */
 .page-cbd {
     display: flex;
@@ -36,7 +37,8 @@
 /* 设备状态:固定高度 */
 .page-cbd .status-card {
     flex: none;
-    height: 160px;
+    height: 180px;
+    white-space: normal;
 }
 
 /* 设备控制:占剩余空间的3/4 */
@@ -214,6 +216,71 @@
     min-height: 0;
 }
 
+/* 服务器配置弹窗 */
+.page-cbd .config-modal {
+    display: none;
+    position: fixed;
+    inset: 0;
+    z-index: 1000;
+    padding: 20px;
+    background: rgba(0, 0, 0, 0.65);
+    align-items: center;
+    justify-content: center;
+}
+
+.page-cbd .config-modal.show {
+    display: flex;
+}
+
+.page-cbd .config-dialog {
+    display: flex;
+    flex-direction: column;
+    width: 100%;
+    max-width: 760px;
+    max-height: 85vh;
+    background: #17243a;
+    border: 1px solid #30435f;
+    border-radius: 10px;
+    overflow: hidden;
+}
+
+.page-cbd .config-header {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 14px 18px;
+    border-bottom: 1px solid #30435f;
+}
+
+.page-cbd .config-header h2 {
+    font-size: 16px;
+    color: #e2eaf5;
+}
+
+.page-cbd .config-close {
+    border: 0;
+    background: none;
+    color: #9aacc5;
+    font-size: 26px;
+    cursor: pointer;
+}
+
+.page-cbd .config-body {
+    flex: 1;
+    min-height: 0;
+    overflow: auto;
+    padding: 16px;
+}
+
+.page-cbd .config-body pre {
+    margin: 0;
+    color: #b9d5f5;
+    font-family: Consolas, monospace;
+    font-size: 13px;
+    line-height: 1.7;
+    white-space: pre;
+}
+
 /* ================= 移动端适配 (≤768px) ================= */
 @media (max-width: 768px) {
     .page-cbd .panes {

+ 43 - 6
web-ui.service/web/static/js/page9.js

@@ -120,6 +120,43 @@ function enableP9CtrlCmdButtons() {
     }
     setBtnStatus("p9AuthBtn", false, "page9"); // 解锁成功后禁用开锁按钮
 }
+
+function viewCBDServerConfig() {
+    var password = prompt("请输入操作密码:");
+    if (password === null) {
+        return;
+    }
+    if (password !== "8888") {
+        alert("操作密码错误!");
+        return;
+    }
+
+    var modal = document.getElementById("p9ConfigModal");
+    var content = document.getElementById("p9ConfigContent");
+
+    content.textContent = "正在加载...";
+    modal.classList.add("show");
+
+    fetch("/api/cbd/serverCfg")
+        .then(function (r) {
+            if (!r.ok) {
+                throw new Error("HTTP " + r.status);
+            }
+            return r.json();
+        })
+        .then(function (data) {
+            content.textContent = JSON.stringify(data, null, 2);
+        })
+        .catch(function (e) {
+            console.error("viewCBDServerConfig() failed:", e);
+            content.textContent = "获取服务器配置失败:" + e.message;
+        });
+}
+
+function closeCBDServerConfig() {
+    document.getElementById("p9ConfigModal").classList.remove("show");
+}
+
 var cbdWorkStatusTimer = null;
 
 function getCBDWorkStatus() {
@@ -141,7 +178,7 @@ function getCBDWorkStatus() {
             setText("text2", null, "page9");
             setText("text3", null, "page9");
         });
-    getCBDLogLevel()
+    getCBDLogLevel();
 }
 
 function startCBDWorkStatusRefresh() {
@@ -162,12 +199,12 @@ function stopCBDWorkStatusRefresh() {
 }
 
 function initPage9() {
-  disableP9CtrlCmdButtons()
-  startCBDWorkStatusRefresh()
-  connectLog("yfkj-user-app.service", "text5");
+    disableP9CtrlCmdButtons();
+    startCBDWorkStatusRefresh();
+    connectLog("yfkj-user-app.service", "text5");
 }
 
 function exitPage9() {
-  stopCBDWorkStatusRefresh()
-  disconnectLog();
+    stopCBDWorkStatusRefresh();
+    disconnectLog();
 }