Explorar o código

修改地区判断与登录loading

11wqe1 hai 2 semanas
pai
achega
897fc89a62

+ 1 - 1
dist/index.html

@@ -1,4 +1,4 @@
-<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>pblAdminTable</title><style>@charset "utf-8";
+<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>cocorobo</title><style>@charset "utf-8";
       * {
         margin: 0;
         padding: 0;

+ 2 - 1
src/api/user.js

@@ -4,7 +4,8 @@ import { baseApi } from '@/config'
 
 // 用户信息 post 方法
 export function eduGet() {
-  return axios.get('//beta.api.cocorobo.cn/api/getcookieuserid')
+  let _result = this.$region == 'hk' ? 'https://cloud.api.cocorobo.hk/api/getcookieuserid' : '//beta.api.cocorobo.cn/api/getcookieuserid'
+  return axios.get(_result)
 }
 // 获取组织
 export function GetSuffix(data) {

+ 1 - 1
src/components/botPage.vue

@@ -152,7 +152,7 @@ import { mapGetters } from 'vuex';
                         functionName: API_CONFIG.ajax_morHotApp.functionName,
                         uid: this.roleUser.userid, 
                         type: this.tab[index].type,
-                        cn: this.roleUser.schoolArea ? this.roleUser.schoolArea : this.roleUser.orgArea, //学校id
+                        cn: this.$region, //学校id
                     },
                 ];
                 this.$ajax

+ 6 - 4
src/components/sidebarL.vue

@@ -101,7 +101,8 @@ import { myMixin } from "@/mixins/mixin.js"
                 return function(c) {
                     let k = JSON.parse(JSON.stringify(c))
                     let data = k.filter(e=>{
-                        return e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea
+                        // return e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea
+                        return e.region == this.$region
                     })
 
                     let data2 = k.filter(e=>{
@@ -230,8 +231,8 @@ import { myMixin } from "@/mixins/mixin.js"
 
                 // 查出对应账号的应用区域地址
                 val.url.forEach(e => {
-                    if (e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea) {
-                    // if (e.region == this.$region) {
+                    // if (e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea) {
+                    if (e.region == this.$region) {
                         url = e.url
                     }
                 });
@@ -323,7 +324,8 @@ import { myMixin } from "@/mixins/mixin.js"
                 
                 let url = ''
                 val.url.forEach(e => {
-                    if (e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea) {
+                    // if (e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea) {
+                    if (e.region == this.$region) {
                     // if (e.region == this.$region) {
                         url = e.url
                     }

+ 4 - 3
src/components/topPage.vue

@@ -238,7 +238,8 @@ import { myMixin } from "@/mixins/mixin.js"
                     
                     // 获取属于区域的url
                     let data = k.filter(e=>{
-                        return e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea
+                        // return e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea
+                        return e.region == this.$region
                     })
                     // console.log('data',data);
 
@@ -460,8 +461,8 @@ import { myMixin } from "@/mixins/mixin.js"
                 
                 let url = ''
                 val.url.forEach(e => {
-                    if (e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea) {
-                    // if (e.region == this.$region) {
+                    // if (e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea) {
+                    if (e.region == this.$region) {
                         url = e.url
                     }
                 });

+ 1 - 1
src/views/homepageL.vue

@@ -49,7 +49,7 @@ import { API_CONFIG } from "@/common/apiConfig";
                     {
                         functionName: API_CONFIG.ajax_allApp.functionName, // 调用存储过程的名称
                         uid: this.roleUser.userid, 
-                        cn: this.roleUser.schoolArea ? this.roleUser.schoolArea : this.roleUser.orgArea, 
+                        cn: this.$region, 
                     },
                 ];
                 

+ 1 - 3
src/views/kanBan/components/AschoolFeature.vue

@@ -1559,9 +1559,7 @@ export default {
 				{
 					functionName: API_CONFIG.ajax_usuallyApp.functionName,
 					uid: this.userinfo.userid,
-					cn: this.userinfo.schoolArea
-						? this.userinfo.schoolArea
-						: this.userinfo.orgArea, //学校id
+					cn: this.$region, //学校id
 				},
 			];
 

+ 26 - 13
src/views/login/loginPage.vue

@@ -400,6 +400,11 @@ export default {
 				_result.logo = _obj.logo;
 			}
 
+			return _result;
+		},
+		userRequest() {
+			let _result = this.$region == 'hk' ? 'https://cloud.api.cocorobo.hk/api/user' : 'https://beta.api.cocorobo.cn/api/user'
+
 			return _result;
 		},
 	},
@@ -477,23 +482,32 @@ export default {
 		},
 		async loginFn() {
 			if (this.loading) return;
+			this.loading = true;
+
 			// loginType == orgL为组织号登录
-			if (this.loginType == "orgL" && !this.org)
+			if (this.loginType == "orgL" && !this.org){
+				this.loading = false;
 				return this.$message.error(this.lang.enterorgnumber);
+			}
 
 			// if (this.loginType != 'orgL') {
-			if ((await this.getOrgData()) == 2) return (this.loginType = "orgL");
+			if ((await this.getOrgData()) == 2){
+				this.loading = false;
+				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;
 				return;
 			}
 
 			if (this.password.length < 6 || /[\u4e00-\u9fa5]/.test(this.password)) {
 				this.$message.error(this.lang.passwordlength);
+				this.loading = false;
 				return;
 			}
 
@@ -505,6 +519,7 @@ export default {
 					this.OrgOptions.find((i) => i.Uorg == this.org) &&
 					!_list.includes(this.OrgOptions.find((i) => i.Uorg == this.org).id)
 				) {
+					this.loading = false;
 					return this.$message.error(this.lang.Accountcannot);
 				}
 			} else {
@@ -518,9 +533,11 @@ export default {
 							this.OrgOptions.find((i) => i.Uorg == this.org).id
 						)
 					) {
+						this.loading = false;
 						return this.$message.error(this.lang.Accountcannot);
 					}
 				} else {
+					this.loading = false;
 					return this.$message.error(this.lang.accountnotcreated);
 				}
 			}
@@ -539,6 +556,7 @@ export default {
 					this.$message.error(this.lang.accountmustOrg);
 					this.loginType = "orgL";
 				}
+				this.loading = false;
 				return;
 			}
 
@@ -559,12 +577,11 @@ export default {
 					loginUsername: email.trim(),
 					loginPassword: window.btoa(this.password.trim()),
 				};
-				this.loading = true;
 				axios.defaults.withCredentials = true;
 				console.log("👇", this.prefixL);
 				// this.addOp3('1', "", { type:this.prefixL + "login" }, "success",'0c3735c9-a2ef-11ef-9b30-005056b86db5')
 				axios
-					.post("https://beta.api.cocorobo.cn/api/user", qs.stringify(params))
+					.post(this.userRequest, qs.stringify(params))
 					.then(async (res) => {
 						console.log("res", res);
 						let _data = res.data[0][0];
@@ -622,10 +639,12 @@ export default {
 				]);
 				if (!data.data[0].length) {
 					this.$message.error(this.lang.Nocoracc);
+					this.loading = false;
 					return;
 				}
 				if (data.data[0][0].thirdpartyid) {
 					this.$message.error(this.lang.hasbeenlinked);
+					this.loading = false;
 					return;
 				}
 
@@ -640,7 +659,7 @@ export default {
 				axios.defaults.withCredentials = true;
 				console.log("👇进入进行微信绑定环节");
 				axios
-					.post("https://beta.api.cocorobo.cn/api/user", qs.stringify(params))
+					.post(this.userRequest, qs.stringify(params))
 					.then(async (res) => {
 						console.log("res", res);
 						let _data = res.data[0][0];
@@ -843,7 +862,7 @@ export default {
 			this.openid = openid;
 			axios.defaults.withCredentials = true;
 			axios
-				.post(`https://beta.api.cocorobo.cn/api/user`, qs.stringify(params))
+				.post(this.userRequest, qs.stringify(params))
 				.then(async (res) => {
 					console.log("res", res);
 					let _data = res.data[0][0];
@@ -976,7 +995,6 @@ export default {
 			this.$ajax
 				.post(API_CONFIG.baseUrl, params)
 				.then((res) => {
-					// this.loading = false;
 					if (res.data.length && res.data[0].length) {
 						this.res = res.data[0][0];
 						this.courseId = res.data[0][0].courseId;
@@ -991,11 +1009,6 @@ export default {
 		},
 		// 根据随机码获取学生
 		getClass(classId) {
-			// let params = {
-			//     cid: classId,
-			// };
-			// this.ajax
-			//     .get(this.$store.state.api + "selectSnameByCid", params)
 			let params = [
 				{
 					functionName: API_CONFIG.ajax_selectSnameByCid.functionName, // 调用存储过程的名称
@@ -1048,7 +1061,7 @@ export default {
 				};
 				axios.defaults.withCredentials = true;
 				axios
-					.post("https://beta.api.cocorobo.cn/api/user", qs.stringify(params))
+					.post(this.userRequest, qs.stringify(params))
 					.then(async (res) => {
 							console.log("res", res);
 							this.loading = false;