|
@@ -11,7 +11,9 @@ import {
|
|
|
} from "@/constants/constants";
|
|
|
import { useTimers } from "@/setups/useTimers";
|
|
|
import { store } from "@/store/store";
|
|
|
-import { createUserDetailLog } from "@/utils/logger";
|
|
|
+import { createEncryptLog, createUserDetailLog } from "@/utils/logger";
|
|
|
+import { getScreenShot, isElectron } from "@/utils/nativeMethods";
|
|
|
+import ua from "@/utils/ua";
|
|
|
import { CloseCircleOutline, LockClosed, Person } from "@vicons/ionicons5";
|
|
|
import { FormItemInst, FormRules } from "naive-ui";
|
|
|
import { onMounted, watch } from "vue";
|
|
@@ -28,13 +30,45 @@ import { useNewVersion } from "./useNewVersion";
|
|
|
import { useRemoteAppChecker } from "./useRemoteAppChecker";
|
|
|
import { useVCamChecker } from "./useVCamChecker";
|
|
|
|
|
|
+const { addTimeout, addInterval } = useTimers();
|
|
|
+
|
|
|
+//#region 登录日志处理
|
|
|
logger({
|
|
|
cnl: ["console", "local", "server"],
|
|
|
pgn: "登录页面",
|
|
|
act: "首次渲染",
|
|
|
});
|
|
|
|
|
|
+if (isElectron()) {
|
|
|
+ logger({
|
|
|
+ cnl: ["server"],
|
|
|
+ pgn: "登录页面",
|
|
|
+ act: "versonstats",
|
|
|
+ ext: {
|
|
|
+ packageVersion: "ua-" + ua.getBrowser().version,
|
|
|
+ file: eval(`process.env.PORTABLE_EXECUTABLE_FILE`),
|
|
|
+ uaGood:
|
|
|
+ "uagood-" + (eval(`process.env.PORTABLE_EXECUTABLE_FILE`) ? 1 : 0),
|
|
|
+ },
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// @ts-expect-error rtt不应该存在chrome 61以下,此处是陷阱代码
|
|
|
+if (navigator.connection && navigator.connection.rtt) {
|
|
|
+ logger({
|
|
|
+ cnl: ["local", "server"],
|
|
|
+ pgn: "登录页面",
|
|
|
+ // 故意用特殊的空格字符
|
|
|
+ act: "page created",
|
|
|
+ ext: { UA: navigator.userAgent },
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 上传本机加密日志
|
|
|
+addInterval(createEncryptLog, 5 * 1000);
|
|
|
+
|
|
|
useExamShellStats();
|
|
|
+//#endregion
|
|
|
|
|
|
//#region cache faceapi json
|
|
|
{
|
|
@@ -58,8 +92,6 @@ useExamShellStats();
|
|
|
}
|
|
|
//#endregion
|
|
|
|
|
|
-const { addTimeout } = useTimers();
|
|
|
-
|
|
|
let isGeeTestEnabled = $ref(false);
|
|
|
onMounted(async () => {
|
|
|
const conf = await getElectronConfig();
|
|
@@ -102,6 +134,9 @@ let disableLoginBtn = $computed(
|
|
|
|
|
|
//#region form校验
|
|
|
const domain = DOMAIN;
|
|
|
+if (!domain?.includes(".ecs.qmth.com.cn")) {
|
|
|
+ $message.warning("学校域名不正确", { closable: false, duration: 360000 });
|
|
|
+}
|
|
|
type FormModel = {
|
|
|
accountType: "STUDENT_CODE" | "IDENTITY_NUMBER";
|
|
|
accountValue: string;
|
|
@@ -133,6 +168,13 @@ const fromRules: FormRules = {
|
|
|
|
|
|
let errorInfo = $ref("");
|
|
|
watch([formValue], () => (errorInfo = ""));
|
|
|
+watch(
|
|
|
+ () => formValue.accountType,
|
|
|
+ () => {
|
|
|
+ formValue.accountValue = localStorage.getItem(formValue.accountType) || "";
|
|
|
+ },
|
|
|
+ { immediate: true }
|
|
|
+);
|
|
|
//#endregion
|
|
|
|
|
|
//#region 极验
|
|
@@ -158,8 +200,8 @@ watch(
|
|
|
);
|
|
|
//#endregion
|
|
|
|
|
|
+//#region 登录处理
|
|
|
const router = useRouter();
|
|
|
-
|
|
|
let loginBtnLoading = $ref(false);
|
|
|
let disableLoginBtnBecauseNotTimeout = $ref(false);
|
|
|
async function loginForuser() {
|
|
@@ -215,6 +257,18 @@ async function loginForuser() {
|
|
|
geeParams
|
|
|
);
|
|
|
|
|
|
+ logger({
|
|
|
+ cnl: ["server"],
|
|
|
+ pgu: "AUTO",
|
|
|
+ act: "login api success",
|
|
|
+ ext: {
|
|
|
+ accountType: formValue.accountType,
|
|
|
+ accountValue: formValue.accountValue,
|
|
|
+ domain,
|
|
|
+ ...geeParams,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
if (res.data.code === "200") {
|
|
|
errorInfo = "";
|
|
|
// 准备下面的登录token
|
|
@@ -240,6 +294,8 @@ async function loginForuser() {
|
|
|
|
|
|
/** 登录成功后,取学生信息和跳转 */
|
|
|
async function afterLogin(loginRes: any) {
|
|
|
+ // 存储登录成功的用户名
|
|
|
+ localStorage.setItem(formValue.accountType, formValue.accountValue);
|
|
|
try {
|
|
|
const [{ data: student }, { data: specialty }] = await Promise.all([
|
|
|
getStudentInfoBySessionApi(),
|
|
@@ -255,6 +311,19 @@ async function afterLogin(loginRes: any) {
|
|
|
store.user = user;
|
|
|
createUserDetailLog();
|
|
|
|
|
|
+ getScreenShot({ cause: "ss-login" }).catch((e) => {
|
|
|
+ logger({
|
|
|
+ pgu: "AUTO",
|
|
|
+ cnl: ["server"],
|
|
|
+ dtl: "桌面抓拍失败-electron问题",
|
|
|
+ ejn: JSON.stringify(e),
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ let userIds: number[] = JSON.parse(localStorage.getItem("userIds") || "[]");
|
|
|
+ userIds = [...new Set(userIds).add(store.user.id)];
|
|
|
+ localStorage.setItem("userIds", JSON.stringify(userIds));
|
|
|
+
|
|
|
// 有断点或者异常,停止后续处理
|
|
|
if (await checkExamInProgress().catch(() => true)) return;
|
|
|
|
|
@@ -271,6 +340,7 @@ async function afterLogin(loginRes: any) {
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+//#endregion
|
|
|
|
|
|
function closeApp() {
|
|
|
logger({
|