11wqe1 il y a 1 mois
Parent
commit
a077328c33
1 fichiers modifiés avec 71 ajouts et 23 suppressions
  1. 71 23
      src/views/login/loginPage.vue

+ 71 - 23
src/views/login/loginPage.vue

@@ -124,9 +124,9 @@
 									</div>
 								</div>
 
-								<div class="fa_i_item" v-if="loginType == 'default' || loginType == 'bind'">
+								<div class="fa_i_item" v-if="loginType == 'default' || loginType == 'bind'" >
 									<span>{{ lang.organization }}</span>
-									<div>
+									<div v-loading="inpGetAccOrgNameloading">
 										<input
 											v-if="accOrgName.length == 0"
 											disabled
@@ -138,7 +138,7 @@
 											disabled
 											type="text"
 											:placeholder="lang.Identifyaccount"
-											v-model="accOrgName[0].name"
+											:value="accOrgName[0].ou"
 										/>
 										<el-select
 											v-else
@@ -148,7 +148,7 @@
 											<el-option
 												v-for="item in accOrgName"
 												:key="item.Uorg"
-												:label="item.schoolName"
+												:label="item.ou"
 												:value="item.Uorg"
 											>
 											</el-option>
@@ -234,7 +234,7 @@
 							class="lp_r_b_btn"
 							v-if="['code'].includes(loginType)"
 							@click="nextSteps"
-							v-loading="loading"
+							v-loading="nextStepsLoading"
 						>
 							{{ lang.confirm }}
 						</div>
@@ -359,7 +359,7 @@
 					</template>
 
 				</template>
-				<div class="stuPage" v-if="steps == 2">
+				<div class="stuPage" v-if="steps == 2" v-loading="nextStepsLoading">
 					<div>{{ lang.choosename }}</div>
 					<div style="max-height: 400px;display: flex;gap: 10px;">
 						<div class="nameList">
@@ -403,7 +403,7 @@ import "@/common/wxLogin";
 import { getUser, loginOut, GetSuffix } from "@/api/user";
 import { myMixin } from "@/mixins/mixin.js";
 import pinyin from 'pinyin';
-
+import _ from 'lodash';
 
 export default {
 	mixins: [myMixin],
@@ -412,10 +412,12 @@ export default {
 		return {
 			// 0选择页 1教师 2学生
 			logIdentity:0,
+			nextStepsLoading:false,
 			// 判断显示组织号区域
 			SuffixShow: false,
 			// 组织号查询区域结果
 			SuffixData: "",
+			inpGetAccOrgNameloading:false,
 			// 获取随机码班级名称
 			codeClassName:'',
 			orginfo: [],
@@ -886,30 +888,69 @@ export default {
 				this.$router.push({ path: this.redirect || "/" });
 			}
 		},
-		inpGetAccOrgName(){
+		// async inpGetAccOrgName(){
+		inpGetAccOrgName: _.debounce(async function() {
+			if (!this.account) {
+				this.accOrgName = []
+			}
+			this.inpGetAccOrgNameloading = true
 			let params = [
 				{
 					functionName: API_CONFIG.ajax_liYuanOrg.functionName,
 					uname: this.account,
 				},
 			];
-			this.$ajax
-				.post(API_CONFIG.baseUrl, params)
-				.then((res) => {
-					console.log("res", res.data[0]);
-					this.accOrgName = []
-					if (res.data[0].length == 1) {
-						this.org = res.data[0][0].Uorg
-					}else if (res.data[0].length == 0) {
-						this.org = ''
-					}
-					this.accOrgName = [...res.data[0]]
-				})
-				.catch((err) => {
-					console.log(err);
+			try {
+				const res = await this.$ajax.post(API_CONFIG.baseUrl, params);
+
+				console.log("res", res.data[0]);
+				this.accOrgName = []
+
+				let data = res.data[0]
+
+				if (data.length > 0) {
+					data.forEach(e=>{
+						e.ou = (e.name ? e.name + '—' : '') +  e.schoolName
+					})
+				}
+				this.$nextTick(() => {
+					this.accOrgName = data
+					this.org = data.length === 1 ? data[0].Uorg : '';
 				});
-		},
 
+				this.inpGetAccOrgNameloading = false
+			} catch (error) {
+				this.inpGetAccOrgNameloading = false
+			}
+			
+
+
+			// this.$ajax
+			// 	.post(API_CONFIG.baseUrl, params)
+			// 	.then((res) => {
+			// 		console.log("res", res.data[0]);
+			// 		this.accOrgName = []
+
+			// 		if (res.data[0].length == 1) {
+			// 			this.org = res.data[0][0].Uorg
+			// 		}else if (res.data[0].length == 0) {
+			// 			this.org = ''
+			// 		}
+			// 		let data = res.data[0]
+			// 		data.forEach(e=>{
+			// 			e.ou = (e.name ? e.name + '-' : '') +  e.schoolName
+			// 		})
+
+			// 		this.accOrgName = data
+			// 		this.inpGetAccOrgNameloading = false
+
+			// 	})
+			// 	.catch((err) => {
+			// 		this.inpGetAccOrgNameloading = false
+
+			// 		console.log(err);
+			// 	});
+		}, 300),
 		// 输入账号获取组织
 		getOrgData() {
 			return new Promise((resolve) => {
@@ -1188,9 +1229,12 @@ export default {
 				);
 				return;
 			}
+			this.nextStepsLoading = true
 			let reg = /^\d+$/;
 			if (!reg.test(this.icode)) {
 				this.$message.error(this.lang.codecorrectly);
+				this.nextStepsLoading = false
+
 				return;
 			}
 
@@ -1213,8 +1257,12 @@ export default {
 					} else {
 						this.$message.error(this.lang.codenotexist);
 					}
+					this.nextStepsLoading = false
+
 				})
 				.catch((err) => {
+					this.nextStepsLoading = false
+
 					console.error(err);
 				});
 		},