|
@@ -291,17 +291,24 @@ const RotateClockwise90 = () => {
|
|
|
|
|
|
|
|
// 加载绘图数据
|
|
// 加载绘图数据
|
|
|
const LoadDrawData = () => {
|
|
const LoadDrawData = () => {
|
|
|
|
|
+
|
|
|
|
|
+ console.log("加载模板绘图数据");
|
|
|
try {
|
|
try {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
const templateDataStr = localStorage.getItem('templateData')
|
|
const templateDataStr = localStorage.getItem('templateData')
|
|
|
- const usedCardTypeStr = localStorage.getItem('usedCardType')
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // const usedCardTypeStr = localStorage.getItem('usedCardType')
|
|
|
|
|
|
|
|
if (!templateDataStr) return
|
|
if (!templateDataStr) return
|
|
|
|
|
|
|
|
- const templateData = JSON.parse(templateDataStr)
|
|
|
|
|
- const usedCardType = usedCardTypeStr ? parseInt(usedCardTypeStr) : null
|
|
|
|
|
|
|
+ const templateData = JSON.parse(templateDataStr);
|
|
|
|
|
+
|
|
|
|
|
+ const usedCardType = 2;//默认三方卡
|
|
|
|
|
|
|
|
console.log('打印templateData模板信息', templateData)
|
|
console.log('打印templateData模板信息', templateData)
|
|
|
-
|
|
|
|
|
|
|
+ console.log('打印currentPageNo', currentPageNo)
|
|
|
|
|
+ console.log('打印answerData', props.answerData)
|
|
|
const currentTemplateItem = templateData.find(
|
|
const currentTemplateItem = templateData.find(
|
|
|
(item) => item.pageNum == currentPageNo.value
|
|
(item) => item.pageNum == currentPageNo.value
|
|
|
)
|
|
)
|
|
@@ -323,17 +330,19 @@ const LoadDrawData = () => {
|
|
|
console.error('解析 paperInfo 失败', e)
|
|
console.error('解析 paperInfo 失败', e)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (usedCardType == 1) {
|
|
|
|
|
- currentPageInfo.value = {
|
|
|
|
|
- width: paperInfo.width - 30,
|
|
|
|
|
- height: paperInfo.height - 25,
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ //选择题判分暂时没有系统卡 注释掉
|
|
|
|
|
+ // if (usedCardType == 1) {
|
|
|
|
|
+ // currentPageInfo.value = {
|
|
|
|
|
+ // width: paperInfo.width - 30,
|
|
|
|
|
+ // height: paperInfo.height - 25,
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
if (currentTemplateItem.examCardGroupVOS) {
|
|
if (currentTemplateItem.examCardGroupVOS) {
|
|
|
- const list = currentTemplateItem.examCardGroupVOS.filter(
|
|
|
|
|
- (item) => item.blockArea == 8
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ // const list = currentTemplateItem.examCardGroupVOS.filter(
|
|
|
|
|
+ // (item) => item.blockArea == 8
|
|
|
|
|
+ // )
|
|
|
|
|
+ const list = currentTemplateItem.examCardGroupVOS;//无需过滤 都是客观题的数据
|
|
|
|
|
|
|
|
list.forEach((item) => {
|
|
list.forEach((item) => {
|
|
|
if (item.position) {
|
|
if (item.position) {
|
|
@@ -350,77 +359,42 @@ const LoadDrawData = () => {
|
|
|
|
|
|
|
|
if (item.groupTopicList) {
|
|
if (item.groupTopicList) {
|
|
|
item.groupTopicList.forEach((topic) => {
|
|
item.groupTopicList.forEach((topic) => {
|
|
|
- const answerValue = props.answerData[topic.topicName]
|
|
|
|
|
-
|
|
|
|
|
|
|
+ const answerValue = props.answerData[topic.topicName];//答案
|
|
|
|
|
+ console.log('answerValue',answerValue)
|
|
|
|
|
+ // 关键修改:使用深拷贝确保是纯JavaScript对象
|
|
|
|
|
+ let answerList = JSON.parse(JSON.stringify(JSON.parse(topic.optionJsons)));
|
|
|
|
|
+
|
|
|
|
|
+ // 为每个答案项显式添加 isCheck 属性
|
|
|
|
|
+ answerList.forEach(answer => {
|
|
|
|
|
+ answer.isCheck = false;
|
|
|
|
|
+ });
|
|
|
|
|
+ console.log("打印answerList",answerList);
|
|
|
if (answerValue) {
|
|
if (answerValue) {
|
|
|
const answerLetters = answerValue.match(/[A-Za-z]/g) || []
|
|
const answerLetters = answerValue.match(/[A-Za-z]/g) || []
|
|
|
-
|
|
|
|
|
|
|
+ console.log('answerLetters',answerLetters)
|
|
|
answerLetters.forEach((letter) => {
|
|
answerLetters.forEach((letter) => {
|
|
|
let answerIndex = GetAnswerIndexToLetter(letter)
|
|
let answerIndex = GetAnswerIndexToLetter(letter)
|
|
|
-
|
|
|
|
|
- if (topic.topicType == 3) {
|
|
|
|
|
- answerIndex = GetAnswerIndexToLetterTF(letter)
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (answerIndex !== -1 && answerList[answerIndex]) {
|
|
|
|
|
+ answerList[answerIndex].isCheck = true;
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log("❌ 设置失败! answerIndex:", answerIndex, "answerList长度:", answerList.length);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- if (answerIndex !== -1 && topic.answerList[answerIndex]) {
|
|
|
|
|
- topic.answerList[answerIndex].isCheck = true
|
|
|
|
|
- }
|
|
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ let topiclistObj={
|
|
|
|
|
+ answerList:answerList,
|
|
|
|
|
+ index:topic.index,
|
|
|
|
|
+ topicName:topic.topicName,
|
|
|
|
|
+ topicType:1,//1单选 2多选 3判断
|
|
|
|
|
+ };
|
|
|
|
|
+ topiclist.push(topiclistObj);
|
|
|
})
|
|
})
|
|
|
- topiclist = item.groupTopicList
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const obj = {
|
|
|
|
|
- x: position.x,
|
|
|
|
|
- y: position.y,
|
|
|
|
|
- w: position.w,
|
|
|
|
|
- h: position.h,
|
|
|
|
|
- position: item.position,
|
|
|
|
|
- blockArea: item.blockArea,
|
|
|
|
|
- page: currentPageNo.value,
|
|
|
|
|
- blockName: item.name,
|
|
|
|
|
- id: item.groupId,
|
|
|
|
|
- unit: unit,
|
|
|
|
|
- usedCardType: usedCardType,
|
|
|
|
|
- areaOption: item.groupConfig,
|
|
|
|
|
- topiclist: topiclist,
|
|
|
|
|
- }
|
|
|
|
|
- drawList.push(obj)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
-
|
|
|
|
|
- const list2 = currentTemplateItem.examCardGroupVOS.filter(
|
|
|
|
|
- (item) => item.blockArea == 9
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- list2.forEach((item) => {
|
|
|
|
|
- if (item.position) {
|
|
|
|
|
- let position = {}
|
|
|
|
|
- try {
|
|
|
|
|
- position = JSON.parse(item.position)
|
|
|
|
|
- } catch (e) {
|
|
|
|
|
- console.error('解析 position 失败', e)
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const unit = 'px'
|
|
|
|
|
- let topiclist = []
|
|
|
|
|
-
|
|
|
|
|
- if (item.groupTopicList) {
|
|
|
|
|
- item.groupTopicList.forEach((topic) => {
|
|
|
|
|
- const answerValue = props.answerData[topic.topicName]
|
|
|
|
|
-
|
|
|
|
|
- if (answerValue !== undefined && answerValue !== null) {
|
|
|
|
|
- if (!isNaN(answerValue) && answerValue !== '') {
|
|
|
|
|
- const answerIndex = answerValue - 1
|
|
|
|
|
- if (answerIndex >= 0 && topic.answerList[answerIndex]) {
|
|
|
|
|
- topic.answerList[answerIndex].isCheck = true
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- topiclist = item.groupTopicList
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const obj = {
|
|
const obj = {
|
|
@@ -441,8 +415,6 @@ const LoadDrawData = () => {
|
|
|
drawList.push(obj)
|
|
drawList.push(obj)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- console.log('打印选做题drawList', drawList)
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
currentDrawData.value = drawList
|
|
currentDrawData.value = drawList
|