Эх сурвалжийг харах

fix: 禁用学号登录之后,登录时账号密码错误的问题修复

chenhao 2 жил өмнө
parent
commit
0e3d42ed73

+ 1 - 0
.gitignore

@@ -11,6 +11,7 @@ node_modules
 dist
 dist-ssr
 *.local
+*.code-snippets
 
 # Editor directories and files
 .vscode/*

+ 2 - 0
.npmrc

@@ -0,0 +1,2 @@
+ELECTRON_MIRROR = https://npmmirror.com/mirrors/electron/
+enable-pre-post-scripts = true

+ 1 - 0
src/features/OfflineExam/OfflineExamList.vue

@@ -83,6 +83,7 @@ function toViewPaper(course: OfflineExam) {
     isOnlineExam: true,
   };
   window.name = JSON.stringify(user);
+  /** 此地址为后台管理系统中的页面, 后台管理系统与学生端页面同域*/
   window.location.href = `/admin/preview_paper/${course.paperId}?isback=true`;
 }
 

+ 7 - 1
src/features/OnlineExam/Examing/setups/useInitExamData.ts

@@ -17,6 +17,7 @@ export async function initExamData(examId: number, examRecordDataId: number) {
     { data: examQuestionListOrig },
     { data: _courseName },
   ] = await Promise.all([
+    // 是否开放微信小程序作答
     httpApp.get<boolean>(
       "/api/ecs_exam_work/exam/weixinAnswerEnabled/" + examId,
       {
@@ -24,15 +25,17 @@ export async function initExamData(examId: number, examRecordDataId: number) {
         noErrorMessage: true,
       }
     ),
+    // 是否支持人脸识别
     httpApp.get<boolean>("/api/ecs_exam_work/exam/faceCheckEnabled/" + examId, {
       "axios-retry": { retries: 4 },
       noErrorMessage: true,
     }),
+    // 是否支持活体检测
     httpApp.get<boolean>(
       "/api/ecs_exam_work/exam/identificationOfLivingEnabled/" + examId,
       { "axios-retry": { retries: 4 }, noErrorMessage: true }
     ),
-    // 实际上后台都是字符串 {PRACTICE_TYPE: string | null; FREEZE_TIME: string; SNAPSHOT_INTERVAL: string;  }
+    // 查询考生的考试批次属性集; 实际上后台都是字符串 {PRACTICE_TYPE: string | null; FREEZE_TIME: string; SNAPSHOT_INTERVAL: string;  }
     httpApp.get<{
       PRACTICE_TYPE: string | null;
       FREEZE_TIME: number | null;
@@ -43,15 +46,18 @@ export async function initExamData(examId: number, examRecordDataId: number) {
         `/SNAPSHOT_INTERVAL,PRACTICE_TYPE,FREEZE_TIME`,
       { "axios-retry": { retries: 4 }, noErrorMessage: true }
     ),
+    // 按ID查询考试批次信息
     httpApp.get<Store["exam"]>("/api/ecs_exam_work/exam/" + examId, {
       "axios-retry": { retries: 4 },
       noErrorMessage: true,
     }),
+    // 获取考试记录试卷结构
     httpApp.get<PaperStruct>(
       "/api/ecs_oe_student/examRecordPaperStruct/getExamRecordPaperStruct?examRecordDataId=" +
         examRecordDataId,
       { "axios-retry": { retries: 4 }, noErrorMessage: true }
     ),
+    // 获取试题列表
     httpApp.get<ExamQuestion[]>(
       "/api/ecs_oe_student/examQuestion/findExamQuestionList",
       { "axios-retry": { retries: 4 }, noErrorMessage: true }

+ 15 - 1
src/features/UserLogin/UserLogin.vue

@@ -10,7 +10,7 @@ import {
   VITE_GIT_REPO_VERSION,
 } from "@/constants/constants";
 import { useTimers } from "@/setups/useTimers";
-import { store } from "@/store/store";
+import { resetStore, store } from "@/store/store";
 import { createEncryptLog, createUserDetailLog } from "@/utils/logger";
 import { MD5 } from "@/utils/md5";
 import { getScreenShot, isElectron } from "@/utils/nativeMethods";
@@ -34,6 +34,8 @@ import { useVCamChecker } from "./useVCamChecker";
 
 const { addTimeout, addInterval } = useTimers();
 
+resetStore();
+
 //#region 登录日志处理
 // @ts-expect-error
 // eslint-disable-next-line no-undef
@@ -179,6 +181,18 @@ const fromRules: FormRules = {
 };
 
 let errorInfo = $ref("");
+watch(
+  () => allowLoginType,
+  (v) => {
+    let defaultAccountType = formValue.accountType || "STUDENT_CODE";
+    const allowStudentCode = v.includes("STUDENT_CODE");
+    const allowIdentityNumber = v.includes("IDENTITY_NUMBER");
+    if (!allowStudentCode && allowIdentityNumber) {
+      defaultAccountType = "STUDENT_IDENTITY_NUMBER";
+    }
+    formValue.accountType = defaultAccountType;
+  }
+);
 watch([formValue], () => (errorInfo = ""));
 watch(
   () => formValue.accountType,

+ 1 - 1
src/features/UserLogin/useAppVersion.ts

@@ -9,7 +9,7 @@ export function useAppVersion(newVersionAvailable: Ref<boolean>) {
   const portableFile = window.proceess?.env?.PORTABLE_EXECUTABLE_FILE;
 
   function checkApp() {
-    if (isElectron() && !portableFile) {
+    if (isElectron() && !portableFile && !import.meta.env.DEV) {
       // FIXME: 在苹果电脑跳过检测
       if (navigator.userAgent.includes("Macintosh")) {
         return;

+ 1 - 2
src/router/index.ts

@@ -14,7 +14,7 @@ import OfflineExam from "@/features/OfflineExam/OfflineExam.vue";
 import OnlinePractice from "@/features/OnlinePractice/OnlinePractice.vue";
 import OnlinePracticeRecord from "@/features/OnlinePractice/OnlinePracticeRecord.vue";
 import OnlinePracticeRecordDetail from "@/features/OnlinePractice/OnlinePracticeRecordDetail.vue";
-import { resetStore, store } from "@/store/store";
+import { store } from "@/store/store";
 
 const routes: RouteRecordRaw[] = [
   { path: "/", redirect: "/login" },
@@ -120,7 +120,6 @@ router.beforeEach((to, from, next) => {
   }
 
   if (to.name === "UserLogin") {
-    resetStore();
     next();
   } else {
     if (!store.user.token) {

+ 1 - 1
src/types/student-client.d.ts

@@ -60,7 +60,7 @@ export type Store = {
     /** 产品名称,登录页显示 */
     OE_STUDENT_SYS_NAME: string;
     /** 登录页可选的登录类型 !!!需对json进行转换!!! */
-    LOGIN_TYPE: Partial<["STUDENT_CODE", "IDENTITY_NUMBER"]>;
+    LOGIN_TYPE: Array<"STUDENT_CODE" | "IDENTITY_NUMBER">;
     ROOT_ORG_ID: number;
     /** @deprecated 登录支持的客户端类型。新版只支持Electron包。 */
     LOGIN_SUPPORT: Partial<["NATIVE", "BROWSER"]>;