|
@@ -220,9 +220,9 @@ export default {
|
|
getCachePaperInfo(paperData, cacheFields = []) {
|
|
getCachePaperInfo(paperData, cacheFields = []) {
|
|
let cachePaperInfo = {};
|
|
let cachePaperInfo = {};
|
|
paperData.forEach((detail, dIndex) => {
|
|
paperData.forEach((detail, dIndex) => {
|
|
- detail.questionInfo.forEach((question) => {
|
|
|
|
|
|
+ detail.questionInfo.forEach((question, qIndex) => {
|
|
let info = {};
|
|
let info = {};
|
|
- let k = `${dIndex + 1}_${question.number}`;
|
|
|
|
|
|
+ let k = `${dIndex + 1}_${qIndex + 1}`;
|
|
if (cacheFields.length) {
|
|
if (cacheFields.length) {
|
|
cacheFields.forEach((field) => {
|
|
cacheFields.forEach((field) => {
|
|
info[field] = question[field];
|
|
info[field] = question[field];
|
|
@@ -232,6 +232,22 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
cachePaperInfo[k] = info;
|
|
cachePaperInfo[k] = info;
|
|
|
|
+
|
|
|
|
+ if (question.subQuestions && question.subQuestions.length) {
|
|
|
|
+ question.subQuestions.forEach((subq, subqIndex) => {
|
|
|
|
+ let info = {};
|
|
|
|
+ let k = `${dIndex + 1}_${qIndex + 1}_${subqIndex + 1}`;
|
|
|
|
+ if (cacheFields.length) {
|
|
|
|
+ cacheFields.forEach((field) => {
|
|
|
|
+ info[field] = subq[field];
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ info = { ...subq };
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ cachePaperInfo[k] = info;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
});
|
|
});
|
|
});
|
|
});
|
|
// console.log(cachePaperInfo);
|
|
// console.log(cachePaperInfo);
|
|
@@ -239,11 +255,16 @@ export default {
|
|
},
|
|
},
|
|
assignCachePaperData(paperData, cacheData) {
|
|
assignCachePaperData(paperData, cacheData) {
|
|
return paperData.map((detail, dIndex) => {
|
|
return paperData.map((detail, dIndex) => {
|
|
- detail.questions = detail.questions.map((question) => {
|
|
|
|
- return this.mergeObjData(
|
|
|
|
- question,
|
|
|
|
- cacheData[`${dIndex + 1}_${question.number}`] || {}
|
|
|
|
- );
|
|
|
|
|
|
+ detail.questions = detail.questions.map((question, qIndex) => {
|
|
|
|
+ let k = `${dIndex + 1}_${qIndex + 1}`;
|
|
|
|
+ let nq = this.mergeObjData(question, cacheData[k] || {});
|
|
|
|
+ if (question.subQuestions && question.subQuestions.length) {
|
|
|
|
+ nq.subQuestions = question.subQuestions.map((subq, subqIndex) => {
|
|
|
|
+ let k = `${dIndex + 1}_${qIndex + 1}_${subqIndex + 1}`;
|
|
|
|
+ return this.mergeObjData(subq, cacheData[k] || {});
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return nq;
|
|
});
|
|
});
|
|
return detail;
|
|
return detail;
|
|
});
|
|
});
|