|
@@ -0,0 +1,601 @@
|
|
|
+import { useMarkStore } from "@/store";
|
|
|
+import type { PaperRecogData, Question } from "@/types";
|
|
|
+import { calcSumPrecision, maxNum } from "@/utils/utils";
|
|
|
+
|
|
|
+export interface MarkDetailUserItem {
|
|
|
+ userId: string;
|
|
|
+ userName: string;
|
|
|
+ prename: string;
|
|
|
+ color: string;
|
|
|
+ scores: Array<{ subNumber: string; score: number }>;
|
|
|
+ score: number;
|
|
|
+}
|
|
|
+export type UserMapType = Record<string, MarkDetailUserItem>;
|
|
|
+export interface MarkDetailItem {
|
|
|
+ mainNumber: number;
|
|
|
+ subNumber: string;
|
|
|
+ isFillQuestion: boolean;
|
|
|
+ score: number;
|
|
|
+ maxScore: number;
|
|
|
+ users: MarkDetailUserItem[];
|
|
|
+ area: QuestionArea;
|
|
|
+ style: Record<string, string>;
|
|
|
+}
|
|
|
+
|
|
|
+export interface QuestionItem {
|
|
|
+ mainNumber: number;
|
|
|
+ subNumber: number | string;
|
|
|
+}
|
|
|
+export interface QuestionArea {
|
|
|
+ i: number;
|
|
|
+ x: number;
|
|
|
+ y: number;
|
|
|
+ w: number;
|
|
|
+ h: number;
|
|
|
+ qStruct: string;
|
|
|
+}
|
|
|
+
|
|
|
+export interface AnswerTagItem {
|
|
|
+ mainNumber: number;
|
|
|
+ subNumber: string;
|
|
|
+ answer: string;
|
|
|
+ style: Record<string, string>;
|
|
|
+}
|
|
|
+
|
|
|
+export interface ObjectiveAnswerTagItem {
|
|
|
+ id: string;
|
|
|
+ mainNumber: number;
|
|
|
+ subNumbers: string;
|
|
|
+ score: number;
|
|
|
+ totalScore: number;
|
|
|
+ style: Record<string, string | number>;
|
|
|
+}
|
|
|
+
|
|
|
+export interface SummaryItem {
|
|
|
+ mainNumber: number;
|
|
|
+ subNumber: string;
|
|
|
+ score: number;
|
|
|
+ markerName: string;
|
|
|
+}
|
|
|
+
|
|
|
+export default function useTrackTag() {
|
|
|
+ const markStore = useMarkStore();
|
|
|
+
|
|
|
+ // 解析识别数据
|
|
|
+ function paserRecogData(
|
|
|
+ imgDom: HTMLImageElement,
|
|
|
+ imageIndex
|
|
|
+ ): AnswerTagItem[] {
|
|
|
+ if (
|
|
|
+ !markStore.currentTask.recogDatas?.length ||
|
|
|
+ !markStore.currentTask.recogDatas[imageIndex]
|
|
|
+ )
|
|
|
+ return [];
|
|
|
+
|
|
|
+ const answerMap = markStore.currentTask.answerMap || {};
|
|
|
+ const { naturalWidth, naturalHeight } = imgDom;
|
|
|
+ const recogData: PaperRecogData = JSON.parse(
|
|
|
+ window.atob(markStore.currentTask.recogDatas[imageIndex])
|
|
|
+ );
|
|
|
+ const answerTags: AnswerTagItem[] = [];
|
|
|
+ // const optionsBlocks = [];
|
|
|
+ recogData.question.forEach((question) => {
|
|
|
+ question.fill_result.forEach((result) => {
|
|
|
+ const tagSize = result.fill_size[1];
|
|
|
+ const fillPositions = result.fill_position.map((pos) => {
|
|
|
+ return pos.split(",").map((n) => n * 1);
|
|
|
+ });
|
|
|
+
|
|
|
+ const offsetLt = result.fill_size.map((item) => item * 0.4);
|
|
|
+ const tagLeft =
|
|
|
+ maxNum(fillPositions.map((pos) => pos[0])) +
|
|
|
+ result.fill_size[0] -
|
|
|
+ offsetLt[0];
|
|
|
+ const tagTop = fillPositions[0][1] - offsetLt[1];
|
|
|
+
|
|
|
+ const { answer, isRight } =
|
|
|
+ answerMap[`${result.main_number}_${result.sub_number}`] || {};
|
|
|
+
|
|
|
+ answerTags.push({
|
|
|
+ mainNumber: result.main_number,
|
|
|
+ subNumber: result.sub_number,
|
|
|
+ answer,
|
|
|
+ style: {
|
|
|
+ height: ((100 * tagSize) / naturalHeight).toFixed(4) + "%",
|
|
|
+ fontSize: ((100 * 20) / tagSize).toFixed(4) + "%",
|
|
|
+ left: ((100 * tagLeft) / naturalWidth).toFixed(4) + "%",
|
|
|
+ top: ((100 * tagTop) / naturalHeight).toFixed(4) + "%",
|
|
|
+ position: "absolute",
|
|
|
+ color: isRight ? "#05b575" : "#f53f3f",
|
|
|
+ fontWeight: 600,
|
|
|
+ lineHeight: 1,
|
|
|
+ zIndex: 9,
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ // 测试:选项框
|
|
|
+ // fillPositions.forEach((fp, index) => {
|
|
|
+ // optionsBlocks.push({
|
|
|
+ // mainNumber: result.main_number,
|
|
|
+ // subNumber: result.sub_number,
|
|
|
+ // filled: !!result.fill_option[index],
|
|
|
+ // style: {
|
|
|
+ // width:
|
|
|
+ // ((100 * result.fill_size[0]) / naturalWidth).toFixed(4) + "%",
|
|
|
+ // height:
|
|
|
+ // ((100 * result.fill_size[1]) / naturalHeight).toFixed(4) + "%",
|
|
|
+ // left:
|
|
|
+ // ((100 * (fp[0] - offsetLt[0])) / naturalWidth).toFixed(4) + "%",
|
|
|
+ // top:
|
|
|
+ // ((100 * (fp[1] - offsetLt[1])) / naturalHeight).toFixed(4) + "%",
|
|
|
+ // position: "absolute",
|
|
|
+ // border: "1px solid #f53f3f",
|
|
|
+ // background: result.fill_option[index]
|
|
|
+ // ? "rgba(245, 63, 63, 0.5)"
|
|
|
+ // : "transparent",
|
|
|
+ // zIndex: 9,
|
|
|
+ // },
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ return answerTags;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 解析各试题答题区域
|
|
|
+ function parseQuestionAreas(questions: QuestionItem[]) {
|
|
|
+ if (!questions.length || !markStore.currentTask.cardData?.length) return [];
|
|
|
+
|
|
|
+ const pictureConfigs: QuestionArea[] = [];
|
|
|
+ const structs = questions.map(
|
|
|
+ (item) => `${item.mainNumber}_${item.subNumber}`
|
|
|
+ );
|
|
|
+ markStore.currentTask.cardData.forEach((page, pindex) => {
|
|
|
+ page.exchange.answer_area.forEach((area) => {
|
|
|
+ const [x, y, w, h] = area.area;
|
|
|
+ const qStruct = `${area.main_number}_${area.sub_number}`;
|
|
|
+
|
|
|
+ const pConfig: QuestionArea = {
|
|
|
+ i: pindex + 1,
|
|
|
+ x,
|
|
|
+ y,
|
|
|
+ w,
|
|
|
+ h,
|
|
|
+ qStruct,
|
|
|
+ };
|
|
|
+
|
|
|
+ if (typeof area.sub_number === "number") {
|
|
|
+ if (!structs.includes(qStruct)) return;
|
|
|
+ pictureConfigs.push(pConfig);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 复合区域处理,比如填空题,多个小题合并为一个区域
|
|
|
+ if (typeof area.sub_number === "string") {
|
|
|
+ const areaStructs = area.sub_number
|
|
|
+ .split(",")
|
|
|
+ .map((subNumber) => `${area.main_number}_${subNumber}`);
|
|
|
+ if (
|
|
|
+ structs.some((struct) => areaStructs.includes(struct)) &&
|
|
|
+ !pictureConfigs.find((item) => item.qStruct === qStruct)
|
|
|
+ ) {
|
|
|
+ pictureConfigs.push(pConfig);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // console.log(pictureConfigs);
|
|
|
+
|
|
|
+ // 合并相邻区域
|
|
|
+ pictureConfigs.sort((a, b) => {
|
|
|
+ return a.i - b.i || a.x - b.x || a.y - b.y;
|
|
|
+ });
|
|
|
+ const combinePictureConfigList: QuestionArea[] = [];
|
|
|
+ let prevConfig = null;
|
|
|
+ pictureConfigs.forEach((item, index) => {
|
|
|
+ if (!index) {
|
|
|
+ prevConfig = { ...item };
|
|
|
+ combinePictureConfigList.push(prevConfig);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const elasticRate = 0.01;
|
|
|
+ if (
|
|
|
+ prevConfig.i === item.i &&
|
|
|
+ prevConfig.y + prevConfig.h + elasticRate >= item.y &&
|
|
|
+ prevConfig.w === item.w &&
|
|
|
+ prevConfig.x === item.x
|
|
|
+ ) {
|
|
|
+ prevConfig.h = item.y + item.h - prevConfig.y;
|
|
|
+ } else {
|
|
|
+ prevConfig = { ...item };
|
|
|
+ combinePictureConfigList.push(prevConfig);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // console.log(combinePictureConfigList);
|
|
|
+ return combinePictureConfigList;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取属于填空题的试题号
|
|
|
+ function getFillLines() {
|
|
|
+ if (!markStore.currentTask.cardData?.length) return {};
|
|
|
+
|
|
|
+ const questions: Record<number, string[]> = {};
|
|
|
+ markStore.currentTask.cardData.forEach((page) => {
|
|
|
+ page.columns.forEach((column) => {
|
|
|
+ column.elements.forEach((element) => {
|
|
|
+ if (element.type !== "FILL_LINE") return;
|
|
|
+
|
|
|
+ if (!questions[element.topicNo]) questions[element.topicNo] = [];
|
|
|
+
|
|
|
+ for (let i = 0; i < element.questionsCount; i++) {
|
|
|
+ questions[element.topicNo].push(
|
|
|
+ `${element.topicNo}_${element.startNumber + i}`
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ return questions;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 解析各试题答题区域以及评分
|
|
|
+ function parseMarkDetailList(): Array<MarkDetailItem[]> {
|
|
|
+ const dataList: Array<MarkDetailItem[]> = [];
|
|
|
+ const questions = markStore.currentTask.questionList || [];
|
|
|
+
|
|
|
+ const fillQues = getFillLines();
|
|
|
+ let fillQuestions = [] as Question[];
|
|
|
+ let otherQuestions = questions;
|
|
|
+ if (Object.keys(fillQues).length) {
|
|
|
+ const fillQNos = Object.values(fillQues).flat();
|
|
|
+ fillQuestions = questions.filter((q) =>
|
|
|
+ fillQNos.includes(`${q.mainNumber}_${q.subNumber}`)
|
|
|
+ );
|
|
|
+ otherQuestions = questions.filter(
|
|
|
+ (q) => !fillQNos.includes(`${q.mainNumber}_${q.subNumber}`)
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ // 填空题:合并所有小题为一个区域
|
|
|
+ Object.values(fillQues).forEach((qnos) => {
|
|
|
+ const groupQuestions = fillQuestions.filter((q) =>
|
|
|
+ qnos.includes(`${q.mainNumber}_${q.subNumber}`)
|
|
|
+ );
|
|
|
+ const areas = parseQuestionAreas(groupQuestions);
|
|
|
+ if (!areas.length) return;
|
|
|
+ const area = { ...areas[0] };
|
|
|
+ const imgIndex = area.i - 1;
|
|
|
+ if (!dataList[imgIndex]) {
|
|
|
+ dataList[imgIndex] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ const userMap: UserMapType = {};
|
|
|
+ // 大题分成两个部分给两个人评 与 大题被两人同时评 是不一样的
|
|
|
+ const isDoubleMark = !groupQuestions.some((question) => {
|
|
|
+ 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;
|
|
|
+ });
|
|
|
+ groupQuestions.forEach((question) => {
|
|
|
+ question.trackList.forEach((track) => {
|
|
|
+ if (!userMap[track.userId]) {
|
|
|
+ userMap[track.userId] = {
|
|
|
+ userId: track.userId,
|
|
|
+ userName: track.userName,
|
|
|
+ color: track.color || "red",
|
|
|
+ prename: "",
|
|
|
+ scores: [],
|
|
|
+ score: 0,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ const existUserScore = userMap[track.userId].scores.find(
|
|
|
+ (s) => s.subNumber === track.subNumber
|
|
|
+ );
|
|
|
+ if (existUserScore) {
|
|
|
+ existUserScore.score += track.score;
|
|
|
+ } else {
|
|
|
+ userMap[track.userId].scores.push({
|
|
|
+ score: track.score,
|
|
|
+ subNumber: track.subNumber,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 普通模式没有轨迹
|
|
|
+ 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",
|
|
|
+ prename: "",
|
|
|
+ scores: [],
|
|
|
+ score: 0,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ userMap[marker.userId].scores.push({
|
|
|
+ score: marker.score,
|
|
|
+ subNumber: question.subNumber,
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ const users = Object.values(userMap).map((user, index) => {
|
|
|
+ const zhs = ["一", "二", "三"];
|
|
|
+ const prename = isDoubleMark ? `${zhs[index] || ""}评` : "评卷员";
|
|
|
+ return {
|
|
|
+ ...user,
|
|
|
+ prename,
|
|
|
+ score: calcSumPrecision(user.scores.map((s) => s.score)),
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ const score = calcSumPrecision(
|
|
|
+ groupQuestions.map((item) => item.score || 0)
|
|
|
+ );
|
|
|
+ const maxScore = calcSumPrecision(
|
|
|
+ groupQuestions.map((item) => item.maxScore)
|
|
|
+ );
|
|
|
+
|
|
|
+ dataList[imgIndex].push({
|
|
|
+ mainNumber: groupQuestions[0].mainNumber,
|
|
|
+ subNumber: "",
|
|
|
+ isFillQuestion: true,
|
|
|
+ score,
|
|
|
+ maxScore,
|
|
|
+ users,
|
|
|
+ area,
|
|
|
+ style: {
|
|
|
+ position: "absolute",
|
|
|
+ left: (100 * area.x).toFixed(4) + "%",
|
|
|
+ top: (100 * area.y).toFixed(4) + "%",
|
|
|
+ width: (100 * area.w).toFixed(4) + "%",
|
|
|
+ fontSize: "14px",
|
|
|
+ lineHeight: 1,
|
|
|
+ zIndex: 9,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ // 其他试题
|
|
|
+ otherQuestions.forEach((question) => {
|
|
|
+ const areas = parseQuestionAreas([question]);
|
|
|
+ const area = { ...areas[0] };
|
|
|
+ const imgIndex = area.i - 1;
|
|
|
+ if (!dataList[imgIndex]) {
|
|
|
+ dataList[imgIndex] = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ const userMap: UserMapType = {};
|
|
|
+ const isArbitration = Boolean(question.headerTrack?.length);
|
|
|
+ const tList = isArbitration ? question.headerTrack : question.trackList;
|
|
|
+ tList.forEach((track) => {
|
|
|
+ if (!userMap[track.userId]) {
|
|
|
+ userMap[track.userId] = {
|
|
|
+ userId: track.userId,
|
|
|
+ userName: track.userName,
|
|
|
+ color: track.color || "red",
|
|
|
+ prename: "",
|
|
|
+ scores: [],
|
|
|
+ score: 0,
|
|
|
+ };
|
|
|
+ }
|
|
|
+ userMap[track.userId].scores.push({
|
|
|
+ score: track.score,
|
|
|
+ subNumber: track.subNumber,
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ const isDoubleMark = Object.keys(userMap).length > 1;
|
|
|
+ const zhs = ["一", "二", "三"];
|
|
|
+ let users = Object.values(userMap).map((user, index) => {
|
|
|
+ let prename = "";
|
|
|
+ if (isArbitration) {
|
|
|
+ prename = "仲裁";
|
|
|
+ } else {
|
|
|
+ prename = isDoubleMark ? `${zhs[index] || ""}评` : "评卷员";
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ ...user,
|
|
|
+ prename,
|
|
|
+ score: calcSumPrecision(user.scores.map((s) => s.score)),
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ // 普通模式没有轨迹
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ users = markers.map((item, index) => {
|
|
|
+ return {
|
|
|
+ userId: item.userId,
|
|
|
+ userName: item.userName,
|
|
|
+ color: item.header ? "green" : "red",
|
|
|
+ prename: markers.length > 1 ? `${zhs[index] || ""}评` : "评卷员",
|
|
|
+ scores: [],
|
|
|
+ score: item.score,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ dataList[imgIndex].push({
|
|
|
+ mainNumber: question.mainNumber,
|
|
|
+ subNumber: question.subNumber,
|
|
|
+ isFillQuestion: false,
|
|
|
+ score: question.score,
|
|
|
+ maxScore: question.maxScore,
|
|
|
+ users,
|
|
|
+ area,
|
|
|
+ style: {
|
|
|
+ position: "absolute",
|
|
|
+ left: (100 * area.x).toFixed(4) + "%",
|
|
|
+ top: (100 * area.y).toFixed(4) + "%",
|
|
|
+ width: (100 * area.w).toFixed(4) + "%",
|
|
|
+ fontSize: "14px",
|
|
|
+ lineHeight: 1,
|
|
|
+ zIndex: 9,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ return dataList;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 解析客观题区域总分
|
|
|
+ function parseObjectiveAnswerTags() {
|
|
|
+ const objectiveAnswerTags: Array<ObjectiveAnswerTagItem[]> = [];
|
|
|
+
|
|
|
+ if (
|
|
|
+ !markStore.currentTask.cardData?.length ||
|
|
|
+ !markStore.currentTask.answerMap
|
|
|
+ )
|
|
|
+ return objectiveAnswerTags;
|
|
|
+
|
|
|
+ markStore.currentTask.cardData.forEach((page, pindex) => {
|
|
|
+ if (!objectiveAnswerTags[pindex]) objectiveAnswerTags[pindex] = [];
|
|
|
+
|
|
|
+ page.columns.forEach((column) => {
|
|
|
+ column.elements.forEach((element) => {
|
|
|
+ if (element.type !== "FILL_QUESTION") return;
|
|
|
+
|
|
|
+ const ogroup = objectiveAnswerTags.find((tgroup) =>
|
|
|
+ tgroup.some((oitem) => oitem.id === element.parent.id)
|
|
|
+ );
|
|
|
+ if (ogroup) return;
|
|
|
+
|
|
|
+ const parent = element.parent;
|
|
|
+ const oaTagItem: ObjectiveAnswerTagItem = {
|
|
|
+ id: parent.id,
|
|
|
+ mainNumber: parent.topicNo,
|
|
|
+ subNumbers: `${parent.startNumber}~${
|
|
|
+ parent.startNumber + parent.questionsCount - 1
|
|
|
+ }`,
|
|
|
+ score: 0,
|
|
|
+ totalScore: 0,
|
|
|
+ style: {
|
|
|
+ position: "absolute",
|
|
|
+ left: 0,
|
|
|
+ top: 0,
|
|
|
+ textAlign: "right",
|
|
|
+ width: "44%",
|
|
|
+ fontSize: "20px",
|
|
|
+ fontWeight: "bold",
|
|
|
+ color: "#f53f3f",
|
|
|
+ lineHeight: 1,
|
|
|
+ zIndex: 9,
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
+ let area = [0, 0];
|
|
|
+ page.exchange.fill_area.forEach((fa) => {
|
|
|
+ fa.items.forEach((fitem) => {
|
|
|
+ if (
|
|
|
+ fitem.main_number === oaTagItem.mainNumber &&
|
|
|
+ fitem.sub_number === parent.startNumber
|
|
|
+ ) {
|
|
|
+ area = fitem.options[0];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ const left = (100 * (area[0] - 0.015)).toFixed(4);
|
|
|
+ const top = (100 * (area[1] - 0.04)).toFixed(4);
|
|
|
+ oaTagItem.style.left = `${left}%`;
|
|
|
+ oaTagItem.style.top = `${top}%`;
|
|
|
+
|
|
|
+ const questions: Array<{ score: number; totalScore: number }> = [];
|
|
|
+ for (let i = 0; i < parent.questionsCount; i++) {
|
|
|
+ const qans = markStore.currentTask.answerMap[
|
|
|
+ `${parent.topicNo}_${i + parent.startNumber}`
|
|
|
+ ] || { score: 0, totalScore: 0 };
|
|
|
+ questions[i] = {
|
|
|
+ score: qans.score,
|
|
|
+ totalScore: qans.totalScore,
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ oaTagItem.score = calcSumPrecision(
|
|
|
+ questions.map((q) => q.score || 0)
|
|
|
+ );
|
|
|
+ oaTagItem.totalScore = calcSumPrecision(
|
|
|
+ questions.map((q) => q.totalScore || 0)
|
|
|
+ );
|
|
|
+
|
|
|
+ objectiveAnswerTags[pindex].push(oaTagItem);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ return objectiveAnswerTags;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 模式4的解析
|
|
|
+ function parseMode4Data(): SummaryItem[] {
|
|
|
+ // 只有单评才展示summary
|
|
|
+ const isDoubleMark = (markStore.currentTask.questionList || []).some(
|
|
|
+ (question) => {
|
|
|
+ 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 === 2;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ if (isDoubleMark) return [];
|
|
|
+
|
|
|
+ return (markStore.currentTask.questionList || []).map((q) => {
|
|
|
+ let markerName = "";
|
|
|
+ if (q.headerTrack && q.headerTrack.length) {
|
|
|
+ markerName = q.headerTrack[0].userName;
|
|
|
+ } else if (q.trackList && q.trackList.length) {
|
|
|
+ markerName = q.trackList[0].userName;
|
|
|
+ } else if (q.markerList && q.markerList.length) {
|
|
|
+ let markers = q.markerList.filter((marker) => marker.header);
|
|
|
+ if (!markers.length) {
|
|
|
+ markers = q.markerList.filter((marker) => !marker.header);
|
|
|
+ }
|
|
|
+ if (markers.length) markerName = markers[0].userName;
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ mainNumber: q.mainNumber,
|
|
|
+ subNumber: q.subNumber,
|
|
|
+ score: q.score,
|
|
|
+ markerName,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return {
|
|
|
+ parseMarkDetailList,
|
|
|
+ paserRecogData,
|
|
|
+ parseObjectiveAnswerTags,
|
|
|
+ parseMode4Data,
|
|
|
+ };
|
|
|
+}
|