Browse Source

feat: 修复题目间隔分小于0时, 页面渲染死循环的问题

chenhao 2 years ago
parent
commit
137cb297c0
3 changed files with 9 additions and 6 deletions
  1. 0 1
      src/devLogin.ts
  2. 7 3
      src/features/mark/MarkBoardTrack.vue
  3. 2 2
      vite.config.ts

+ 0 - 1
src/devLogin.ts

@@ -1,4 +1,3 @@
-// @ts-ignore
 import { LOGIN_CONFIG } from "@/devLoginParams";
 
 const { loginName, password, examId, markerId, isAdmin, forceChange } =

+ 7 - 3
src/features/mark/MarkBoardTrack.vue

@@ -239,10 +239,10 @@ const emit = defineEmits(["submit", "allZeroSubmit", "unselectiveSubmit"]);
 const { dragSpliter, topPercent } = dragSplitPane();
 
 watch(topPercent, () => {
-  if (topPercent.value <= 10) {
+  if (topPercent.value < 10) {
     topPercent.value = 10;
   }
-  if (topPercent.value >= 90) {
+  if (topPercent.value > 90) {
     topPercent.value = 90;
   }
 });
@@ -268,10 +268,14 @@ const questionScoreSteps = $computed(() => {
 
   const remainScore =
     Math.round(question.maxScore * 100 - (questionScore || 0) * 100) / 100;
+
   const steps = [];
+  if (question.intervalScore <= 0) {
+    console.warn(`question.intervalScore got: ${question.intervalScore}`);
+  }
   for (
     let i = 0;
-    i <= remainScore;
+    i <= remainScore && question.intervalScore > 0;
     i = Math.round(i * 100 + question.intervalScore * 100) / 100
   ) {
     steps.push(i);

+ 2 - 2
vite.config.ts

@@ -1,4 +1,4 @@
-import { defineConfig, normalizePath,Plugin } from "vite";
+import { defineConfig, normalizePath, Plugin } from "vite";
 import vue from "@vitejs/plugin-vue";
 import ViteComponents from "unplugin-vue-components/vite";
 import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
@@ -12,7 +12,7 @@ function mockDevLogin(): Plugin {
     apply: "build",
     load(id) {
       if (id === normalizePath(path.resolve(__dirname, "src/devLogin.ts"))) {
-        return `export default {initLogin(){}}`;
+        return `export const initLogin = () => {}`;
       }
     },
   };