From 634cae1f3f243210b0059aae35a267c375c242a9 Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期四, 02 一月 2025 09:59:47 +0800
Subject: [PATCH] 首页登录默认上次登录成功的账号

---
 Source/plt-web/plt-web-ui/src/page/login/userlogin.vue |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/page/login/userlogin.vue b/Source/plt-web/plt-web-ui/src/page/login/userlogin.vue
index ccb8660..027bd01 100644
--- a/Source/plt-web/plt-web-ui/src/page/login/userlogin.vue
+++ b/Source/plt-web/plt-web-ui/src/page/login/userlogin.vue
@@ -120,7 +120,7 @@
         //瑙掕壊ID
         roleId: "",
         //鐢ㄦ埛鍚�
-        username: "admin",
+        username: "",
         //瀵嗙爜
         password: "",
         selectInput: '',
@@ -158,6 +158,7 @@
   },
   created() {
     // this.getTenant();
+    this.loginForm.username = this.userInfo.userId;
   },
   mounted() {
     //鍦╩ounted鑾峰彇棣栭〉涓嬫媺鑿滃崟鏁版嵁
@@ -212,6 +213,10 @@
       done();
     },
     handleLogin() {
+      if (!this.loginForm.username) {
+        this.$message.error('璇疯緭鍏ョ敤鎴峰悕');
+        return;
+      }
       if (!this.loginForm.password) {
         this.$message.error('璇疯緭鍏ュ瘑鐮�');
         return;
@@ -226,8 +231,26 @@
           });
           this.$store.dispatch("LoginByUsername", this.loginForm).then((data) => {
             if (data.obj.failCode !== 'loginSuccess') {
-              // console.log('data', data);
+              if (data.obj.failCode === 'passwordRemainDay') {
+                this.$message.warning(data.obj.passwordInfo);
+                this.$router.push({path: this.tagWel.value});
+                loading.close();
+                return;
+              }
+
+              if (data.obj.failCode === 'userIsLocked') {
+                this.$message.error(`鐧诲綍閿欒娆℃暟杩囧锛岃处鍙疯閿佸畾銆�${data.obj.failMsgArray[0]}銆戝垎閽焋);
+                loading.close();
+                return;
+              }
+
+              if (data.obj.failCode === 'userPwdNotEqual') {
+                this.$message.error('瀵嗙爜閿欒锛岃閲嶆柊杈撳叆锛�');
+                loading.close();
+                return;
+              }
               this.$message.error(data.msg);
+
               if (data.obj.mustChangePassword) {
                 this.passwordVisible = true;
               }
@@ -245,8 +268,8 @@
                 });
                 return false;
               }
-            }
-            ;
+            };
+
             this.$router.push({path: this.tagWel.value});
             loading.close();
           }).catch((err) => {
@@ -284,7 +307,7 @@
           this.passwordVisible = false;
           this.$refs.changeForm.resetFields();
           this.$store.dispatch("LoginByUsername", {...this.loginForm, password: form.confirmPassword}).then(data => {
-            if (data.obj.failCode !== 'loginSuccess') {
+            if (data.obj.failCode !== 'loginSuccess' && data.obj.failCode !== 'passwordRemainDay') {
               this.$message.error(data.msg);
             }
             this.$router.push({path: this.tagWel.value});

--
Gitblit v1.9.3