Bläddra i källkod

修改获取组织接口,修改微信登录不正确网址提示

11wqe1 3 veckor sedan
förälder
incheckning
882dac10b7
2 ändrade filer med 53 tillägg och 18 borttagningar
  1. 5 0
      src/api/user.js
  2. 48 18
      src/views/login/loginPage.vue

+ 5 - 0
src/api/user.js

@@ -10,6 +10,11 @@ export function eduGet() {
 export function GetSuffix(data) {
   return axios.post('https://api.edu.cocorobo.cn/edu/admin/selectorganize', [data])
 }
+
+export function getliyuanCode(data) {
+  return axios.post(`${baseApi}getliyuanCode`, [data])
+}
+
 export function eduLogout() {
   return axios.post('//beta.api.cocorobo.cn/api/logout')
 }

+ 48 - 18
src/views/login/loginPage.vue

@@ -144,7 +144,6 @@
 							<div class="fa_i_item">
 								<span>随机码</span>
 								<div>
-									<!-- @change="getOrgData" -->
 									<input
 										type="text"
 										placeholder="请输入"
@@ -302,9 +301,7 @@ import axios from "axios";
 import qs from "qs";
 import { API_CONFIG } from "@/common/apiConfig";
 import "@/common/wxLogin";
-import { getUser } from "@/api/user";
-import { loginOut } from "@/api/user";
-import { GetSuffix } from "@/api/user";
+import { getUser, loginOut } from "@/api/user";
 import { myMixin } from "@/mixins/mixin.js";
 
 export default {
@@ -407,16 +404,45 @@ export default {
 		}),
 		// 获取组织后缀
 		async getSuffix() {
-			let res = await GetSuffix({ mode: this.SuffixData });
-			console.log("res.data[0]", res.data[0]);
 
-			if (res.data[0].length && this.SuffixData) {
-				this.orginfo = res.data[0];
-				this.org = this.orginfo[0].mail;
-			} else {
-				this.orginfo = [];
-				this.org = "";
-			}
+			return new Promise((resolve, reject) => {
+				
+				let params = [
+					{
+						functionName: API_CONFIG.ajax_getliyuanCode.functionName,
+						mode: this.SuffixData
+					},
+				];
+				this.$ajax
+					.post(API_CONFIG.baseUrl, params)
+					.then((res) => {
+						let data = [...res.data[0], ...res.data[1]]
+						console.log('data',data);
+						if (data.length) {
+							this.orginfo = data;
+							this.org = this.orginfo[0].mail;
+						} else {
+							this.orginfo = [];
+							this.org = "";
+						}
+						resolve(1)
+					})
+					.catch((e) => {
+						console.log(e);
+						reject(e)
+					})
+			})
+
+			// 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;
@@ -443,7 +469,6 @@ export default {
 			// 荔园平台登录账号进行判断
 			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) &&
@@ -452,7 +477,6 @@ export default {
 					return this.$message.error("账号不可登录,请使用您的专属网址");
 				}
 			} else {
-				// console.log('this.org',this.org);
 
 				let mergedList = this.allowOrgList.reduce((acc, curr) => {
 					return [...acc, ...curr.list];
@@ -831,9 +855,10 @@ export default {
 							)
 						) {
 							this.wechatLogin();
+							this.$message.error("账号不可登录,请使用您的专属网址");
 							await loginOut();
 							await this.logout();
-							return this.$message.error("账号不可登陆,请联系管理员。");
+							return
 						}
 					} else {
 						let mergedList = this.allowOrgList.reduce((acc, curr) => {
@@ -845,9 +870,10 @@ export default {
 							)
 						) {
 							this.wechatLogin();
+							this.$message.error("账号不可登录,请使用您的专属网址");
 							await loginOut();
 							await this.logout();
-							return this.$message.error("账号不可登陆,请联系管理员。");
+							return 
 						}
 					}
 					let userjson = await getUser({ userid: _data.userid });
@@ -890,7 +916,7 @@ export default {
 					this.loading = false;
 				})
 				.catch((err) => {
-					console.log(err.response);
+					console.log('错误信息',err.response);
 					if (err && err.response && err.response.status === 401) {
 						this.loginType = "bind";
 					}
@@ -906,6 +932,10 @@ export default {
 		},
 		// 随机码登录
 		nextSteps() {
+			if (!this.SuffixData) {
+				this.$message.error(this.prefixL == 'liyuan_' ? "请选择校区" : '请输入随机码');
+				return;
+			}
 			let reg = /^\d+$/;
 			if (!reg.test(this.icode)) {
 				this.$message.error("请正确填写随机码");