From e4a55083ff3a59a6393e95abafd3cdca86ac2cda Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期五, 28 八月 2026 11:39:25 +0800
Subject: [PATCH] docs: 交接更新——验证码跳过开关、目录导入加固、崩溃排查进展
---
traffic-audit-web/src/views/Login.vue | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/traffic-audit-web/src/views/Login.vue b/traffic-audit-web/src/views/Login.vue
index 42528ba..2227171 100644
--- a/traffic-audit-web/src/views/Login.vue
+++ b/traffic-audit-web/src/views/Login.vue
@@ -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,17 @@
captchaVerified: false,
captchaId: '',
clickIds: [],
- loggingIn: false
+ loggingIn: false,
+ captchaRequired: true
}
+ },
+ created() {
+ axios.get('/api/auth/captcha-config')
+ .then(res => {
+ const d = res.data
+ if (d && d.code === 200) this.captchaRequired = d.data.required !== false
+ })
+ .catch(() => {})
},
methods: {
onCaptchaVerified(payload) {
@@ -53,7 +65,7 @@
login() {
this.$refs.form.validate(valid => {
if (!valid) return
- if (!this.captchaVerified) {
+ if (this.captchaRequired && !this.captchaVerified) {
this.$message.warning('璇峰厛瀹屾垚琛屼负楠岃瘉')
return
}
@@ -69,17 +81,19 @@
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 || '')
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(() => {
this.loggingIn = false
@@ -92,6 +106,7 @@
</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-card .el-form-item { margin-bottom: 16px; }
--
Gitblit v1.9.1