From e5e76412f1a20e8aed95614cbd7bf2b638cda2cc Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期三, 11 三月 2026 13:30:31 +0800
Subject: [PATCH] 1

---
 zy-acs-hex/src/main/webapp/views/index.html |  165 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 165 insertions(+), 0 deletions(-)

diff --git a/zy-acs-hex/src/main/webapp/views/index.html b/zy-acs-hex/src/main/webapp/views/index.html
new file mode 100644
index 0000000..63acba4
--- /dev/null
+++ b/zy-acs-hex/src/main/webapp/views/index.html
@@ -0,0 +1,165 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>鏈哄櫒浜烘棩蹇楃郴缁�</title>
+    <style>
+        * {
+            margin: 0;
+            padding: 0;
+            box-sizing: border-box;
+        }
+        body {
+            font-family: Arial, sans-serif;
+            background-color: #f0f2f5;
+        }
+        .header {
+            background-color: #1890ff;
+            color: white;
+            padding: 15px 20px;
+            display: flex;
+            justify-content: space-between;
+            align-items: center;
+        }
+        .header h1 {
+            font-size: 20px;
+        }
+        .header button {
+            background-color: transparent;
+            color: white;
+            border: 1px solid white;
+            padding: 5px 15px;
+            border-radius: 4px;
+            cursor: pointer;
+        }
+        .header button:hover {
+            background-color: rgba(255,255,255,0.1);
+        }
+        .container {
+            padding: 20px;
+        }
+        .refresh-btn {
+            background-color: #1890ff;
+            color: white;
+            border: none;
+            padding: 8px 16px;
+            border-radius: 4px;
+            cursor: pointer;
+            margin-bottom: 20px;
+        }
+        .refresh-btn:hover {
+            background-color: #40a9ff;
+        }
+        table {
+            width: 100%;
+            border-collapse: collapse;
+            background-color: white;
+            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
+        }
+        th, td {
+            padding: 12px;
+            text-align: left;
+            border-bottom: 1px solid #ddd;
+        }
+        th {
+            background-color: #f5f5f5;
+            font-weight: bold;
+        }
+        tr:hover {
+            background-color: #f5f5f5;
+        }
+        .loading {
+            text-align: center;
+            padding: 20px;
+            color: #666;
+        }
+        .error {
+            text-align: center;
+            padding: 20px;
+            color: red;
+        }
+    </style>
+</head>
+<body>
+    <div class="header">
+        <h1>鏈哄櫒浜轰笂涓嬭鏃ュ織</h1>
+        <button id="logoutBtn">鐧诲嚭</button>
+    </div>
+    <div class="container">
+        <button class="refresh-btn" id="refreshBtn">鍒锋柊鏁版嵁</button>
+        <div id="loading" class="loading">鍔犺浇涓�...</div>
+        <div id="error" class="error" style="display: none;"></div>
+        <table id="logTable" style="display: none;">
+            <thead>
+                <tr>
+                    <th>鏃堕棿</th>
+                    <th>璁惧ID</th>
+                    <th>娑堟伅绫诲瀷</th>
+                    <th>娑堟伅鍐呭</th>
+                </tr>
+            </thead>
+            <tbody id="logTableBody">
+            </tbody>
+        </table>
+    </div>
+    <script>
+        // 妫�鏌ョ櫥褰曠姸鎬�
+        function checkLogin() {
+            if (!localStorage.getItem('loggedIn')) {
+                window.location.href = '/login';
+            }
+        }
+        
+        // 鐧诲嚭鍔熻兘
+        document.getElementById('logoutBtn').addEventListener('click', function() {
+            localStorage.removeItem('loggedIn');
+            window.location.href = '/login';
+        });
+        
+        // 鍔犺浇鏃ュ織鏁版嵁
+        function loadLogData() {
+            document.getElementById('loading').style.display = 'block';
+            document.getElementById('error').style.display = 'none';
+            document.getElementById('logTable').style.display = 'none';
+            
+            fetch('/deviceLog/query')
+                .then(response => response.json())
+                .then(data => {
+                    document.getElementById('loading').style.display = 'none';
+                    if (data && data.length > 0) {
+                        document.getElementById('logTable').style.display = 'table';
+                        const tbody = document.getElementById('logTableBody');
+                        tbody.innerHTML = '';
+                        
+                        data.forEach(item => {
+                            const row = document.createElement('tr');
+                            row.innerHTML = `
+                                <td>${item.time || '-'}</td>
+                                <td>${item.deviceId || '-'}</td>
+                                <td>${item.messageType || '-'}</td>
+                                <td>${item.messageContent || '-'}</td>
+                            `;
+                            tbody.appendChild(row);
+                        });
+                    } else {
+                        document.getElementById('error').textContent = '鏆傛棤鏃ュ織鏁版嵁';
+                        document.getElementById('error').style.display = 'block';
+                    }
+                })
+                .catch(error => {
+                    document.getElementById('loading').style.display = 'none';
+                    document.getElementById('error').textContent = '鍔犺浇鏁版嵁澶辫触: ' + error.message;
+                    document.getElementById('error').style.display = 'block';
+                });
+        }
+        
+        // 鍒锋柊鎸夐挳鐐瑰嚮浜嬩欢
+        document.getElementById('refreshBtn').addEventListener('click', loadLogData);
+        
+        // 椤甸潰鍔犺浇鏃舵鏌ョ櫥褰曠姸鎬佸苟鍔犺浇鏁版嵁
+        checkLogin();
+        loadLogData();
+    </script>
+</body>
+</html>
\ No newline at end of file

--
Gitblit v1.9.1