SanHQin há 3 meses atrás
pai
commit
adc94e3486

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
dist/css/app.9fb67e7e.css


+ 1 - 1
dist/index.html

@@ -36,7 +36,7 @@
         width: 100%;
         background: #e6eaf0;
         font-family: '黑体';
-      }</style><script defer="defer" src="/js/chunk-vendors.1e67db9e.js"></script><script defer="defer" src="/js/app.63a20623.js"></script><link href="/css/chunk-vendors.7cfe4581.css" rel="stylesheet"><link href="/css/app.0a86804c.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but pblAdminTable doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html><script>function stopSafari() {
+      }</style><script defer="defer" src="/js/chunk-vendors.1e67db9e.js"></script><script defer="defer" src="/js/app.422176f8.js"></script><link href="/css/chunk-vendors.7cfe4581.css" rel="stylesheet"><link href="/css/app.9fb67e7e.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but pblAdminTable doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
dist/js/app.422176f8.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
dist/js/app.422176f8.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
dist/js/app.63a20623.js


Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
dist/js/app.63a20623.js.map


+ 132 - 110
src/views/login/loginPage.vue

@@ -140,7 +140,7 @@ import { mapActions } from "vuex";
 import axios from "axios";
 import qs from "qs";
 import { API_CONFIG } from "@/common/apiConfig";
-import '@/common/wxLogin';
+import "@/common/wxLogin";
 
 export default {
 	name: "loginPage",
@@ -160,26 +160,35 @@ export default {
 			showName: "",
 			oloading: false,
 			openid: "",
-			allowOrgList:[
-				{id:"3823a6a5-1b6e-11f0-a66a-005056924926",list:['3823a6a5-1b6e-11f0-a66a-005056924926','292e34dc-1b6e-11f0-a66a-005056924926','21d6b367-1b6e-11f0-a66a-005056924926','1a1a172d-1b6e-11f0-a66a-005056924926','1197f86b-1b6e-11f0-a66a-005056924926','f235659b-1b6d-11f0-a66a-005056924926','d87b62d3-1b6d-11f0-a66a-005056924926','c25ea59b-1b6d-11f0-a66a-005056924926']}
+			allowOrgList: [
+				{
+					id: "3823a6a5-1b6e-11f0-a66a-005056924926",
+					list: [
+						"3823a6a5-1b6e-11f0-a66a-005056924926",
+						"292e34dc-1b6e-11f0-a66a-005056924926",
+						"21d6b367-1b6e-11f0-a66a-005056924926",
+						"1a1a172d-1b6e-11f0-a66a-005056924926",
+						"1197f86b-1b6e-11f0-a66a-005056924926",
+						"f235659b-1b6d-11f0-a66a-005056924926",
+						"d87b62d3-1b6d-11f0-a66a-005056924926",
+						"c25ea59b-1b6d-11f0-a66a-005056924926",
+					],
+				},
 			],
 		};
 	},
 	watch: {
 		loginType(newValue) {
-			if(newValue != 'weChat'){
-				this.$refs.QRcode.innerHTML = ''
+			if (newValue != "weChat") {
+				this.$refs.QRcode.innerHTML = "";
 			}
-		}
+		},
 	},
 	methods: {
 		...mapActions({
 			login: "user/login",
 		}),
 		async loginFn() {
-
-			
-
 			if (this.loading) return;
 
 			if (this.account.length <= 0) {
@@ -192,10 +201,10 @@ export default {
 				return;
 			}
 
-			if(this.allowOrgList.find(i=>i.id == this.org2)){
-				let _list = this.allowOrgList.find(i=>i.id==this.org2).list;
-				let _nowOrgId = this.OrgOptions.find(i=>i.Uorg==this.org).id
-				if(!_list.includes(_nowOrgId)){
+			if (this.allowOrgList.find((i) => i.id == this.org2)) {
+				let _list = this.allowOrgList.find((i) => i.id == this.org2).list;
+				let _nowOrgId = this.OrgOptions.find((i) => i.Uorg == this.org).id;
+				if (!_list.includes(_nowOrgId)) {
 					return this.$message.error("该组织/学校不允许登录");
 				}
 			}
@@ -249,16 +258,18 @@ export default {
 					});
 			} else if (this.loginType == "bind") {
 				// this.$message.info("绑定账号");
-				let data = await this.$ajax.post(API_CONFIG.baseUrl2 + 'checkOpenId', [{email: email}])
-				if(!data.data[0].length){
+				let data = await this.$ajax.post(API_CONFIG.baseUrl2 + "checkOpenId", [
+					{ email: email },
+				]);
+				if (!data.data[0].length) {
 					this.$message.error("未查找到对应账号请重新输入");
-					return
+					return;
 				}
-				if(data.data[0][0].thirdpartyid){
+				if (data.data[0][0].thirdpartyid) {
 					this.$message.error("该账号已绑定微信登录请重新输入");
-					return
+					return;
 				}
-				
+
 				let params = {
 					geetest_challenge: "",
 					geetest_validate: "",
@@ -270,29 +281,31 @@ export default {
 				axios.defaults.withCredentials = true;
 				console.log("👇");
 				axios
-				.post("https://beta.api.cocorobo.cn/api/user", qs.stringify(params))
-				.then(async (res) => {
-					console.log("res", res);
-					let _data = res.data[0][0];
-					if (_data.active === 1) {
-						await this.$ajax.post(API_CONFIG.baseUrl2 + 'UpdateOpenId', [{userid: _data.userid, openid: this.openid}])
-						window.localStorage["identity"] = JSON.stringify(_data.identity);
-						this.$message.success("绑定成功");
-						await this.login();
-						this.$router.push({ path: this.redirect || "/" });
-					} else {
-						this.$message.error("绑定失败");
-					}
-					this.loading = false;
-				})
-				.catch((e) => {
-					if (e.response && e.response.data == "Wrong email or password") {
-						this.$message.error("账号或密码错误");
-					} else {
-						this.$message.error("绑定失败");
-					}
-					this.loading = false;
-				});
+					.post("https://beta.api.cocorobo.cn/api/user", qs.stringify(params))
+					.then(async (res) => {
+						console.log("res", res);
+						let _data = res.data[0][0];
+						if (_data.active === 1) {
+							await this.$ajax.post(API_CONFIG.baseUrl2 + "UpdateOpenId", [
+								{ userid: _data.userid, openid: this.openid },
+							]);
+							window.localStorage["identity"] = JSON.stringify(_data.identity);
+							this.$message.success("绑定成功");
+							await this.login();
+							this.$router.push({ path: this.redirect || "/" });
+						} else {
+							this.$message.error("绑定失败");
+						}
+						this.loading = false;
+					})
+					.catch((e) => {
+						if (e.response && e.response.data == "Wrong email or password") {
+							this.$message.error("账号或密码错误");
+						} else {
+							this.$message.error("绑定失败");
+						}
+						this.loading = false;
+					});
 			}
 		},
 		async getLoading() {
@@ -356,93 +369,102 @@ export default {
 					console.error("请求失败,错误信息:", err);
 				});
 		},
-		wechatLogin(){
-			this.loginType = 'weChat'
+		wechatLogin() {
+			this.loginType = "weChat";
 			setTimeout(() => {
 				const randomState = Math.random().toString(36).substring(2); // 生成随机状态
 				// eslint-disable-next-line no-undef
 				new WxLogin({
-					self_redirect:true,
-					id: "QRcode", 
-					appid: "wxe9d7fff3c659445f", 
-					scope: "snsapi_login", 
-					redirect_uri: encodeURIComponent("https://cocorobo.cn/weixin.html"),//https://liyuan.cocorobo.cn/#/wxTest
+					self_redirect: true,
+					id: "QRcode",
+					appid: "wxe9d7fff3c659445f",
+					scope: "snsapi_login",
+					redirect_uri: encodeURIComponent("https://cocorobo.cn/weixin.html"), //https://liyuan.cocorobo.cn/#/wxTest
 					state: randomState,
 					style: "black",
 					href: "data:text/css;base64,LmltcG93ZXJCb3gge2Rpc3BsYXk6IGZsZXg7fQouaW1wb3dlckJveCAucXJjb2RlIHt3aWR0aDogMjMycHg7IGhlaWdodDogMjMycHh9Ci5pbXBvd2VyQm94IC50aXRsZSB7ZGlzcGxheTogbm9uZTt9Ci5pbXBvd2VyQm94IC5pbmZvIHtkaXNwbGF5OiBub25lO30KLmxvZ2luUGFuZWx7d2lkdGg6MTAwJTtoZWlnaHQ6MTAwJTtkaXNwbGF5OmZsZXg7ZmxleC1kaXJlY3Rpb246Y29sdW1uO2FsaWduLWl0ZW1zOmNlbnRlcjtqdXN0aWZ5LWNvbnRlbnQ6Y2VudGVyO30KLnN0YXR1c19pY29uIHtkaXNwbGF5OiBub25lfQoud2ViX3FyY29kZV9wYW5lbF9hcmVhe2hlaWdodDoxMDAlO3dpZHRoOjEwMCU7ZGlzcGxheTpmbGV4O2FsaWduLWl0ZW1zOmNlbnRlcjtqdXN0aWZ5LWNvbnRlbnQ6Y2VudGVyO30K",
-					onReady: function(isReady){
+					onReady: function (isReady) {
 						console.log(isReady);
-					}
+					},
 				});
 				setTimeout(() => {
-					let iframe = this.$refs.QRcode.querySelector('iframe')
-					iframe.style.width = '100%'
-					iframe.style.height = '100%'
-					
+					let iframe = this.$refs.QRcode.querySelector("iframe");
+					iframe.style.width = "100%";
+					iframe.style.height = "100%";
 				}, 0);
-			},0);
+			}, 0);
 		},
 		async getOpenId(openid) {
-
 			// oiztX1dwR-W2mBJ5HcvaSEB8yKGY
 			axios.defaults.withCredentials = false;
 			let params = {
-				openid: openid
-			}
-			this.openid = openid
+				openid: openid,
+			};
+			this.openid = openid;
 			axios.defaults.withCredentials = true;
-			axios.post(`https://beta.api.cocorobo.cn/api/user`, qs.stringify(params)).then(async res => {
-				console.log("res", res);
-				let _data = res.data[0][0];
-				axios.defaults.withCredentials = false;
-				let userData = await this.$ajax.get("https://pbl.cocorobo.cn/api/pbl/selectUser/selectUser", { userid: _data.userid });
-				console.log("👈",userData)
-				let _uorg = userData.data[0][0].org;
-				if(this.allowOrgList.find(i=>i.id == this.org2)){
-				let _list = this.allowOrgList.find(i=>i.id==this.org2).list;
-				if(!_list.includes(_uorg)){
-					this.wechatLogin()
-					console.log("不允许登录")
-					return this.$message.error("该组织/学校不允许登录");
-				}
-			}
-				if (_data.active === 1) {
-					window.localStorage["identity"] = JSON.stringify(_data.identity);
-					this.$message.success("登录成功");
-					await this.login();
-					this.$router.push({ path: this.redirect || "/" });
-				} else {
-					this.$message.error("登录失败");
-				}
-				this.loading = false;
-			}).catch(err => {
-				console.log(err.response)
-				if (err && err.response && err.response.status === 401) {
-					this.loginType = 'bind';
-				}
-			})
-
-				// 
+			axios
+				.post(`https://beta.api.cocorobo.cn/api/user`, qs.stringify(params))
+				.then(async (res) => {
+					console.log("res", res);
+					let _data = res.data[0][0];
+					axios.defaults.withCredentials = false;
+					this.$ajax
+						.get("https://pbl.cocorobo.cn/api/pbl/selectUser/selectUser", {
+							userid: _data.userid,
+						})
+						.then(async (res2) => {
+							console.log("👈", res2);
+							let _uorg = res2.data[0][0].org;
+							if (this.allowOrgList.find((i) => i.id == this.org2)) {
+								let _list = this.allowOrgList.find(
+									(i) => i.id == this.org2
+								).list;
+								if (!_list.includes(_uorg)) {
+									this.wechatLogin();
+									console.log("不允许登录");
+									return this.$message.error("该组织/学校不允许登录");
+								}
+							}
+							if (_data.active === 1) {
+								window.localStorage["identity"] = JSON.stringify(
+									_data.identity
+								);
+								this.$message.success("登录成功");
+								await this.login();
+								this.$router.push({ path: this.redirect || "/" });
+							} else {
+								this.$message.error("登录失败");
+							}
+							this.loading = false;
+						});
+				})
+				.catch((err) => {
+					console.log(err.response);
+					if (err && err.response && err.response.status === 401) {
+						this.loginType = "bind";
+					}
+				});
 
+			//
 		},
 	},
 	mounted() {
-		let _this = this
-		window.addEventListener('message', function (e) { // 监听 message 事件
+		let _this = this;
+		window.addEventListener("message", function (e) {
+			// 监听 message 事件
+			console.log(e);
+			if (e.data && e.data.method == "getOpenId") {
 				console.log(e);
-				if(e.data && e.data.method == "getOpenId"){
-					console.log(e);
-					console.log(e.data.code);
-					console.log(_this.loginType);
-					
-					if(e.data.code == 200){
-						_this.getOpenId(e.data.data.openid)
-					}else {
-						_this.$message.error('扫码登录失败请重新扫码')
-						_this.wechatLogin()
-					}
+				console.log(e.data.code);
+				console.log(_this.loginType);
 
+				if (e.data.code == 200) {
+					_this.getOpenId(e.data.data.openid);
+				} else {
+					_this.$message.error("扫码登录失败请重新扫码");
+					_this.wechatLogin();
 				}
+			}
 		});
 		this.getLoading();
 		this.getOrdOidData();
@@ -602,11 +624,11 @@ export default {
 }
 
 .fa_weChat > .QRcode {
-    width: 100%;
-    height: 100%;
-    display: flex;
-    align-items: center;
-    justify-content: center;
+	width: 100%;
+	height: 100%;
+	display: flex;
+	align-items: center;
+	justify-content: center;
 	/* background-color: black; */
 }
 

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff