From b7f7f38d7ead0939d82a8a0fb301b30b72398acc Mon Sep 17 00:00:00 2001
From: WXL <1785969728@qq.com>
Date: 星期四, 07 八月 2025 09:54:22 +0800
Subject: [PATCH] 测试完成

---
 src/views/login.vue |   49 +++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 43 insertions(+), 6 deletions(-)

diff --git a/src/views/login.vue b/src/views/login.vue
index e8c178c..ca16496 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -136,7 +136,7 @@
         smsCode: "",
         rememberMe: false,
         code: "",
-        orgid: "1",
+        orgid: "47255004333112711A1001",
       },
       options: [
         { value: "1", label: "鏅畞鐣叉棌鑷不鍘夸汉姘戝尰闄�" },
@@ -145,7 +145,6 @@
       loginRules: {
         username: [
           { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" },
-          { validator: validatePhone, trigger: "blur", when: () => this.loginMethod === "sms" }
         ],
         password: [
           { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�", when: () => this.loginMethod === "password" },
@@ -181,8 +180,46 @@
   methods: {
     // 鍒囨崲鐧诲綍鏂瑰紡
     changeLoginMethod() {
-      this.$refs.loginForm.clearValidate();
-    },
+    this.$refs.loginForm.clearValidate();
+    // 鍔ㄦ�佹洿鏂伴獙璇佽鍒�
+    this.loginRules = {
+      username: [
+        { required: true, trigger: "blur", message: this.loginMethod === 'password' ? '璇疯緭鍏ユ偍鐨勮处鍙�' : '璇疯緭鍏ユ墜鏈哄彿' },
+        {
+          validator: (rule, value, callback) => {
+            if (this.loginMethod === 'sms' && !/^1[3-9]\d{9}$/.test(value)) {
+              callback(new Error("璇疯緭鍏ユ纭殑鎵嬫満鍙�"));
+            } else {
+              callback();
+            }
+          },
+          trigger: "blur"
+        }
+      ],
+      password: [
+        {
+          required: true,
+          trigger: "blur",
+          message: "璇疯緭鍏ユ偍鐨勫瘑鐮�",
+          when: () => this.loginMethod === "password"
+        },
+      ],
+      smsCode: [
+        {
+          required: true,
+          trigger: "blur",
+          message: "璇疯緭鍏ラ獙璇佺爜",
+          when: () => this.loginMethod === "sms"
+        },
+        {
+          pattern: /^\d{6}$/,
+          message: "楠岃瘉鐮佷负6浣嶆暟瀛�",
+          trigger: "blur",
+          when: () => this.loginMethod === "sms"
+        }
+      ],
+    };
+  },
 
     // 鍙戦�佺煭淇¢獙璇佺爜
     phoneCode() {
@@ -259,7 +296,7 @@
 
           const loginData = {
             username: this.loginForm.username,
-            orgid: "1",
+            orgid: "47255004333112711A1001",
             loginType: this.loginMethod
           };
 
@@ -274,7 +311,7 @@
           this.$store
             .dispatch("Login", loginData)
             .then(() => {
-              this.$router.push({ path: this.redirect || "/" }).catch(() => {});
+              this.$router.push({ path: this.redirect || "/followvisit/discharge" }).catch(() => {});
             })
             .catch(() => {
               this.loading = false;

--
Gitblit v1.9.3