闫增涛
2024-05-14 3b9668925cee7a1fd371a5c36e9c149c6ea6346c
题目
6个文件已修改
1个文件已添加
9884 ■■■■ 已修改文件
package-lock.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/methods/examination.js 152 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/assets/examinationList.json 417 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/view/content/components/chapter001.vue 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/view/content/index.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/view/index.vue 307 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
yarn.lock 8972 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
@@ -11,6 +11,7 @@
        "axios": "^1.6.8",
        "core-js": "^3.8.3",
        "element-ui": "^2.15.14",
        "lodash": "^4.17.21",
        "moment": "^2.30.1",
        "qiankun": "^2.10.16",
        "spark-md5": "^3.0.2",
src/assets/methods/examination.js
New file
@@ -0,0 +1,152 @@
import {activeBook} from '@/assets/js/config'
import MG from '@/assets/js/middleGround/WebMiddleGroundApi'
 const getQuestionList = (rootCmsItemId,questionList) => {
  let cardList = [
  ];
  let query = {
    path: '*',
    cmsPath: rootCmsItemId,
    cmsType: '*',
    productId: activeBook.bookId,
    queryType: '*',
    itemIds: questionList.map((item) => item + ''),
    itemFields: {
      Embedded_QuestionBank_Stem: [],
      Embedded_QuestionBank_AnalysisCon: [],
      Embedded_QuestionBank_Answer: [],
      Embedded_QuestionBank_Option: [],
      Embedded_QuestionBank_QuestionType: [],
      Embedded_QuestionBank_StemStyle: [],
      Embedded_QuestionBank_OptionStyle: [],
      Embedded_QuestionBank_KnowledgePoint: [],
      Embedded_QuestionBank_Difficulty: []
    }
  }
  MG.store.getProductDetail(query).then((res) => {
    console.log('题目列表',res);
    // res.datas.cmsDatas[0].datas.forEach((item, index) => {
    //   let oldObj = "";
    //   if (oldList)
    //     oldObj = oldList.find((oldItem) => oldItem.id == item.id);
    //   let questionObj = {
    //     // num: index, // 题号
    //     id: item.id,
    //     type: pathitem.name,
    //     stem:
    //       item.Embedded_QuestionBank_QuestionType == "completion"
    //         ? JSON.parse(item.Embedded_QuestionBank_Stem)
    //             .stemTxt.replaceAll("<vacancy>", ",input,")
    //             .split(",")
    //         : JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
    //     answer: item.Embedded_QuestionBank_Answer, // 答案
    //     option: item.Embedded_QuestionBank_Option
    //       ? JSON.parse(item.Embedded_QuestionBank_Option)
    //       : "", // 选择题选项
    //     analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析
    //     questionType: item.Embedded_QuestionBank_QuestionType, // 题型
    //     optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型
    //     stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型
    //     difficulty: item.Embedded_QuestionBank_Difficulty
    //       ? 4 - item.Embedded_QuestionBank_Difficulty
    //       : 0, // 难度等级
    //     userAnswer: oldObj
    //       ? oldObj.userAnswer
    //       : item.Embedded_QuestionBank_QuestionType == "completion" ||
    //         item.Embedded_QuestionBank_QuestionType == "multipleChoice"
    //       ? []
    //       : "",
    //     isUserAnswer: oldObj
    //       ? this.isHaveAnswer(oldObj.userAnswer)
    //       : false,
    //     isRight: oldObj ? oldObj.isRight : null,
    //     isComplete: oldObj ? oldObj.isComplete : false,
    //     isCollect: false,
    //     isUnfold: "", // 控制解析的折叠面板是否展开
    //   };
    //   // 多选和填空答案肯为数组,要转换JSON格式
    //   if (
    //     questionObj.questionType == "completion" ||
    //     questionObj.questionType == "multipleChoice"
    //   ) {
    //     try {
    //       questionObj.answer = JSON.parse(questionObj.answer).toString();
    //     } catch (error) {
    //       questionObj.answer = item.Embedded_QuestionBank_Answer;
    //     }
    //   }
    //   // 填空题改造
    //   if (questionObj.questionType == "completion") {
    //     let index = 0;
    //     for (let i = 0; i < questionObj.stem.length; i++) {
    //       const item = questionObj.stem[i];
    //       if (item == "input") {
    //         questionObj.stem[i] = {
    //           num: index,
    //           data: "input",
    //         };
    //         if (!oldObj) questionObj.userAnswer[index] = "";
    //         index++;
    //       }
    //     }
    //   }
    //   // 题干富文本处理
    //   if (questionObj.stemStyle == "RichText") {
    //     // questionObj.option.txt = ''
    //     questionObj.stem.stemTxt = questionObj.stem.stemTxt
    //       .replace(
    //         /\<img/gi,
    //         '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
    //       )
    //       .replace(/\<p/gi, '<p class="stem-rich-p"')
    //       .replace("../file", app.config.requestCtx + "/file");
    //   }
    //   // 选项富文本处理
    //   if (
    //     questionObj.optionStyle == "RichText" &&
    //     (questionObj.questionType == "singleChoice" ||
    //       questionObj.questionType == "judge" ||
    //       questionObj.questionType == "multipleChoice")
    //   ) {
    //     questionObj.option.forEach((item) => {
    //       if (item.txt)
    //         item.txt = item.txt
    //           .replace(/\<img/gi, '<img class="option-rich-img"')
    //           .replace(/\<p/gi, '<p class="stem-rich-p"')
    //           .replace("../file", app.config.requestCtx + "/file");
    //     });
    //   }
    //   // 解析富文本处理
    //   if (
    //     questionObj.analysisCon &&
    //     typeof questionObj.analysisCon == "string"
    //   ) {
    //     questionObj.analysisCon = questionObj.analysisCon.replace(
    //       /\<img/gi,
    //       '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
    //     );
    //   }
    //   if (
    //     questionObj.stemStyle == "Image" ||
    //     questionObj.stemStyle == "TxtAndImage"
    //   ) {
    //     questionObj.stem.stemImage = getPublicImage(
    //       questionObj.stem.stemImage,
    //       150
    //     );
    //   }
    //   if (
    //     questionObj.optionStyle == "Image" ||
    //     questionObj.optionStyle == "TxtAndImage"
    //   ) {
    //     questionObj.option.forEach((optionItem) => {
    //       if (optionItem.img)
    //         optionItem.img = getPublicImage(optionItem.img, 150);
    //     });
    //   }
    //   return cardList
    // });
  })
}
export default getQuestionList
src/books/childHealth/assets/examinationList.json
@@ -1,280 +1,145 @@
{
 {
  "1": {
    "2": [63795, 63796, 63797, 63798, 63804],
    ""
    "6":[65859, 65860, 65861, 65862],
    "9":[65863, 65864, 65865, 65866, 65867, 65868, 65869],
    "14":[65870, 65871, 65872, 65873, 65874],
    "19":[65875, 65876, 65877, 65878, 65879, 65880, 65881, 65882],
    "24":[65883, 65884, 65885, 65886],
    "26":[65887, 65888, 65889, 65890, 65891, 65892],
    "31":[65905, 65906, 65907, 65908, 65909],
    "40":[
      65910, 65911, 65912, 65913, 65914, 65915, 65916, 65917, 65918, 65919,
      65920
    ],
    "42-1":[
      65944, 65945, 65946, 65947, 65948, 65949, 65950, 65951, 65952, 65953,
      65954, 65955, 65956, 65957, 65958, 65959
    ],
    "42-2":[
      65962, 65963, 65964, 65965, 65966, 65967, 65968, 65969, 65970, 65971,
      65972, 65973, 65974, 65975, 65976, 65977
    ]
  },
  "专题一": [
    {
      "name": "云测试:人体概述",
      "ids": [63795, 63796, 63797, 63798, 63804]
    },
    {
      "name": "专题一 学习主题一",
      "ids": [65859, 65860, 65861, 65862]
    },
    {
      "name": "专题一 学习主题二",
      "ids": [65863, 65864, 65865, 65866, 65867, 65868, 65869]
    },
    {
      "name": "专题一 学习主题三",
      "ids": [65870, 65871, 65872, 65873, 65874]
    },
    {
      "name": "专题一 学习主题四",
      "ids": [65875, 65876, 65877, 65878, 65879, 65880, 65881, 65882]
    },
    {
      "name": "专题一 学习主题五、学习主题六",
      "ids": [65883, 65884, 65885, 65886]
    },
    {
      "name": "专题一 学习主题七",
      "ids": [65887, 65888, 65889, 65890, 65891, 65892]
    },
    {
      "name": "专题一 学习主题八",
      "ids": [65905, 65906, 65907, 65908, 65909]
    },
    {
      "name": "专题一 学习主题九",
      "ids": [
        65910, 65911, 65912, 65913, 65914, 65915, 65916, 65917, 65918, 65919,
        65920
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)1",
      "ids": [
        65944, 65945, 65946, 65947, 65948, 65949, 65950, 65951, 65952, 65953,
        65954, 65955, 65956, 65957, 65958, 65959
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)2",
      "ids": [
        65962, 65963, 65964, 65965, 65966, 65967, 65968, 65969, 65970, 65971,
        65972, 65973, 65974, 65975, 65976, 65977
      ]
    }
  ],
  "专题二": [
    {
      "name": "专题二 学习主题一",
      "ids": [65979, 65980, 65981]
    },
    {
      "name": "专题二 学习主题二",
      "ids": [65983, 65984]
    },
    {
      "name": "专题二 学习主题三",
      "ids": [65986, 65987]
    },
    {
      "name": "过关检测(资格考试模拟题)1",
      "ids": [
        65990, 65991, 65992, 65993, 65994, 65995, 65996, 65997, 65998, 65999,
        66000, 66001, 66002, 66003, 66004, 66005
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)2",
      "ids": [
        66008, 66009, 66010, 66011, 66012, 66013, 66014, 66015, 66016, 66017,
        66018, 66019, 66020, 66021, 66022, 66023
      ]
    }
  ],
  "专题三": [
    {
      "name": "专题三 学习主题一",
      "ids": [66025, 66026, 66027, 66028, 66029]
    },
    {
      "name": "专题三 学习主题二",
      "ids": [66031, 66032, 66033, 66034, 66035]
    },
    {
      "name": "专题三 学习主题三",
      "ids": [66037, 66038, 66039, 66040, 66041, 66042]
    },
    {
      "name": "过关检测(资格考试模拟题)1",
      "ids": [
        66051, 66052, 66053, 66054, 66055, 66056, 66057, 66058, 66059, 66060,
        66045, 66046, 66047, 66048, 66049, 66050
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)2",
      "ids": [
        66063, 66064, 66065, 66066, 66067, 66068, 66069, 66070, 66071, 66072,
        66073, 66074, 66075, 66076, 66077, 66078
      ]
    }
  ],
  "专题四": [
    {
      "name": "专题四 学习主题一",
      "ids": [66080, 66081, 66082]
    },
    {
      "name": "专题四 学习主题二",
      "ids": [66084, 66085]
    },
    {
      "name": "过关检测(资格考试模拟题)1",
      "ids": [
        66102, 66103, 66104, 66105, 66106, 66107, 66108, 66109, 66110, 66111,
        66090, 66091, 66092, 66093, 66094, 66095
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)2",
      "ids": [
        66112, 66113, 66114, 66115, 66116, 66117, 66118, 66119, 66120, 66121,
        66096, 66097, 66098, 66099, 66100, 66101
      ]
    }
  ],
  "专题五": [
    {
      "name": "专题五 学习主题一",
      "ids": [66125, 66126, 66127, 66128, 66129, 66130, 66131]
    },
    {
      "name": "专题五 学习主题二",
      "ids": [66134, 66135, 66136, 66137, 66138]
    },
    {
      "name": "专题五 学习主题三",
      "ids": [66144, 66145, 66146, 66147, 66148]
    },
    {
      "name": "专题五 学习主题四",
      "ids": [66150, 66151, 66152, 66153, 66154]
    },
    {
      "name": "过关检测(资格考试模拟题)1",
      "ids": [
        66159, 66160, 66161, 66162, 66163, 66164, 66165, 66166, 66167, 66168,
        66179, 66180, 66181, 66182, 66183, 66184
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)2",
      "ids": [
        66169, 66170, 66171, 66172, 66173, 66174, 66175, 66176, 66177, 66178,
        66185, 66186, 66187, 66188, 66189, 66190
      ]
    }
  ],
  "专题六": [
    {
      "name": "专题六 学习主题一",
      "ids": [66192, 66193, 66194, 66195, 66196]
    },
    {
      "name": "专题六 学习主题二",
      "ids": [66198, 66199, 66200, 66201, 66202]
    },
    {
      "name": "专题六 学习主题三",
      "ids": [66204, 66205, 66206, 66207, 66208]
    },
    {
      "name": "专题六 学习主题四",
      "ids": [66210, 66211, 66212]
    },
    {
      "name": "专题六 学习主题五",
      "ids": [66214, 66215, 66216, 66217, 66218]
    },
    {
      "name": "过关检测(资格考试模拟题)1",
      "ids": [
        66223, 66224, 66225, 66226, 66227, 66228, 66229, 66230, 66231, 66232,
        66243, 66244, 66245, 66246, 66247, 66248
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)2",
      "ids": [
        66233, 66234, 66235, 66236, 66237, 66238, 66239, 66240, 66241, 66242,
        66249, 66250, 66251, 66252, 66253, 66254
      ]
    }
  ],
  "专题七": [
    {
      "name": "专题七 学习主题一",
      "ids": [66261, 66262, 66263]
    },
    {
      "name": "专题七 学习主题二",
      "ids": [66265, 66266, 66267]
    },
    {
      "name": "专题七 学习主题三",
      "ids": [66269, 66270, 66271]
    },
    {
      "name": "专题七 学习主题四",
      "ids": [666273, 66274, 66275, 66276, 66277, 66278, 66279]
    },
    {
      "name": "专题七 学习主题五",
      "ids": [
        66287, 66288, 66289, 66290, 66291, 66292, 66293, 66294, 66295, 66296,
        66297, 66298
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)1",
      "ids": [
        66303, 66304, 66305, 66306, 66307, 66308, 66309, 66310, 66311, 66312,
        66323, 66324, 66325, 66326, 66327, 66328
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)2",
      "ids": [
        66313, 66314, 66315, 66316, 66317, 66318, 66319, 66320, 66321, 66322,
        66329, 66330, 66331, 66332, 66333, 66334
      ]
    }
  ],
  "专题八": [
    {
      "name": "专题八 学习主题一",
      "ids": [66336, 66337, 66338, 66339]
    },
    {
      "name": "专题八 学习主题二",
      "ids": [
        66341, 66342, 66343, 66344, 66345, 66346, 66347, 66348, 66349, 66350,
        66351, 66352, 66353, 66354
      ]
    },
    {
      "name": "专题八 学习主题三",
      "ids": [66356, 66357, 66358]
    },
    {
      "name": "过关检测(资格考试模拟题)1",
      "ids": [
        66363, 66364, 66365, 66366, 66367, 66368, 66369, 66370, 66371, 66372,
        66383, 66384, 66385, 66386, 66387, 66388
      ]
    },
    {
      "name": "过关检测(资格考试模拟题)2",
      "ids": [
        66373, 66374, 66375, 66376, 66377, 66378, 66379, 66380, 66381, 66382,
        66389, 66390, 66391, 66392, 66393, 66394
      ]
    }
  ],
  "专题九": []
  "2":{
    "46":[65979, 65980, 65981],
    "49":[65983, 65984],
    "52":[65986, 65987],
    "54-1":[65990, 65991, 65992, 65993, 65994, 65995, 65996, 65997, 65998, 65999,
    66000, 66001, 66002, 66003, 66004, 66005],
    "54-2":[66008, 66009, 66010, 66011, 66012, 66013, 66014, 66015, 66016, 66017,
    66018, 66019, 66020, 66021, 66022, 66023]
  },
  "3":{
    "64":[66025, 66026, 66027, 66028, 66029],
    "73":[66031, 66032, 66033, 66034, 66035],
    "78":[66037, 66038, 66039, 66040, 66041, 66042],
    "80-1": [
      66051, 66052, 66053, 66054, 66055, 66056, 66057, 66058, 66059, 66060,
      66045, 66046, 66047, 66048, 66049, 66050
    ],
    "80-2":[
      66063, 66064, 66065, 66066, 66067, 66068, 66069, 66070, 66071, 66072,
      66073, 66074, 66075, 66076, 66077, 66078
    ]
  },
  "4":{
    "91":[66080, 66081, 66082],
    "97":[66084, 66085],
    "98-1":[
      66102, 66103, 66104, 66105, 66106, 66107, 66108, 66109, 66110, 66111,
      66090, 66091, 66092, 66093, 66094, 66095
    ],
    "98-2":[
      66112, 66113, 66114, 66115, 66116, 66117, 66118, 66119, 66120, 66121,
      66096, 66097, 66098, 66099, 66100, 66101
    ]
  },
  "5":{
    "119":[66125, 66126, 66127, 66128, 66129, 66130, 66131],
    "124":[66134, 66135, 66136, 66137, 66138],
    "129":[66144, 66145, 66146, 66147, 66148],
    "133":[66150, 66151, 66152, 66153, 66154],
    "134-1":[
      66159, 66160, 66161, 66162, 66163, 66164, 66165, 66166, 66167, 66168,
      66179, 66180, 66181, 66182, 66183, 66184
    ],
    "134-2":[
      66169, 66170, 66171, 66172, 66173, 66174, 66175, 66176, 66177, 66178,
      66185, 66186, 66187, 66188, 66189, 66190
    ]
  },
  "6":{
    "142":[66192, 66193, 66194, 66195, 66196],
    "152":[66198, 66199, 66200, 66201, 66202],
    "156":[66204, 66205, 66206, 66207, 66208],
    "159":[66210, 66211, 66212],
    "164":[66214, 66215, 66216, 66217, 66218],
    "166-1":[
      66223, 66224, 66225, 66226, 66227, 66228, 66229, 66230, 66231, 66232,
      66243, 66244, 66245, 66246, 66247, 66248
    ],
    "166-2":[
      66233, 66234, 66235, 66236, 66237, 66238, 66239, 66240, 66241, 66242,
      66249, 66250, 66251, 66252, 66253, 66254
    ]
  },
  "7":{
    "169":[66261, 66262, 66263],
    "174":[66265, 66266, 66267],
    "177":[66269, 66270, 66271],
    "188":[666273, 66274, 66275, 66276, 66277, 66278, 66279],
    "207":[
      66287, 66288, 66289, 66290, 66291, 66292, 66293, 66294, 66295, 66296,
      66297, 66298
    ],
    "209-1":[
      66303, 66304, 66305, 66306, 66307, 66308, 66309, 66310, 66311, 66312,
      66323, 66324, 66325, 66326, 66327, 66328
    ],
    "209-2":[
      66313, 66314, 66315, 66316, 66317, 66318, 66319, 66320, 66321, 66322,
      66329, 66330, 66331, 66332, 66333, 66334
    ]
  },
  "8":{
    "215":[66336, 66337, 66338, 66339],
    "227":[
      66341, 66342, 66343, 66344, 66345, 66346, 66347, 66348, 66349, 66350,
      66351, 66352, 66353, 66354
    ],
    "232":[66356, 66357, 66358],
    "234-1":[
      66363, 66364, 66365, 66366, 66367, 66368, 66369, 66370, 66371, 66372,
      66383, 66384, 66385, 66386, 66387, 66388
    ],
    "234-2":[
      66373, 66374, 66375, 66376, 66377, 66378, 66379, 66380, 66381, 66382,
      66389, 66390, 66391, 66392, 66393, 66394
    ]
  },
  "9":{
    "243":[66396,66397,66398,66399,66400],
    "255":[66412,66413,66414,66415,66416],
    "256-1":[66418,66419,66420,66421,66422,66423,66424,66425,66426,66427,66438,66439,66440,66441,66442,66443],
    "256-2":[66428,66429,66430,66431,66432,66433,66434,66435,66436,66437,66402,66403,66404,66405,66406,66407]
  },
  "10":{
    "267":[66445,66446,66447,66448,66449,66450],
    "272":[66455,66456,66457,66458,66459],
    "273-1":[66469,66470,66471,66472,66473,66474,66475,66476,66477,66478,66502,66503,66504,66505,66506,66507],
    "273-2":[66479,66480,66481,66482,66483,66484,66485,66486,66487,66488,66495,66496,66497,66498,66499,66500]
  },
  "12":{
    "274-1":[66529,66530,66531,66532,66533,66534,66535,66536,66537,66538,66629,66630,66631,66632,66633,66634],
    "274-2":[66539,66540,66541,66542,66543,66544,66545,66546,66547,66548,66635,66636,66637,66638,66639,66640],
    "274-3":[66549,66550,66551,66552,66553,66554,66555,66556,66557,66558,66643,66644,66645,66646,66647,66648],
    "274-4":[66559,66560,66561,66562,66563,66564,66565,66566,66567,66568,66650,66651,66652,66653,66654,66655],
    "274-5":[66569,66570,66571,66572,66573,66574,66575,66576,66577,66578,66657,66658,66659,66660,66661,66662],
    "274-6":[66579,66580,66581,66582,66583,66584,66585,66586,66587,66588,66663,66664,66665,66666,66667,66668],
    "274-7":[66589,66590,66591,66592,66593,66594,66595,66596,66597,66598,66669,66670,66671,66672,66673,66674],
    "274-8":[66599,66600,66601,66602,66603,66604,66605,66606,66607,66608,66675,66676,66677,66678,66679,66680],
    "274-9":[66609,66610,66611,66612,66613,66614,66615,66616,66617,66618,66681,66682,66683,66684,66685,66686],
    "274-10":[66619,66620,66621,66622,66623,66624,66625,66626,66627,66628,66688,66689,66690,66691,66692,66693],
  }
}
src/books/childHealth/view/content/components/chapter001.vue
@@ -131,12 +131,9 @@
                  <span class="ds-bl"
                    >1.人体运动系统由哪三个部分组成?各部分的功能式什么?</span
                  >
                  <el-input
                    type="textarea"
                    :rows="3"
                    placeholder="请输入内容"
                    v-model="textarea">
                  </el-input>
                  <input type="text" class="lineInput w100" />
                  <input type="text" class="lineInput w100" />
                  <input type="text" class="lineInput w100" />
                  <span class="ds-bl mt-10"
                    >2.学前儿童的骨(骼)有什么特点?日常生活中应该如何保健?</span
                  >
@@ -2094,8 +2091,8 @@
          </p>
        </div>
        <div class="fl">
          <div class="left" style="width: 35%">
        <div class="fl fl-around">
          <div class="left" style="width: 38%">
            <p>
              人体各机能之所以能根据不同的内外环境产生特定的变化,维持内外环境的动态平衡,与内分泌系统有着密不可分的关系。
            </p>
@@ -2103,7 +2100,7 @@
              内分泌系统(见图1-13)由内分泌腺和内分泌组织组成,对人体的生命活动起着重
            </p>
          </div>
          <div class="right" style="width: 65%">
          <div class="right" style="width: 60%">
            <video
              :src=" config.resourceCtx + ' /video/chapterOne/endocrine.mp4'"
              poster="../../../assets/images/chapterOne/people-video-img.jpg"
src/books/childHealth/view/content/index.vue
@@ -48,8 +48,18 @@
      loadThreshold: 300, // 触发加载阈值
      throttleThreshold: 100, // 节流阈值
      previousScrollTop: 0,
      throttledScrollHandler: null
      throttledScrollHandler: null,
    };
  },
  watch: {
    showCatalogList: {
      handler(newVal) {
        console.log("显示章节", newVal);
        this.$store.state.qiankun.windowSelection({
          showCatalogList: newVal,
        });
      },
    },
  },
  mounted() {
    // 默认加载章节
@@ -63,7 +73,6 @@
  },
  methods: {
    scrollFun(e) {
      // 判断向上滚动还是向下滚动
      if (event.target.scrollTop > this.previousScrollTop) {
        console.log("向下滚动");
@@ -103,10 +112,11 @@
          }
        }
      }
      // showCatalogList 当前显示的三个章节,watch监听传递给主应用
      console.log(this.showCatalogList);
      // 更新上一次滚动的位置
      this.previousScrollTop = event.target.scrollTop;
    }
    },
  },
  components: {
    pageHeader,
@@ -122,8 +132,8 @@
    chapterTen,
    chapterEleven,
    chapterTwelve,
    chapterThirteen
  }
    chapterThirteen,
  },
};
</script>
src/books/childHealth/view/index.vue
@@ -6,7 +6,7 @@
<script>
import examinations from "./components/examinations/index.vue";
import { getPublicImage } from "@/assets/js/middleGround/tool";
import testData from '../assets/examinationList.json'
import pageContent from "./content/index.vue";
export default {
  name: "child-health",
@@ -16,6 +16,7 @@
  },
  data() {
    return {
      bookData:{},
      type: "option",
      idPathList: [],
      cardList: [],
@@ -65,308 +66,10 @@
        },
      };
      this.MG.store.getProductDetail(query).then((res) => {
        console.log("图书信息", res.datas.cmsDatas[0].datas);
        const testData = res.datas.cmsDatas[0].datas.find(
          (item) => item.refCode == "questionBank"
        );
        this.getResourceData(testData);
        console.log("图书信息",res.datas.cmsDatas[0].datas);
        this.$data.bookData =  res.datas.cmsDatas[0].datas
      });
    },
    getResourceData(type) {
      let query = {
        path: "*",
        queryType: "*",
        productId: this.config.bookId,
        cmsPath: type.productLinkPath,
        itemFields: {
          SysType: "CmsFolder",
          // 资源类型,试读文件,是否允许下载等参数
          selectType: [],
          freeFile: [],
          file: [],
          protectedFile: [],
          resourcesClassification: [],
          isDownload: [],
          jsek_resourceBrief: [],
          jsek_link: [],
          jsek_questionBank: [],
        },
        pading: {
          start: 0,
          size: 999,
        },
      };
      this.MG.store
        .getProductDetail(query)
        .then(async (res) => {
          if (type.refCode == "questionBank") {
            const data = res.datas.cmsDatas[0].datas.filter(
              (item) => item.refCode == "jsek_questionBank"
            );
            if (data.length) return this.getResourceData(data[0]);
          }
          if (type.refCode == "jsek_questionBank") {
            const testDataList = res.datas.cmsDatas[0].datas;
            if (testDataList.length > 0) {
              // console.log("题目列表", testDataList);
              this.$store.commit("setTestList", testDataList);
              // this.getIdPathList(testDataList[1])
            } else {
              console.log("暂无资源");
            }
          }
        })
        .catch((e) => {
          console.log(e);
        });
    },
    getIdPathList(data) {
      let query = {
        path: "*",
        queryType: "*",
        productId: this.config.bookId,
        cmsPath: data.productLinkPath,
        pading: {
          start: 0,
          size: 999,
        },
      };
      this.MG.store.getProductDetail(query).then((res) => {
        console.log("题目", res.datas.cmsDatas[0].datas);
        this.$data.idPathList = res.datas.cmsDatas[0].datas;
        this.getQuestionList();
      });
    },
    // 获取题库题目
    getQuestionList(oldData) {
      // 清空正确题数记录
      let flag = 0;
      for (let index = 0; index < this.$data.idPathList.length; index++) {
        const pathitem = this.$data.idPathList[index];
        const pathList = this.$data.cardList;
        pathList.push({
          path: pathitem.productLinkPath,
          catalogName: pathitem.name,
          infoList: [],
        });
        this.$data.cardList = pathList;
        // 获取题目
        let query = {
          path: "*",
          queryType: "*",
          productId: this.config.bookId,
          cmsPath: pathitem.productLinkPath,
          itemFields: {
            Embedded_QuestionBank_Stem: [],
            Embedded_QuestionBank_AnalysisCon: [],
            Embedded_QuestionBank_Answer: [],
            Embedded_QuestionBank_Option: [],
            Embedded_QuestionBank_QuestionType: [],
            Embedded_QuestionBank_StemStyle: [],
            Embedded_QuestionBank_OptionStyle: [],
            Embedded_QuestionBank_KnowledgePoint: [],
            Embedded_QuestionBank_Difficulty: [],
          },
          pading: {
            start: 0,
            size: 999,
          },
        };
        this.MG.store.getProductDetail(query).then((res) => {
          let oldList;
          if (oldData) {
            // 提交过,存在答题记录
            oldList = oldData.find(
              (item) => item.path == pathitem.productLinkPath
            ).infoList;
            this.setData({
              submitStatus: true,
            });
          }
          res.datas.cmsDatas[0].datas.forEach((item, index) => {
            let oldObj = "";
            if (oldList)
              oldObj = oldList.find((oldItem) => oldItem.id == item.id);
            let questionObj = {
              // num: index, // 题号
              id: item.id,
              type: pathitem.name,
              stem:
                item.Embedded_QuestionBank_QuestionType == "completion"
                  ? JSON.parse(item.Embedded_QuestionBank_Stem)
                      .stemTxt.replaceAll("<vacancy>", ",input,")
                      .split(",")
                  : JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
              answer: item.Embedded_QuestionBank_Answer, // 答案
              option: item.Embedded_QuestionBank_Option
                ? JSON.parse(item.Embedded_QuestionBank_Option)
                : "", // 选择题选项
              analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析
              questionType: item.Embedded_QuestionBank_QuestionType, // 题型
              optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型
              stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型
              difficulty: item.Embedded_QuestionBank_Difficulty
                ? 4 - item.Embedded_QuestionBank_Difficulty
                : 0, // 难度等级
              userAnswer: oldObj
                ? oldObj.userAnswer
                : item.Embedded_QuestionBank_QuestionType == "completion" ||
                  item.Embedded_QuestionBank_QuestionType == "multipleChoice"
                ? []
                : "",
              isUserAnswer: oldObj
                ? this.isHaveAnswer(oldObj.userAnswer)
                : false,
              isRight: oldObj ? oldObj.isRight : null,
              isComplete: oldObj ? oldObj.isComplete : false,
              isCollect: false,
              isUnfold: "", // 控制解析的折叠面板是否展开
            };
            // 多选和填空答案肯为数组,要转换JSON格式
            if (
              questionObj.questionType == "completion" ||
              questionObj.questionType == "multipleChoice"
            ) {
              try {
                questionObj.answer = JSON.parse(questionObj.answer).toString();
              } catch (error) {
                questionObj.answer = item.Embedded_QuestionBank_Answer;
              }
            }
            // 填空题改造
            if (questionObj.questionType == "completion") {
              let index = 0;
              for (let i = 0; i < questionObj.stem.length; i++) {
                const item = questionObj.stem[i];
                if (item == "input") {
                  questionObj.stem[i] = {
                    num: index,
                    data: "input",
                  };
                  if (!oldObj) questionObj.userAnswer[index] = "";
                  index++;
                }
              }
            }
            // 题干富文本处理
            if (questionObj.stemStyle == "RichText") {
              // questionObj.option.txt = ''
              questionObj.stem.stemTxt = questionObj.stem.stemTxt
                .replace(
                  /\<img/gi,
                  '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
                )
                .replace(/\<p/gi, '<p class="stem-rich-p"')
                .replace("../file", app.config.requestCtx + "/file");
            }
            // 选项富文本处理
            if (
              questionObj.optionStyle == "RichText" &&
              (questionObj.questionType == "singleChoice" ||
                questionObj.questionType == "judge" ||
                questionObj.questionType == "multipleChoice")
            ) {
              questionObj.option.forEach((item) => {
                if (item.txt)
                  item.txt = item.txt
                    .replace(/\<img/gi, '<img class="option-rich-img"')
                    .replace(/\<p/gi, '<p class="stem-rich-p"')
                    .replace("../file", app.config.requestCtx + "/file");
              });
            }
            // 解析富文本处理
            if (
              questionObj.analysisCon &&
              typeof questionObj.analysisCon == "string"
            ) {
              questionObj.analysisCon = questionObj.analysisCon.replace(
                /\<img/gi,
                '<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
              );
            }
            // 听力题修改
            // if (questionObj.questionType == 'singleChoice') {
            //   const src = this.extractSourceSrc(questionObj.stem.stemTxt)
            //   if (src) {
            //     questionObj.src = src
            //     questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
            //   }
            // }
            // 获取图片
            if (
              questionObj.stemStyle == "Image" ||
              questionObj.stemStyle == "TxtAndImage"
            ) {
              questionObj.stem.stemImage = getPublicImage(
                questionObj.stem.stemImage,
                150
              );
            }
            if (
              questionObj.optionStyle == "Image" ||
              questionObj.optionStyle == "TxtAndImage"
            ) {
              questionObj.option.forEach((optionItem) => {
                if (optionItem.img)
                  optionItem.img = getPublicImage(optionItem.img, 150);
              });
            }
            // 客观题总分赋值
            if (questionObj.questionType !== "shortAnswer") {
              // this.setData({
              //   subjectiveGrade: this.data.subjectiveGrade + 2,
              // });
            }
            // 旧数据里 题目正确 记录正确数量
            if (questionObj.isRight) {
              // this.setData({
              //   correctNum: this.data.correctNum + 1,
              // });
            }
            if (
              pathitem.name == "判断题" ||
              pathitem.name == "填空题" ||
              pathitem.name == "多选题" ||
              pathitem.name == "单选题" ||
              pathitem.name == "听力题"
            ) {
              if (oldObj) {
                // this.setData({
                //   subjectiveTotal: this.data.subjectiveTotal + 1,
                // });
              }
            }
            // cardList赋值
            let cardIndex = this.$data.cardList.findIndex(
              (item) => item.path == pathitem.productLinkPath
            );
            let infoList = this.$data.cardList[cardIndex].infoList;
            infoList.push(questionObj);
            // this.setData({
            //   [`cardList[${cardIndex}].infoList`]: infoList,
            // });
            this.$data.cardList[cardIndex].infoList = infoList;
            flag++;
            let questionList = [];
            let grade = 0;
            const cardUpdatedList = this.$data.cardList;
            // if (flag == this.data.idPathList.length) {
            cardUpdatedList.forEach((aitem) => {
              aitem.infoList.forEach((bitem, bindex) => {
                questionList.push(bitem);
                bitem.number = bindex + 1;
                bitem.score = 2;
              });
            });
            // this.setData({
            //   questionDataList: questionList,
            //   cardList: cardUpdatedList,
            // });
            this.$data.cardList = cardUpdatedList;
            console.log("题目呢", this.$data.cardList);
          });
        });
      }
    },
    getParentWithClass(element, className) {
      while (element.parentElement) {
yarn.lock
Diff too large