11wqe1 1 tydzień temu
rodzic
commit
4ad6341370
1 zmienionych plików z 59 dodań i 51 usunięć
  1. 59 51
      src/views/login/loginPage.vue

+ 59 - 51
src/views/login/loginPage.vue

@@ -74,6 +74,7 @@
 							<div class="fa_i_item">
 								<span>{{ lang.account }}</span>
 								<div>
+									<!-- @change="getOrgData" -->
 									<input
 										type="text"
 										:placeholder="lang.enteraccount"
@@ -469,6 +470,16 @@ export default {
 				this.orginfo = [];
 				this.org = "";
 			}
+			// let res = await getliyuanCode({ mode: this.SuffixData });
+			// console.log("res.data", res.data);
+
+			// if (res.data[0].length && this.SuffixData) {
+			// 	this.orginfo = res.data[0];
+			// 	this.org = this.orginfo[0].mail;
+			// } else {
+			// 	this.orginfo = [];
+			// 	this.org = "";
+			// }
 		},
 		async loginFn() {
 			if (this.loading) return;
@@ -485,15 +496,10 @@ export default {
 			this.loading = true;
 
 			// if (this.loginType != 'orgL') {
-			// 返回2说明要使用组织号登录 3荔园多账户
-			let ku = (await this.getOrgData()) == 2
-			if (ku == 2){
+			if ((await this.getOrgData()) == 2){
 				this.loading = false;
 				return (this.loginType = "orgL");
-			} else if(ku == 3){
-				this.loading = false;
-				return 
-			}
+			} 
 			// }
 			
 			if (this.account.length <= 0) {
@@ -742,8 +748,7 @@ export default {
 			return new Promise((resolve) => {
 				let params = [
 					{
-						
-						functionName: API_CONFIG.ajax_liYuanAcc.functionName,
+						functionName: API_CONFIG.ajax_liYuanOrg.functionName,
 						uname: this.account,
 					},
 				];
@@ -751,66 +756,70 @@ export default {
 					.post(API_CONFIG.baseUrl, params)
 					.then((res) => {
 						console.log("res", res);
-						// 组织号登陆时不清空,非组织号登陆时清空
+						// 组织号登陆时不清空
 						if (this.loginType != "orgL") {
 							this.org = "";
 						}
 						this.OrgOptions = [];
 
-						this.OrgOptions = res.data[0];
-						// 返回0时说明没有账户,提示为未创建账号
-						if (this.OrgOptions.num == 0){
+						let getList = res.data[0];
+
+						// if (this.allowOrgList.findIndex((i) => i.area) != -1) {
+						// 	let _index = this.allowOrgList.findIndex((i) => i.area);
+						// 	let _list = this.allowOrgList[_index].list;
+						// 	getList = getList.filter((i) => _list.includes(i.id));
+						// } else {
+						// 	let mergedList = this.allowOrgList.reduce((acc, curr) => {
+						// 		return [...acc, ...curr.list];
+						// 	}, []);
+						// 	getList = getList.filter((i) => !mergedList.includes(i.id));
+						// }
+
+						this.OrgOptions = getList;
+						if (this.OrgOptions.length == 0){
 							this.loading = false
 							return this.$message.error(
 								this.lang.Accnotfound
 							);
 						}
-						// 组织号登录时返回 1,就说明在使用组织号登录了,不用再赋值组织号了
+							
 						if (this.loginType == "orgL") return resolve(1);
 
-						if (this.OrgOptions.num == 1) {
+						if (this.OrgOptions.length == 1) {
 							this.org = this.OrgOptions[0].Uorg;
-						} else if (this.OrgOptions.num > 0) {
+						} else if (this.OrgOptions.length > 0) {
 							// liyuan走这里
 							if (this.allowOrgList.findIndex((i) => i.area) != -1) {
-
-								// // console.log('1111');
-								// try {
-								// 	let _index = this.allowOrgList.findIndex((i) => i.area);
-								// 	let _list = this.allowOrgList[_index].list;
-								// 	// 使用荔园网址登录,进行账号筛选,看是否属于荔园,不属于荔园账号提示换网站
-								// 	this.org = this.OrgOptions.filter((i) =>
-								// 		_list.includes(i.id)
-								// 	)[0].Uorg;
-								// } catch (error) {
-								// 	console.log(error);
-									// this.loading = false
-								// 	return this.$message.error(
-								// 		this.lang.Accountcannot
-								// 	);
-								// }
-								this.$message.error(this.lang.liyuanAccMore);
-								// return resolve(2);
+								// console.log('1111');
+								try {
+									let _index = this.allowOrgList.findIndex((i) => i.area);
+									let _list = this.allowOrgList[_index].list;
+									this.org = this.OrgOptions.filter((i) =>
+										_list.includes(i.id)
+									)[0].Uorg;
+								} catch (error) {
+									console.log(error);
+									this.loading = false
+									return this.$message.error(
+										this.lang.Accountcannot
+									);
+								}
 							} else {
 								// admin走这里
 
-								// let mergedList = this.allowOrgList.reduce((acc, curr) => {
-								// 	return [...acc, ...curr.list];
-								// }, []);
-								// console.log('admin走这里',mergedList);
-								
+								let mergedList = this.allowOrgList.reduce((acc, curr) => {
+									return [...acc, ...curr.list];
+								}, []);
 
-								// // 如果mergedList包含账号中的id说明他是荔园的账户需要使用荔园网址登录
-								// if (
-								// 	this.OrgOptions.filter((i) => !mergedList.includes(i.id))
-								// 		.length == 1
-								// ){
+								if (
+									this.OrgOptions.filter((i) => !mergedList.includes(i.id))
+										.length == 1
+								){
 									this.loading = false
-								// 	return this.$message.error(
-								// 		this.lang.Accountcannot
-								// 	);
-								// }
-								// // 提示该账户要使用组织号登录
+									return this.$message.error(
+										this.lang.Accountcannot
+									);
+								}
 								this.$message.error(this.lang.accountmustOrg);
 								this.loginType = "orgL";
 								return resolve(2);
@@ -907,8 +916,7 @@ export default {
 					// }
 
 					if (this.allowOrgList.findIndex((i) => i.area) != -1) {
-						// 查找数组中满足条件的第一个元素的索引 0
-						let _index = this.allowOrgList.findIndex((i) => i.area);				
+						let _index = this.allowOrgList.findIndex((i) => i.area);
 						let _list = this.allowOrgList[_index].list;
 						if (
 							this.OrgOptions.find((i) => i.Uorg == this.org) &&