浏览代码

修改登录

11wqe1 1 天之前
父节点
当前提交
94c2ea6f28
共有 1 个文件被更改,包括 42 次插入22 次删除
  1. 42 22
      src/views/login/loginPage.vue

+ 42 - 22
src/views/login/loginPage.vue

@@ -26,7 +26,7 @@
 								<input
 									type="text"
 									placeholder="请输入组织号"
-									v-model="SuffixData"
+									v-model.trim="SuffixData"
 									@input="getSuffix"
 								/>
 							</div>
@@ -41,7 +41,7 @@
 								<input
 									type="text"
 									placeholder="请输入账号"
-									v-model="account"
+									v-model.trim="account"
 									
 									@keyup.enter="loginFn"
 								/>
@@ -123,7 +123,7 @@
 				<div class="lp_r_b_iconBtn">
 
 					<div
-						@click="loginType = 'orgL'"
+						@click="loginType = 'orgL',org = ''"
 						v-if="['default', 'weChat','orgL'].includes(loginType) && (allowOrgList.findIndex((i) => i.area) == -1)"
 					>
 						<el-tooltip effect="dark" content="组织号登录" placement="bottom">
@@ -266,9 +266,12 @@ export default {
 		},
 		async loginFn() {
 			if (this.loading) return;
-			if (this.loginType != 'orgL') {	
-				if (await this.getOrgData() == 2) return this.loginType = 'orgL'
-			}
+			// loginType == orgL为组织号登录
+			if (this.loginType == 'orgL' && !this.org) return this.$message.error("请输入组织号");
+
+			// if (this.loginType != 'orgL') {	
+			if (await this.getOrgData() == 2) return this.loginType = 'orgL'
+			// }		
 			const regEmail = new RegExp(
 				"^[A-Za-z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"
 			);
@@ -282,8 +285,10 @@ export default {
 				return;
 			}
 
+			// 荔园平台登录账号进行判断
 			if (this.allowOrgList.findIndex((i) => i.area) != -1) {
 				let _index = this.allowOrgList.findIndex((i) => i.area);
+				console.log('kkkkkkkkkkk');
 				let _list = this.allowOrgList[_index].list;
 				if (this.OrgOptions.find((i) => i.Uorg == this.org) && !_list.includes(this.OrgOptions.find((i) => i.Uorg == this.org).id)
 				) {
@@ -291,7 +296,7 @@ export default {
 				}
 			} else {
 				console.log('this.org',this.org);
-				
+
 				let mergedList = this.allowOrgList.reduce((acc, curr) => {
 					return [...acc, ...curr.list];
 				}, []);
@@ -313,10 +318,17 @@ export default {
 				// this.$message.error(
 				// 	"请在账号后添加组织后缀(账号@组织号.com 如:123456@cocorobo.com)"
 				// );
-				this.$message.error(
-					"该账号须使用“组织号登陆”"
-				);
-				this.loginType = 'orgL'
+
+				if (this.allowOrgList.findIndex((i) => i.area) != -1){
+					this.$message.error(
+						"请在账号后添加组织后缀(账号@组织号.com 如:123456@cocorobo.com)"
+					);
+				}else{
+					this.$message.error(
+						"该账号须使用“组织号登陆”"
+					);
+					this.loginType = 'orgL'
+				}
 				return
 			}
 
@@ -465,7 +477,10 @@ export default {
 					.post(API_CONFIG.baseUrl, params)
 					.then((res) => {
 						console.log("res", res);
-						this.org = "";
+						// 组织号登陆时不清空
+						if (this.loginType != 'orgL'){
+							this.org = "";
+						}
 						this.OrgOptions = [];
 
 						let getList = res.data[0];
@@ -482,6 +497,9 @@ export default {
 						// }
 
 						this.OrgOptions = getList;
+						if (this.OrgOptions.length == 0) return this.$message.error("未查询到账号,请检查是否填写错误或还未创建账号");
+						if (this.loginType == 'orgL') return resolve(1);
+						
 						if (this.OrgOptions.length == 1) {
 							this.org = this.OrgOptions[0].Uorg;
 						} else if (this.OrgOptions.length > 0) {
@@ -498,18 +516,20 @@ export default {
 									return this.$message.error("账号不可登录,请使用您的专属网址");
 								}
 							}else{
-							// 	// admin走这里
+								// admin走这里
 								console.log('2222');
+
+								let mergedList = this.allowOrgList.reduce((acc, curr) => {
+									return [...acc, ...curr.list];
+								}, []);
+								console.log('mergedList',mergedList);
+								console.log('mergedList2',this.OrgOptions.filter(i=>!mergedList.includes(i.id)).length);
+								
+								if(this.OrgOptions.filter(i=>!mergedList.includes(i.id)).length==1) return this.$message.error("账号不可登录,请使用您的专属网址");
 								this.$message.error("该账号须使用“组织号登陆”");
+								this.loginType = 'orgL'
 								return resolve(2);
 
-							// 	let mergedList = this.allowOrgList.reduce((acc, curr) => {
-							// 	return [...acc, ...curr.list];
-							// 	}, []);
-							// 	if(this.OrgOptions.filter(i=>!mergedList.includes(i.id)).length==1){
-							// 		this.org = this.OrgOptions.filter(i=>!mergedList.includes(i.id))[0].Uorg;
-							// 	}
-
 							// }
 							// if (this.OrgOptions.map((i) => i.Uorg).includes("@cocorobo.cc")) {
 							// 	this.org = "@cocorobo.cc";
@@ -922,7 +942,7 @@ export default {
 	display: flex;
 	gap: 10px;
 }
-.backWin{
+/* .backWin{ */
 	/* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); */
-}
+/* }  */
 </style>