From 04102f7237efefa744090ed7c25f7b5d0807b679 Mon Sep 17 00:00:00 2001
From: quanwei <419654421@qq.com>
Date: Thu, 05 Feb 2026 18:11:57 +0800
Subject: [PATCH] 完成运营中心提现和运营中心权限管理

---
 saas_vue/src/views/Login.vue |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/saas_vue/src/views/Login.vue b/saas_vue/src/views/Login.vue
index 699e546..488dbc6 100644
--- a/saas_vue/src/views/Login.vue
+++ b/saas_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-if="login_err_num >= 3">
         <div class="d-b-c">
           <div class="left-img-input" style="width: auto;">
             <el-input v-model="ruleForm2.verifycode" ref="verifycode" placeholder="验证码" class="l-input"
@@ -48,6 +48,7 @@
   import UserApi from '@/api/user.js';
   import {
     setCookie,
+    getCookie,
     setSessionStorage
   } from '@/utils/base.js';
   export default {
@@ -57,16 +58,18 @@
     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()
+        // 密码输错3次以上才出现验证码 by lyzflash
+        if (this.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: {},
@@ -94,11 +97,13 @@
             validator: validateVerifycode
           }]
         },
-        checked: true
+        checked: true,
+        login_err_num: 0, // 登录错误次数
       };
     },
     created() {
       this.refreshCode();
+      this.login_err_num = parseInt(getCookie('login_err_num') || 0);
     },
     mounted() {
       this.identifyCode = '';
@@ -138,11 +143,15 @@
                 this.logining = false;
                 setCookie('userinfo', res.data);
                 setCookie('isLogin',true);
+                setCookie('login_err_num', 0);
                 this.$router.push({
                   path: '/'
                 });
               })
               .catch(error => {
+                // 记录错误次数 by lyzflash
+                this.login_err_num += 1;
+                setCookie('login_err_num', this.login_err_num);
                 this.logining = false;
               });
           }

--
Gitblit v1.9.2