From 54e10aee11aa4a10926df02782ca07d41eeb9b98 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期二, 06 十月 2026 16:19:07 +0800
Subject: [PATCH] fix(holiday): 加大折线图纵向间距并同步 Word 尺寸

---
 traffic-audit-web/src/views/Login.vue |   52 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/traffic-audit-web/src/views/Login.vue b/traffic-audit-web/src/views/Login.vue
index 5dda4c7..c08362c 100644
--- a/traffic-audit-web/src/views/Login.vue
+++ b/traffic-audit-web/src/views/Login.vue
@@ -1,7 +1,7 @@
 <template>
   <div class="login-container">
     <el-card class="login-card">
-      <h2>浜ら�氱粺璁℃姤琛ㄥ鏍哥郴缁�</h2>
+      <h2>浜ら�氱粺璁℃姤琛ㄥ鏍哥郴缁�<span class="login-version" v-if="version">V{{ version }}</span></h2>
       <el-form ref="form" :model="form" :rules="rules">
         <el-form-item prop="username">
           <el-input v-model="form.username" placeholder="鐢ㄦ埛鍚�" @keyup.enter.native="login"></el-input>
@@ -9,8 +9,11 @@
         <el-form-item prop="password">
           <el-input v-model="form.password" type="password" placeholder="瀵嗙爜" @keyup.enter.native="login"></el-input>
         </el-form-item>
-        <el-form-item>
+        <el-form-item v-if="captchaRequired">
           <captcha3-d ref="captcha" @verified="onCaptchaVerified" @reset="onCaptchaReset"></captcha3-d>
+        </el-form-item>
+        <el-form-item v-else>
+          <div class="captcha-skip-tip">娴嬭瘯妯″紡锛氳涓洪獙璇佺爜宸茶烦杩囷紝鍙洿鎺ョ偣鍑荤櫥褰曪紙姝e紡鍙戝竷鍚庡皢鍚敤锛�</div>
         </el-form-item>
         <el-form-item>
           <el-button type="primary" :loading="loggingIn" @click="login" style="width:100%">鐧� 褰�</el-button>
@@ -36,8 +39,28 @@
       captchaVerified: false,
       captchaId: '',
       clickIds: [],
-      loggingIn: false
+      loggingIn: false,
+      captchaRequired: false,
+      version: ''
     }
+  },
+  created() {
+    axios.get('/api/version', { timeout: 10000 })
+      .then(res => {
+        const d = res.data
+        if (d && d.data && d.data.version) this.version = d.data.version
+      })
+      .catch(() => {})
+    // 楠岃瘉鐮佹槸鍚﹀惎鐢ㄤ竴寰嬩互鍚庣 /api/auth/captcha-config 涓哄噯锛�
+    // 榛樿涓嶆樉绀猴紝鍙湁鍚庣鏄庣‘杩斿洖 required=true 鎵嶆覆鏌撻獙璇佺爜缁勪欢銆�
+    // 淇锛氭鍓嶉粯璁� true 涓旇姹傚け璐ユ椂闈欓粯蹇界暐锛屽垏鎹㈢綉缁滃悗璇ラ厤缃涓嶅埌锛�
+    // 鐧诲綍椤靛氨浼氭畫鐣欎竴涓姞杞戒笉鍑烘潵鐨勯獙璇佺爜鐧芥骞舵彁绀衡�滈獙璇佺爜鍔犺浇澶辫触锛岃妫�鏌ョ綉缁溾�濄��
+    axios.get('/api/auth/captcha-config', { timeout: 10000 })
+      .then(res => {
+        const d = res.data
+        this.captchaRequired = !!(d && d.code === 200 && d.data && d.data.required === true)
+      })
+      .catch(() => { this.captchaRequired = false })
   },
   methods: {
     onCaptchaVerified(payload) {
@@ -53,7 +76,7 @@
     login() {
       this.$refs.form.validate(valid => {
         if (!valid) return
-        if (!this.captchaVerified) {
+        if (this.captchaRequired && !this.captchaVerified) {
           this.$message.warning('璇峰厛瀹屾垚琛屼负楠岃瘉')
           return
         }
@@ -63,28 +86,29 @@
           password: this.form.password,
           captchaId: this.captchaId,
           captchaClickIds: this.clickIds
-        }).then(res => {
+        }, { timeout: 15000 }).then(res => {
           this.loggingIn = false
           const d = res.data
           if (d.code === 200) {
-            localStorage.setItem('token', d.data.token)
-            localStorage.setItem('username', d.data.username)
-            localStorage.setItem('realName', d.data.realName || '')
-            localStorage.setItem('modules', d.data.modules || '')
+            sessionStorage.setItem('token', d.data.token)
+            sessionStorage.setItem('username', d.data.username)
+            sessionStorage.setItem('realName', d.data.realName || '')
+            sessionStorage.setItem('modules', d.data.modules || '')
             this.$message.success('鐧诲綍鎴愬姛')
             this.$router.push('/dashboard')
           } else if (d.code === 401) {
             this.$message.error(d.message || '鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒')
-            this.$refs.captcha.load()
+            if (this.$refs.captcha) this.$refs.captcha.load()
           } else if (d.code === 4001 || d.code === 4002 || d.code === 4003) {
             this.$message.error(d.message || '楠岃瘉鏈�氳繃锛岃閲嶆柊楠岃瘉')
-            this.$refs.captcha.load()
+            if (this.$refs.captcha) this.$refs.captcha.load()
           } else {
             this.$message.error(d.message || '鐧诲綍澶辫触锛岃閲嶈瘯')
-            this.$refs.captcha.load()
+            if (this.$refs.captcha) this.$refs.captcha.load()
           }
-        }).catch(() => {
+        }).catch(e => {
           this.loggingIn = false
+          if (e && e.code === 'ECONNABORTED') { this.$message.error('鐧诲綍璇锋眰瓒呮椂锛岃閲嶈瘯'); return }
           this.$message.error('缃戠粶閿欒锛岀櫥褰曞け璐�')
         })
       })
@@ -94,7 +118,9 @@
 </script>
 <style scoped>
 .login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 20px 0; box-sizing: border-box; background: #f0f2f5; }
+.captcha-skip-tip { font-size: 12px; color: #909399; line-height: 1.6; padding: 8px 10px; background: #F5F7FA; border-radius: 4px; }
 .login-card { width: 400px; }
 .login-card h2 { text-align: center; margin-bottom: 18px; }
+.login-version { font-size: 13px; font-weight: normal; color: #909399; margin-left: 8px; vertical-align: 3px; }
 .login-card .el-form-item { margin-bottom: 16px; }
 </style>

--
Gitblit v1.9.1