From 77e2b70d3d769f45657257de89a979cf465e29e6 Mon Sep 17 00:00:00 2001
From: zjk <852185829@qq.com>
Date: 星期五, 17 七月 2026 13:57:12 +0800
Subject: [PATCH] feat(admin): 完善访客管理后台功能,对接后端接口

---
 components/admin/AdminConfigPanel.vue |   47 +++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/components/admin/AdminConfigPanel.vue b/components/admin/AdminConfigPanel.vue
index 1219896..52df5f4 100644
--- a/components/admin/AdminConfigPanel.vue
+++ b/components/admin/AdminConfigPanel.vue
@@ -49,17 +49,23 @@
         <view class="version-row">
           <image :src="versionIcon" class="inline-icon" mode="aspectFit"></image>
           <text class="version-label">当前版本号:</text>
-          <text class="version-value">v2.1.0</text>
+          <text class="version-value">{{ currentVersion }}</text>
         </view>
 
-        <view class="update-banner">
+        <view class="update-banner" v-if="hasNewVersion">
           <view class="update-copy">
             <image :src="updateHintIcon" class="inline-icon" mode="aspectFit"></image>
-            <text class="update-text">检测到新版本 v2.2.0 可用</text>
+            <text class="update-text">检测到新版本 {{ latestVersion }} 可用</text>
           </view>
           <view class="update-btn">
             <image :src="updateBtnIcon" class="banner-btn-icon" mode="aspectFit"></image>
             <text class="update-btn-text">立即更新</text>
+          </view>
+        </view>
+        <view class="update-banner" v-else>
+          <view class="update-copy">
+            <image :src="updateHintIcon" class="inline-icon" mode="aspectFit" style="opacity: 0.5;"></image>
+            <text class="update-text" style="color: #6D7F9B;">当前已是最新版本</text>
           </view>
         </view>
       </view>
@@ -100,7 +106,6 @@
       </view>
     </view>
 
-    <teleport to="body">
       <view class="overlay-mask" v-if="showMoreActions || showLogoutDialog" @click="closeOverlays"></view>
 
       <view class="more-dialog" v-if="showMoreActions">
@@ -138,7 +143,6 @@
           </view>
         </view>
       </view>
-    </teleport>
   </view>
 </template>
 
@@ -159,6 +163,7 @@
 import closeIcon from '../../static/admin-pages/pDMhJ.png';
 import logoutIcon from '../../static/admin-pages/uZNeV.png';
 import { deactivateVisitMachine } from '../../api/device';
+import { getLatestVersion } from '../../api/visitorRecord';
 import { clearRequestServerConfig, getRequestServerConfig, setRequestServerConfig } from '../../utils/request';
 
 const VISITOR_MACHINE_IP_KEY = 'visitor_machine_ip';
@@ -167,6 +172,10 @@
 const showMoreActions = ref(false);
 const showLogoutDialog = ref(false);
 const isLoggingOut = ref(false);
+
+const currentVersion = ref('v2.1.0');
+const latestVersion = ref('');
+const hasNewVersion = ref(false);
 
 const normalizeIpValue = (value = '') => {
   return String(value).trim().replace(/^https?:\/\//, '');
@@ -383,8 +392,30 @@
   }
 };
 
+const checkLatestVersion = async () => {
+  try {
+    const res = await getLatestVersion();
+    if (res && res.code === 200 && res.data) {
+      // 假设后端返回的数据为版本号字符串或者包含 version 字段的对象
+      const versionStr = typeof res.data === 'object' ? (res.data.version || res.data.versionName || '') : res.data;
+      if (versionStr) {
+        latestVersion.value = versionStr;
+        // 简单比对:如果获取到的版本和当前不一致,则认为是新版本(实际业务中可换成语义化版本对比库)
+        if (latestVersion.value !== currentVersion.value) {
+          hasNewVersion.value = true;
+        } else {
+          hasNewVersion.value = false;
+        }
+      }
+    }
+  } catch (error) {
+    console.error('获取最新版本失败:', error);
+  }
+};
+
 onMounted(() => {
   loadNetworkConfig();
+  checkLatestVersion();
 });
 
 defineExpose({
@@ -642,7 +673,7 @@
   position: fixed;
   inset: 0;
   background: rgba(31, 42, 68, 0.6);
-  z-index: 1000;
+  z-index: 9999;
 }
 
 .more-dialog {
@@ -658,7 +689,7 @@
   flex-direction: column;
   gap: 26px;
   box-shadow: 0 18px 40px rgba(11, 23, 48, 0.12);
-  z-index: 1001;
+  z-index: 10000;
 }
 
 .dialog-head {
@@ -746,7 +777,7 @@
   flex-direction: column;
   gap: 44px;
   box-shadow: 0 18px 40px rgba(11, 23, 48, 0.12);
-  z-index: 1002;
+  z-index: 10001;
 }
 
 .logout-copy {

--
Gitblit v1.7.1