|
@@ -191,8 +191,18 @@ export default {
|
|
this.newVersionAvailable = true;
|
|
this.newVersionAvailable = true;
|
|
}
|
|
}
|
|
}, 1000);
|
|
}, 1000);
|
|
|
|
+ if (this.isEPCC) {
|
|
|
|
+ this.login();
|
|
|
|
+ }
|
|
},
|
|
},
|
|
async created() {
|
|
async created() {
|
|
|
|
+ if (this.isEPCC) {
|
|
|
|
+ this.$Spin.show({
|
|
|
|
+ render: () => {
|
|
|
|
+ return <div style="font-size: 44px">正在登录...</div>;
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
localStorage.setItem("redirectUrl", this.$route.query.redirectUrl);
|
|
localStorage.setItem("redirectUrl", this.$route.query.redirectUrl);
|
|
|
|
|
|
this.isElectron = typeof nodeRequire != "undefined";
|
|
this.isElectron = typeof nodeRequire != "undefined";
|
|
@@ -265,21 +275,29 @@ export default {
|
|
this.loginTimeout = setTimeout(() => {
|
|
this.loginTimeout = setTimeout(() => {
|
|
this.loginBtnLoading = false;
|
|
this.loginBtnLoading = false;
|
|
}, 10 * 1000);
|
|
}, 10 * 1000);
|
|
- // https://www.cnblogs.com/weiqinl/p/6708993.html
|
|
|
|
- const valid = await this.$refs.loginForm.validate();
|
|
|
|
- if (!valid) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+ let loginResponse;
|
|
|
|
+ if (!this.isEPCC) {
|
|
|
|
+ // https://www.cnblogs.com/weiqinl/p/6708993.html
|
|
|
|
+ const valid = await this.$refs.loginForm.validate();
|
|
|
|
+ if (!valid) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
- let repPara = this.loginForm;
|
|
|
|
- // 以下网络请求失败,直接报网络异常错误
|
|
|
|
- const response = await this.$http.post("/api/ecs_core/auth/login", {
|
|
|
|
- ...repPara,
|
|
|
|
- accountType: this.loginType,
|
|
|
|
- domain: this.schoolDomain,
|
|
|
|
- alwaysOK: true,
|
|
|
|
- });
|
|
|
|
- let data = response.data;
|
|
|
|
|
|
+ let repPara = this.loginForm;
|
|
|
|
+ // 以下网络请求失败,直接报网络异常错误
|
|
|
|
+ loginResponse = await this.$http.post("/api/ecs_core/auth/login", {
|
|
|
|
+ ...repPara,
|
|
|
|
+ accountType: this.loginType,
|
|
|
|
+ domain: this.schoolDomain,
|
|
|
|
+ alwaysOK: true,
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ loginResponse = await this.epccLogin();
|
|
|
|
+ if (!loginResponse) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let data = loginResponse.data;
|
|
// if (
|
|
// if (
|
|
// Math.abs() >
|
|
// Math.abs() >
|
|
// 5 * 60 * 1000
|
|
// 5 * 60 * 1000
|
|
@@ -292,7 +310,9 @@ export default {
|
|
// throw "与服务器时间差异超过5分钟,请校准本机时间之后再重试!";
|
|
// throw "与服务器时间差异超过5分钟,请校准本机时间之后再重试!";
|
|
// }
|
|
// }
|
|
|
|
|
|
- this.updateTimeDifference(moment(response.headers.date).diff(moment()));
|
|
|
|
|
|
+ this.updateTimeDifference(
|
|
|
|
+ moment(loginResponse.headers.date).diff(moment())
|
|
|
|
+ );
|
|
if (data.code == "200") {
|
|
if (data.code == "200") {
|
|
data = data.content;
|
|
data = data.content;
|
|
this.errorInfo = "";
|
|
this.errorInfo = "";
|
|
@@ -556,6 +576,59 @@ export default {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ async epccLogin() {
|
|
|
|
+ const {
|
|
|
|
+ accountType,
|
|
|
|
+ accountValue,
|
|
|
|
+ rootOrgId,
|
|
|
|
+ appId,
|
|
|
|
+ timestamp,
|
|
|
|
+ token,
|
|
|
|
+ redirectUrl,
|
|
|
|
+ } = this.$route.query;
|
|
|
|
+
|
|
|
|
+ if (
|
|
|
|
+ accountType &&
|
|
|
|
+ accountValue &&
|
|
|
|
+ rootOrgId &&
|
|
|
|
+ appId &&
|
|
|
|
+ timestamp &&
|
|
|
|
+ token &&
|
|
|
|
+ redirectUrl
|
|
|
|
+ ) {
|
|
|
|
+ try {
|
|
|
|
+ const response = await this.$http.post(
|
|
|
|
+ "/api/ecs_core/auth/thirdPartyStudentAccess",
|
|
|
|
+ {
|
|
|
|
+ accountType,
|
|
|
|
+ accountValue,
|
|
|
|
+ rootOrgId,
|
|
|
|
+ appId,
|
|
|
|
+ timestamp,
|
|
|
|
+ token,
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ return response;
|
|
|
|
+ } catch (error) {
|
|
|
|
+ window._hmt.push(["_trackEvent", "第三方登录页面", "接口出错", ""]);
|
|
|
|
+ this.$Modal.error({
|
|
|
|
+ title: "返回",
|
|
|
|
+ content: "第三方登录访问错误",
|
|
|
|
+ onOk: () => {
|
|
|
|
+ history.back();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ this.$Modal.error({
|
|
|
|
+ title: "返回",
|
|
|
|
+ content: "第三方登录参数错误",
|
|
|
|
+ onOk: () => {
|
|
|
|
+ history.back();
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
logoPath() {
|
|
logoPath() {
|
|
@@ -581,6 +654,9 @@ export default {
|
|
}
|
|
}
|
|
return domain;
|
|
return domain;
|
|
},
|
|
},
|
|
|
|
+ isEPCC() {
|
|
|
|
+ return this.schoolDomain === "iepcc-ps.qmth.com.cn";
|
|
|
|
+ },
|
|
usernameInputPlaceholder() {
|
|
usernameInputPlaceholder() {
|
|
if (this.loginType === "STUDENT_CODE") {
|
|
if (this.loginType === "STUDENT_CODE") {
|
|
return "请输入学号";
|
|
return "请输入学号";
|