Explorar o código

feat: 普通模式轨迹图

zhangjie hai 7 meses
pai
achega
f47240e66a
Modificáronse 5 ficheiros con 66 adicións e 4 borrados
  1. 1 1
      CHANGE.md
  2. 1 1
      package.json
  3. 4 0
      src/api/task.ts
  4. 9 0
      src/api/types/task.ts
  5. 51 2
      src/views/base/track-export/useDraw.ts

+ 1 - 1
CHANGE.md

@@ -1,12 +1,12 @@
 ## 1.0.3
 
 - 适用范围:知学知考 3.4.2
-- 模式四:首页汇总信息
 - 普通模式:答题块区域显示汇总信息
 
 ## 1.0.2
 
 - 适用范围:知学知考 3.4.1,3.4.0
+- 模式四:首页汇总信息
 
 ## 1.0.1
 

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "teachcloud-mark-tool",
   "description": "teachcloud mark tool",
-  "version": "1.0.2",
+  "version": "1.0.3",
   "main": "./out/main/index.js",
   "author": "chulinice",
   "license": "MIT",

+ 4 - 0
src/api/task.ts

@@ -56,12 +56,16 @@ export async function trackExportListPage(
   params: TrackExportListParams
 ): Promise<TrackExportListPageRes> {
   return axios.post('/api/admin/mark/archive/score/list', {}, { params });
+  // 测试专用:成绩检查
+  // return axios.post('/api/admin/mark/setting/scoreList', {}, { params });
 }
 // 导出科目学生明细查询列表
 export async function trackExportDetailListPage(
   params: TrackExportDetailListParams
 ): Promise<TrackExportDetailListPageRes> {
   return axios.post('/api/admin/mark/archive/student/list', {}, { params });
+  // 测试专用:成绩检查
+  // return axios.post('/api/admin/mark/student/score', {}, { params });
 }
 
 /** 查看单个学生的试卷轨迹 */

+ 9 - 0
src/api/types/task.ts

@@ -95,6 +95,15 @@ export interface Question {
   uncalculate: boolean;
   /** 选做题分组 */
   selectiveIndex: number | null;
+  /** 无轨迹情况下评卷员打分信息 */
+  markerList: null | Array<{
+    // 是否是科组长
+    header: boolean;
+    loginName: string;
+    score: number;
+    userId: string;
+    userName: string;
+  }>;
   rejected?: boolean;
   questionName?: string;
   headerTrack?: Array<Track>;

+ 51 - 2
src/views/base/track-export/useDraw.ts

@@ -550,7 +550,16 @@ export default function useDraw(drawConfig: DrawConfig) {
       const dataArr = dataList[imgIndex];
       const userMap: UserMapType = {};
       const isDoubleMark = !groupQuestions.some((question) => {
-        const userIds = question.trackList.map((track) => track.userId);
+        let userIds = question.trackList.map((track) => track.userId);
+        if (
+          !userIds.length &&
+          question.markerList &&
+          question.markerList.length
+        ) {
+          userIds = question.markerList
+            .filter((marker) => !marker.header)
+            .map((marker) => marker.userId);
+        }
         const uids = new Set(userIds);
         return uids.size === 1;
       });
@@ -576,9 +585,33 @@ export default function useDraw(drawConfig: DrawConfig) {
             });
           }
         });
+
+        // 普通模式没有轨迹
+        if (
+          !question.trackList.length &&
+          question.markerList &&
+          question.markerList.length
+        ) {
+          question.markerList
+            .filter((marker) => !marker.header)
+            .forEach((marker) => {
+              if (!userMap[marker.userId]) {
+                userMap[marker.userId] = {
+                  userId: marker.userId,
+                  userName: marker.userName,
+                  color: marker.header ? 'green' : 'red',
+                  scores: [],
+                };
+              }
+              userMap[marker.userId].scores.push({
+                score: marker.score,
+                subNumber: question.subNumber,
+              });
+            });
+        }
       });
 
-      // 填空题的打分需要自动换行,目前一行只展示最多7个评分
+      // 填空题的打分需要自动换行,目前一行只展示最多10个评分
       let offsetY = -1 * trackInfoLineHeight;
       Object.values(userMap).forEach((user, index) => {
         const zhs = ['一', '二', '三'];
@@ -675,6 +708,22 @@ export default function useDraw(drawConfig: DrawConfig) {
         });
       });
 
+      // 普通模式没有轨迹
+      if (!tList.length && question.markerList && question.markerList.length) {
+        let markers = question.markerList.filter((marker) => marker.header);
+        if (!markers.length) {
+          markers = question.markerList.filter((marker) => !marker.header);
+        }
+        markers.forEach((marker) => {
+          userMap[marker.userId] = {
+            userId: marker.userId,
+            userName: marker.userName,
+            color: marker.header ? 'green' : 'red',
+            scores: [{ score: marker.score, subNumber: question.subNumber }],
+          };
+        });
+      }
+
       const isDoubleMark = Object.values(userMap).length > 1;
       Object.values(userMap).forEach((user, index) => {
         const zhs = ['一', '二', '三'];