Explorar el Código

键盘给分和鼠标给分支持选做题功能

刘洋 hace 10 meses
padre
commit
4e58c82b6f

+ 19 - 18
src/devLoginParams.ts

@@ -9,16 +9,17 @@
 // export const markerId="419";
 
 /** 244 评卷员 */
-// export const LOGIN_CONFIG = {
-//   isAdmin: false,
-//   forceChange: true,
-//   loginName: "1-339-1-1",
-//   // loginName: "liuyang",
-//   password: "123456",
-//   examId: "1",
-//   // markerId: "438",
-//   markerId: "594",
-// };
+export const LOGIN_CONFIG = {
+  isAdmin: false,
+  forceChange: true,
+  loginName: "1-339-1-1",
+  // loginName: "liuyang",
+  password: "123456",
+  examId: "1",
+  // markerId: "438",
+  // markerId: "594",
+  markerId: "147",
+};
 /** 244 评卷员 */
 // export const LOGIN_CONFIG = {
 //   isAdmin: false,
@@ -77,14 +78,14 @@
 //   // markerId: "483",
 // };
 /** 224 管理员 */
-export const LOGIN_CONFIG = {
-  isAdmin: true,
-  forceChange: true,
-  loginName: "admin-test",
-  password: "123456",
-  examId: "1",
-  markerId: null,
-};
+// export const LOGIN_CONFIG = {
+//   isAdmin: true,
+//   forceChange: true,
+//   loginName: "admin-test",
+//   password: "123456",
+//   examId: "1",
+//   markerId: null,
+// };
 // export const LOGIN_CONFIG = {
 //   isAdmin: true,
 //   forceChange: true,

+ 3 - 4
src/features/mark/Mark.vue

@@ -168,10 +168,9 @@ async function updateTask() {
     //     h: 0.52344,
     //   },
     // ];
-    // rawTask.questionList = [
-    //   { ...rawTask.questionList[0], selective: true },
-    //   { ...rawTask.questionList[0], subNumber: "2", selective: false },
-    // ];
+    // 假数据模拟
+    // rawTask.questionList[0].selective = true;
+
     const newTask = addFileServerPrefixToTask(rawTask);
 
     try {

+ 39 - 1
src/features/mark/MarkBoardKeyBoard.vue

@@ -100,7 +100,7 @@
       >
         <div
           :id="'bq-' + question.mainNumber + '-' + question.subNumber"
-          class="question tw-rounded tw-p-1 tw-mb-2 tw-cursor-pointer tw-relative"
+          class="question tw-rounded tw-p-1 tw-mb-1 tw-cursor-pointer tw-relative"
           :class="{
             'current-question': isCurrentQuestion(question),
             disabled: notInActive(index),
@@ -142,6 +142,18 @@
             </div>
           </div>
         </div>
+        <div class="tw-mb-2">
+          <div
+            v-if="question.selective"
+            class="tw-cursor-pointer tw-font-bold unselective"
+            :class="{
+              'current-score': question.hasSetUnselective,
+            }"
+            @click="setUnselect(question, index)"
+          >
+            未选做
+          </div>
+        </div>
       </template>
     </div>
   </div>
@@ -186,6 +198,7 @@ let scoreStr = $ref("");
 watch(
   () => [store.currentQuestion, store.setting.uiSetting["normal.mode"]],
   () => {
+    console.log("store.currentQuestion?.score", store.currentQuestion?.score);
     if (isNumber(store.currentQuestion?.score)) {
       scoreStr = "" + store.currentQuestion?.score;
     } else {
@@ -295,6 +308,7 @@ function numberKeyListener(event: KeyboardEvent) {
     }
     const { __index } = store.currentQuestion;
     store.currentTask.markResult.scoreList[__index] = score;
+    store.currentQuestion.hasSetUnselective = false;
     //
     // scoreStr = "";
     // console.log("give score", score);
@@ -365,9 +379,33 @@ function submit() {
 const buttonHeightForSelective = $computed(() =>
   store.setting.selective && store.setting.enableAllZero ? "36px" : "76px"
 );
+
+function setUnselect(question: Question, index: number) {
+  if (!question.hasSetUnselective) {
+    const markResult = store.currentTask.markResult;
+    markResult.scoreList[index] = null;
+    store.currentScore = undefined;
+    // scoreStr = "未选做";
+    scoreStr = "";
+  } else {
+    scoreStr = "";
+  }
+  question.hasSetUnselective = !question.hasSetUnselective;
+}
 </script>
 
 <style lang="less" scoped>
+.unselective {
+  width: 72px;
+
+  height: 32px;
+  font-size: var(--app-secondary-font-size);
+  display: grid;
+  place-content: center;
+  background-color: var(--app-container-bg-color);
+
+  border-radius: 30px;
+}
 .mark-board-track-container {
   max-width: 290px;
   min-width: 290px;

+ 35 - 0
src/features/mark/MarkBoardMouse.vue

@@ -108,6 +108,18 @@
                 question.subNumber
               }}
             </div>
+            <div style="width: 100%">
+              <div
+                v-if="question.selective"
+                class="tw-cursor-pointer tw-font-bold unselective"
+                :class="{
+                  'current-score': question.hasSetUnselective,
+                }"
+                @click="setUnselect(question, index)"
+              >
+                未选做
+              </div>
+            </div>
             <div class="tw-flex tw-flex-wrap tw-gap-2">
               <div
                 v-for="(s, i) in questionScoreSteps(question)"
@@ -160,7 +172,18 @@ function chooseScore(question: Question, score: number) {
   const { __index } = store.currentQuestion;
   store.currentTask &&
     (store.currentTask.markResult.scoreList[__index] = score);
+  question.hasSetUnselective = false;
 }
+
+function setUnselect(question: Question, index: number) {
+  if (!question.hasSetUnselective) {
+    const markResult = store.currentTask.markResult;
+    markResult.scoreList[index] = null;
+    store.currentScore = undefined;
+  }
+  question.hasSetUnselective = !question.hasSetUnselective;
+}
+
 const willChooseQuestion = (question: any, index: number, score: number) => {
   if (notInActive(index)) {
     return;
@@ -206,6 +229,18 @@ const buttonHeightForSelective = $computed(() =>
 </script>
 
 <style scoped>
+.unselective {
+  width: 72px;
+
+  height: 32px;
+  font-size: var(--app-secondary-font-size);
+  display: grid;
+  place-content: center;
+  background-color: var(--app-container-bg-color);
+
+  border-radius: 30px;
+  margin-bottom: 8px;
+}
 .mark-board-track-container {
   max-width: 290px;
   min-width: 290px;

+ 19 - 33
src/features/mark/MarkBoardTrack.vue

@@ -232,6 +232,25 @@
         style="padding-bottom: 40px; gap: 8px"
         :style="{ height: `${100 - topPercent}%` }"
       >
+        <div style="width: 100%">
+          <div
+            v-if="store.currentTask.questionList[curQuestionIndex].selective"
+            class="single-score tw-cursor-pointer tw-font-bold unselective"
+            :class="{
+              'current-score':
+                store.currentTask.questionList[curQuestionIndex]
+                  .hasSetUnselective,
+            }"
+            @click="
+              setUnselect(
+                store.currentTask.questionList[curQuestionIndex],
+                curQuestionIndex
+              )
+            "
+          >
+            未选做
+          </div>
+        </div>
         <div
           v-for="(s, i) in questionScoreSteps.slice(1)"
           :key="i"
@@ -262,39 +281,6 @@
           </div>
         </a-tooltip>
-        <div
-          v-if="store.currentTask.questionList[curQuestionIndex].selective"
-          class="single-score tw-cursor-pointer tw-font-bold unselective"
-          :class="{
-            'current-score':
-              store.currentTask.questionList[curQuestionIndex]
-                .hasSetUnselective,
-          }"
-          @click="
-            setUnselect(
-              store.currentTask.questionList[curQuestionIndex],
-              curQuestionIndex
-            )
-          "
-        >
-          未选做
-        </div>
-        <!-- <a-button
-          v-if="store.currentTask.questionList[curQuestionIndex].selective"
-          :type="
-            store.currentTask.questionList[curQuestionIndex].hasSetUnselective
-              ? 'primary'
-              : 'default'
-          "
-          class="set-unselect"
-          @click="
-            setUnselect(
-              store.currentTask.questionList[curQuestionIndex],
-              curQuestionIndex
-            )
-          "
-          >未选做</a-button
-        > -->
       </div>
     </div>
     <div

+ 2 - 2
vite.config.ts

@@ -3,10 +3,10 @@ import vue from "@vitejs/plugin-vue";
 import ViteComponents from "unplugin-vue-components/vite";
 import { AntDesignVueResolver } from "unplugin-vue-components/resolvers";
 
-// const SERVER_URL = "http://192.168.10.225";
+const SERVER_URL = "http://192.168.10.224";
 // const SERVER_URL = "https://www.markingcloud.com";
 // const SERVER_URL = "http://192.168.11.103:8090";
-const SERVER_URL = "http://192.168.11.201:8000";
+// const SERVER_URL = "http://192.168.11.201:8000";
 
 const path = require("path");