From 7a27a1d4d0038abe2115adb1753f897f56d66323 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Fri, 31 Oct 2025 11:52:58 +0800
Subject: [PATCH] 访客列表
---
shop_vue/src/views/login.vue | 29 ++++++++++++++++++-----------
1 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/shop_vue/src/views/login.vue b/shop_vue/src/views/login.vue
index fbc84a5..089d640 100644
--- a/shop_vue/src/views/login.vue
+++ b/shop_vue/src/views/login.vue
@@ -20,7 +20,7 @@
</el-input>
</div>
</el-form-item>
- <el-form-item prop="verifycode" style="line-height:0px;">
+ <el-form-item prop="verifycode" style="line-height:0px;" v-show="shop_login_err_num >= 3">
<div class="d-b-c">
<div class="left-img-input" style="width: auto;">
<el-input v-model="ruleForm.verifycode" ref="verifycode" placeholder="验证码" class="l-input"
@@ -46,6 +46,7 @@
import UserApi from '@/api/user.js';
import {
setCookie,
+ getCookie,
setSessionStorage
} from '@/utils/base.js';
export default {
@@ -55,16 +56,19 @@
data() {
// 验证码自定义验证规则
const validateVerifycode = (rule, value, callback) => {
- if (value === "") {
- this.refreshCode();
- callback(new Error('请输入验证码'))
- } else if (value !== this.identifyCode) {
- console.log('验证码:', value);
- this.refreshCode();
- callback(new Error('验证码不正确!'))
- } else {
- callback()
+ this.shop_login_err_num = parseInt(getCookie('shop_login_err_num')) || 0;
+ // 错误次数过多时校验验证码 by lyzflash
+ if (this.shop_login_err_num >= 3) {
+ if (value === "") {
+ this.refreshCode();
+ callback(new Error('请输入验证码'))
+ } else if (value !== this.identifyCode) {
+ // console.log('验证码:', value);
+ this.refreshCode();
+ callback(new Error('验证码不正确!'))
+ }
}
+ callback();
}
return {
loginForm: {},
@@ -106,10 +110,12 @@
}]
},
/*基础配置*/
- baseData: {}
+ baseData: {},
+ shop_login_err_num: 0, // 登录错误次数
};
},
created() {
+ this.shop_login_err_num = parseInt(getCookie('shop_login_err_num')) || 0;
this.refreshCode();
this.getData();
if (this.$route.query.from && this.$route.query.from == 'admin') {
@@ -178,6 +184,7 @@
setCookie('userinfo', res.data);
/*设置一个登录状态*/
setCookie('isLogin', true);
+ setCookie('shop_login_err_num', 0); // 登录成功后将登录错误次数清0 by lyzflash
/*跳转到首页*/
this.$router.push({
path: '/'
--
Gitblit v1.9.2