Pārlūkot izejas kodu

pc端记住账号和密码的情况下增加页面加载完成判断账号输入错误次数的判断

hangb 7 gadi atpakaļ
vecāks
revīzija
f4ae25b632
2 mainītis faili ar 45 papildinājumiem un 1 dzēšanām
  1. 44 0
      components/login/Login.vue
  2. 1 1
      nuxt.config.js

+ 44 - 0
components/login/Login.vue

@@ -155,6 +155,9 @@
                     if (getPasswordErrorCount === 3) {
                       this.$message.error('当前已输错密码3次,若达到5次今日将无法登陆')
                     }
+                    if (getPasswordErrorCount === 4) {
+                      this.$message.error('当前已输错密码4次,若达到5次今日将无法登陆')
+                    }
                     this.isLoginDisabled = false
                     this.checkUsername = true
                     this.showCheckCode = true
@@ -222,6 +225,9 @@
           this.getCookie()
         }
       })
+      this.$nextTick(() => {
+        this.validUserName()
+      })
     },
     computed: {
       enterprise () {
@@ -234,6 +240,44 @@
       // }
     },
     methods: {
+      // 获取用户错误次数
+      validUserName () {
+        if (this.login.username) {
+          //    获取密码输错次数
+          this.$http.get(`/sso/login/getPwdErrorCount`, {params: {username: this.login.username}})
+            .then(response => {
+              if (response.data.success) {
+                let getPasswordErrorCount = response.data.content || ''
+                if (getPasswordErrorCount >= 5) {
+                  this.$message.error('密码错误次数已达上限,今日无法登陆')
+                  this.isLoginDisabled = true
+                  this.showCheckCode = false
+                } else if (getPasswordErrorCount < 3) {
+                  this.isLoginDisabled = false
+                  this.checkUsername = true
+                  this.showCheckCode = false
+                } else if (getPasswordErrorCount >= 3 && getPasswordErrorCount < 5) {
+                  if (getPasswordErrorCount === 3) {
+                    this.$message.error('当前已输错密码3次,若达到5次今日将无法登陆')
+                  }
+                  if (getPasswordErrorCount === 4) {
+                    this.$message.error('当前已输错密码4次,若达到5次今日将无法登陆')
+                  }
+                  this.isLoginDisabled = false
+                  this.checkUsername = true
+                  this.showCheckCode = true
+                } else {
+                  this.checkUsername = false
+                  this.showCheckCode = false
+                }
+              } else {
+                return Promise.reject(response.data)
+              }
+            }).catch(err => {
+              this.$message.error(err.errMsg)
+            })
+        }
+      },
       // 更换管理员
       changeManage () {
         window.location.href = `appeals/changeManagerAppeal${this.$store.state.option.fullPath}`

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'https://sso.ubtob.com/' : 'http://10.1.51.50:23232/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'https://sso.ubtob.com/' : 'http://10.1.51.50:8081/')
 
 module.exports = {
   router: {