11wqe1 před 2 týdny
rodič
revize
87863a7ee1
1 změnil soubory, kde provedl 17 přidání a 9 odebrání
  1. 17 9
      src/views/login/loginPage.vue

+ 17 - 9
src/views/login/loginPage.vue

@@ -481,13 +481,17 @@ export default {
 		},
 		async loginFn() {
 			if (this.loading) return;
-			this.loading = true;
 
 			// loginType == orgL为组织号登录
-			if (this.loginType == "orgL" && !this.org){
+			let str = this.account.replace(/(^\s*)|(\s*$)/g, "");
+			const regEmail = new RegExp(
+				"^[A-Za-z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"
+			);
+			if (this.loginType == "orgL" && !this.org && !regEmail.test(str)){
 				this.loading = false;
 				return this.$message.error(this.lang.enterorgnumber);
 			}
+			this.loading = true;
 
 			// if (this.loginType != 'orgL') {
 			if ((await this.getOrgData()) == 2){
@@ -495,9 +499,7 @@ export default {
 				return (this.loginType = "orgL");
 			} 
 			// }
-			const regEmail = new RegExp(
-				"^[A-Za-z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"
-			);
+			
 			if (this.account.length <= 0) {
 				this.$message.error(this.lang.enteraccount);
 				this.loading = false;
@@ -526,7 +528,7 @@ export default {
 				let mergedList = this.allowOrgList.reduce((acc, curr) => {
 					return [...acc, ...curr.list];
 				}, []);
-				let str = this.account.replace(/(^\s*)|(\s*$)/g, "");
+				// let str = this.account.replace(/(^\s*)|(\s*$)/g, "");
 				console.log('regEmail.test(str)',!regEmail.test(str),this.org);
 				
 				if (this.OrgOptions.find((i) => i.Uorg == this.org)) {
@@ -558,7 +560,7 @@ export default {
 				}
 			}
 
-			let str = this.account.replace(/(^\s*)|(\s*$)/g, "");
+			// let str = this.account.replace(/(^\s*)|(\s*$)/g, "");
 			if (!this.org && !regEmail.test(str)) {
 				// this.$message.error(
 				// 	"请在账号后添加组织后缀(账号@组织号.com 如:123456@cocorobo.com)"
@@ -772,10 +774,13 @@ export default {
 						// }
 
 						this.OrgOptions = getList;
-						if (this.OrgOptions.length == 0)
+						if (this.OrgOptions.length == 0){
+							this.loading = false
 							return this.$message.error(
 								this.lang.Accnotfound
 							);
+						}
+							
 						if (this.loginType == "orgL") return resolve(1);
 
 						if (this.OrgOptions.length == 1) {
@@ -792,6 +797,7 @@ export default {
 									)[0].Uorg;
 								} catch (error) {
 									console.log(error);
+									this.loading = false
 									return this.$message.error(
 										this.lang.Accountcannot
 									);
@@ -806,10 +812,12 @@ export default {
 								if (
 									this.OrgOptions.filter((i) => !mergedList.includes(i.id))
 										.length == 1
-								)
+								){
+									this.loading = false
 									return this.$message.error(
 										this.lang.Accountcannot
 									);
+								}
 								this.$message.error(this.lang.accountmustOrg);
 								this.loginType = "orgL";
 								return resolve(2);