|
@@ -144,6 +144,26 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
const hasTrack = trackConfig.pictureType.includes('track');
|
|
|
const hasPdf = trackConfig.pictureType.includes('pdf');
|
|
|
|
|
|
+ // 总分
|
|
|
+ const watermarkHasTotal = trackConfig.watermarkElements.includes('TOTAL');
|
|
|
+ // 客观题得分
|
|
|
+ const watermarkHasObjective =
|
|
|
+ trackConfig.watermarkElements.includes('OBJECTIVE');
|
|
|
+ // 主观题得分
|
|
|
+ const watermarkHasSubjective =
|
|
|
+ trackConfig.watermarkElements.includes('SUBJECTIVE');
|
|
|
+ // 主观题明细分
|
|
|
+ const watermarkHasSubjectiveDetail =
|
|
|
+ trackConfig.watermarkElements.includes('SUBJECTIVE_DETAIL');
|
|
|
+ // 主观题评卷员信息及给分
|
|
|
+ const watermarkHasSubjectiveEvaluator =
|
|
|
+ trackConfig.watermarkElements.includes('SUBJECTIVE_EVALUATOR');
|
|
|
+ // 主观题
|
|
|
+ const watermarkHasSbj =
|
|
|
+ watermarkHasSubjective ||
|
|
|
+ watermarkHasSubjectiveDetail ||
|
|
|
+ watermarkHasSubjectiveEvaluator;
|
|
|
+
|
|
|
const defaultColorConfig = {
|
|
|
track: ['red', 'blue', 'gray'],
|
|
|
head: 'green',
|
|
@@ -368,16 +388,18 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
for (let i = 0; i < originImgs.length; i++) {
|
|
|
const img = originImgs[i];
|
|
|
const drawTrackList = [] as DrawTrackItem[];
|
|
|
- trackLists
|
|
|
- .filter((item) => item.offsetIndex === i + 1)
|
|
|
- .forEach((item) => {
|
|
|
- drawTrackList.push(getDrawTrackItem(item));
|
|
|
- });
|
|
|
- tagLists
|
|
|
- .filter((item) => item.offsetIndex === i + 1)
|
|
|
- .forEach((item) => {
|
|
|
- drawTrackList.push(getDrawTagTrackItem(item));
|
|
|
- });
|
|
|
+ if (watermarkHasSubjectiveDetail) {
|
|
|
+ trackLists
|
|
|
+ .filter((item) => item.offsetIndex === i + 1)
|
|
|
+ .forEach((item) => {
|
|
|
+ drawTrackList.push(getDrawTrackItem(item));
|
|
|
+ });
|
|
|
+ tagLists
|
|
|
+ .filter((item) => item.offsetIndex === i + 1)
|
|
|
+ .forEach((item) => {
|
|
|
+ drawTrackList.push(getDrawTagTrackItem(item));
|
|
|
+ });
|
|
|
+ }
|
|
|
const answerTags = paserRecogData(i);
|
|
|
drawTrackList.push(...answerTags);
|
|
|
drawTrackList.push(...(markDeailList[i] || []));
|
|
@@ -385,7 +407,7 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
(tag) => tag.trackItem
|
|
|
);
|
|
|
drawTrackList.push(...oTags);
|
|
|
- drawTrackList.push(getTotalTrack(img));
|
|
|
+ if (watermarkHasTotal) drawTrackList.push(getTotalTrack(img));
|
|
|
|
|
|
trackData[i] = {
|
|
|
url: img.url,
|
|
@@ -396,7 +418,7 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- if (!hasMarkArea && !cardData.length) {
|
|
|
+ if (watermarkHasSbj && !hasMarkArea && !cardData.length) {
|
|
|
const summarys = parseSummaryData(originImgs[0]);
|
|
|
trackData[0].drawTrackList.push(...summarys);
|
|
|
}
|
|
@@ -697,41 +719,45 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- users.forEach((user) => {
|
|
|
- offsetY += trackInfoLineHeight;
|
|
|
+ if (watermarkHasSubjectiveEvaluator) {
|
|
|
+ users.forEach((user) => {
|
|
|
+ offsetY += trackInfoLineHeight;
|
|
|
+ dataArr.push({
|
|
|
+ type: 'text',
|
|
|
+ option: {
|
|
|
+ x: area.x,
|
|
|
+ y: area.y + offsetY,
|
|
|
+ text: `${user.prename}:${user.userName},评分:`,
|
|
|
+ fontSize: trackInfoFontSize,
|
|
|
+ color: user.color,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ const userScore = user.scores.map(
|
|
|
+ (item) => `${item.subNumber}:${item.score}分`
|
|
|
+ );
|
|
|
+ groupLineScore(userScore, user.color);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (watermarkHasSubjective) {
|
|
|
+ const score = calcSumPrecision(
|
|
|
+ groupQuestions.map((item) => item.markerScore || 0)
|
|
|
+ );
|
|
|
+ const maxScore = calcSumPrecision(
|
|
|
+ groupQuestions.map((item) => item.maxScore)
|
|
|
+ );
|
|
|
+ const tCont = `得分:${score},满分:${maxScore}`;
|
|
|
+ const tContLen = strGbLen(tCont) / 2;
|
|
|
dataArr.push({
|
|
|
type: 'text',
|
|
|
option: {
|
|
|
- x: area.x,
|
|
|
- y: area.y + offsetY,
|
|
|
- text: `${user.prename}:${user.userName},评分:`,
|
|
|
- fontSize: trackInfoFontSize,
|
|
|
- color: user.color,
|
|
|
+ x: area.x + area.w - Math.ceil(tContLen * trackTextFontSize),
|
|
|
+ y: area.y,
|
|
|
+ text: tCont,
|
|
|
+ fontSize: trackTextFontSize,
|
|
|
},
|
|
|
});
|
|
|
- const userScore = user.scores.map(
|
|
|
- (item) => `${item.subNumber}:${item.score}分`
|
|
|
- );
|
|
|
- groupLineScore(userScore, user.color);
|
|
|
- });
|
|
|
-
|
|
|
- const score = calcSumPrecision(
|
|
|
- groupQuestions.map((item) => item.markerScore || 0)
|
|
|
- );
|
|
|
- const maxScore = calcSumPrecision(
|
|
|
- groupQuestions.map((item) => item.maxScore)
|
|
|
- );
|
|
|
- const tCont = `得分:${score},满分:${maxScore}`;
|
|
|
- const tContLen = strGbLen(tCont) / 2;
|
|
|
- dataArr.push({
|
|
|
- type: 'text',
|
|
|
- option: {
|
|
|
- x: area.x + area.w - Math.ceil(tContLen * trackTextFontSize),
|
|
|
- y: area.y,
|
|
|
- text: tCont,
|
|
|
- fontSize: trackTextFontSize,
|
|
|
- },
|
|
|
- });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 其他试题
|
|
@@ -818,30 +844,35 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- users.forEach((user, index) => {
|
|
|
- const content = `${user.prename}:${user.userName},评分:${user.score}`;
|
|
|
+ if (watermarkHasSubjectiveEvaluator) {
|
|
|
+ users.forEach((user, index) => {
|
|
|
+ const content = `${user.prename}:${user.userName},评分:${user.score}`;
|
|
|
+ dataArr.push({
|
|
|
+ type: 'text',
|
|
|
+ option: {
|
|
|
+ x: area.x,
|
|
|
+ y: area.y + index * trackInfoLineHeight,
|
|
|
+ text: content,
|
|
|
+ fontSize: trackInfoFontSize,
|
|
|
+ color: user.color,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ if (watermarkHasSubjective) {
|
|
|
+ const tCont = `得分:${question.markerScore},满分:${question.maxScore}`;
|
|
|
+ const tContLen = strGbLen(tCont) / 2;
|
|
|
dataArr.push({
|
|
|
type: 'text',
|
|
|
option: {
|
|
|
- x: area.x,
|
|
|
- y: area.y + index * trackInfoLineHeight,
|
|
|
- text: content,
|
|
|
- fontSize: trackInfoFontSize,
|
|
|
- color: user.color,
|
|
|
+ x: area.x + area.w - Math.ceil(tContLen * trackTextFontSize),
|
|
|
+ y: area.y,
|
|
|
+ text: tCont,
|
|
|
+ fontSize: trackTextFontSize,
|
|
|
},
|
|
|
});
|
|
|
- });
|
|
|
- const tCont = `得分:${question.markerScore},满分:${question.maxScore}`;
|
|
|
- const tContLen = strGbLen(tCont) / 2;
|
|
|
- dataArr.push({
|
|
|
- type: 'text',
|
|
|
- option: {
|
|
|
- x: area.x + area.w - Math.ceil(tContLen * trackTextFontSize),
|
|
|
- y: area.y,
|
|
|
- text: tCont,
|
|
|
- fontSize: trackTextFontSize,
|
|
|
- },
|
|
|
- });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
return dataList;
|
|
@@ -1047,7 +1078,8 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
// answer tag ----- start->
|
|
|
// 解析客观题答案展示位置
|
|
|
function paserRecogData(imageIndex: number): DrawTrackItem[] {
|
|
|
- if (!recogDatas.length || !recogDatas[imageIndex]) return [];
|
|
|
+ if (!watermarkHasObjective || !recogDatas.length || !recogDatas[imageIndex])
|
|
|
+ return [];
|
|
|
|
|
|
const recogData: PaperRecogData = JSON.parse(
|
|
|
window.atob(recogDatas[imageIndex])
|
|
@@ -1097,7 +1129,7 @@ export default function useDraw(drawConfig: DrawConfig) {
|
|
|
function parseObjectiveAnswerTags(images: ImageItem[]) {
|
|
|
const objectiveAnswerTags: Array<ObjectiveAnswerTagItem[]> = [];
|
|
|
|
|
|
- if (!cardData?.length) return objectiveAnswerTags;
|
|
|
+ if (!watermarkHasObjective || !cardData?.length) return objectiveAnswerTags;
|
|
|
|
|
|
cardData.forEach((page, pindex) => {
|
|
|
if (!objectiveAnswerTags[pindex]) objectiveAnswerTags[pindex] = [];
|