闫增涛
2024-05-22 a820b8ea4e0049754f8a7b98e234668991c711ed
Merge branch 'master' of http://182.92.203.7:2001/r/testbookLayout
9个文件已修改
2个文件已添加
338 ■■■■■ 已修改文件
.env 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env.product 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/config.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/js/middleGround/tool.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/methods/examination.js 81 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/methods/resources.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/childHealth/assets/examinationList.js 208 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/books/content/js/examinationList.js 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/plugin/axios/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.env
New file
@@ -0,0 +1,3 @@
VUE_APP_ENV = 'dev'
VUE_APP_API_URL = "https://jsek.bnuic.com"
PUBLIC_PATH = '/books/book'
.env.product
New file
@@ -0,0 +1,3 @@
VUE_APP_ENV = 'product'
VUE_APP_API_URL = "https://jsek.bnuic.com"
PUBLIC_PATH = 'http://182.92.203.7:3007/books/book'
package.json
@@ -1,10 +1,10 @@
{
  "name": "temp-book",
  "version": "0.1.0",
  "name": "testbook",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "serve": "vue-cli-service serve --mode dev",
    "build": "vue-cli-service build --mode product",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
src/assets/js/config.js
@@ -1,6 +1,5 @@
import axios from "axios";
export const requestCtx = "https://jsek.bnuic.com"; // 请求地址
export const resourceCtx = "http://182.92.203.7:3007/books/resource/3"; // 资源请求地址
export const resourceCtx = "http://182.92.203.7:3007/books/resource/1"; // 资源请求地址
export let activeBook = {}; // 资源请求地址
export let goodsStore = "";
// 请求教材配置信息
@@ -15,7 +14,6 @@
export const tokenKey = "jsek-token";
const config = {
  requestCtx,
  resourceCtx,
  activeBook,
  requestTimeOut,
src/assets/js/middleGround/tool.js
@@ -1,6 +1,5 @@
import { requestCtx, appId } from "@/assets/js/config.js";
import {  appId } from "@/assets/js/config.js";
import defaultImg from "@/assets/images/default-book-img.png";
import defaultBookFair from "@/assets/images/default-bookFair.png"
import bookCover from "@/assets/images/book-cover.png";
import moment from "moment";
// 处理列表查询结果
@@ -420,7 +419,7 @@
export function getPublicImage(md5, width, height,storeInfo) {
  let src = null;
  if (md5) {
    src = requestCtx + `/file/GetPreViewImage?md5=${md5}`;
    src = process.env.VUE_APP_API_URL + `/file/GetPreViewImage?md5=${md5}`;
  } else {
    if(storeInfo == 'jsek_bookFair') {
      // return defaultBookFair;
src/assets/methods/examination.js
@@ -1,35 +1,35 @@
import { activeBook } from "@/assets/js/config";
import MG from "@/assets/js/middleGround/WebMiddleGroundApi";
import getPublicImage from "@/assets/js/middleGround/tool";
const getQuestionList = async (oldList,questionList) => {
const getQuestionList = async (oldList, questionList) => {
  let cardList = [
    {
      catalogName: "单选题",
      infoList: [],
      infoList: []
    },
    {
      catalogName: "判断题",
      infoList: [],
      infoList: []
    },
    {
      catalogName: "多选题",
      infoList: [],
      infoList: []
    },
    {
      catalogName: "填空题",
      infoList: [],
      infoList: []
    },
    {
      catalogName: "简答题",
      infoList: [],
    },
      infoList: []
    }
  ];
  let singleChoiceArr = []; // 单选
  let judgeArr = []; // 判断
  let shortArr = []; // 简答
  let multipleChoiceArr = []; // 多选
  let completionArr = []; // 填空
  console.log('active',activeBook);
  console.log("active", activeBook);
  for (let qindex = 0; qindex < questionList.length; qindex++) {
    const qitem = questionList[qindex];
    let query = {
@@ -48,14 +48,14 @@
        Embedded_QuestionBank_StemStyle: [],
        Embedded_QuestionBank_OptionStyle: [],
        Embedded_QuestionBank_KnowledgePoint: [],
        Embedded_QuestionBank_Difficulty: [],
      },
        Embedded_QuestionBank_Difficulty: []
      }
    };
    const res = await MG.store.getProductDetail(query);
    res.datas.cmsDatas[0].datas.forEach((item, index) => {
      let oldObj = {}
      if(oldList) {
        oldObj = oldList.find(item => item.id == qitem)
      let oldObj = {};
      if (oldList) {
        oldObj = oldList.find((item) => item.id == qitem);
      }
      const questionObj = {
        number: index + 1, // 题号
@@ -77,16 +77,17 @@
        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"
            ? []
            : "",
        userAnswer: oldObj
          ? oldObj.userAnswer
          : item.Embedded_QuestionBank_QuestionType == "completion" ||
            item.Embedded_QuestionBank_QuestionType == "multipleChoice"
          ? []
          : "",
        isSubmit: false, // 查看解析
        isRight: null, // 是否正确
        isComplete: false,
        isCollect: true,
        isUnfold: "",
        isUnfold: ""
      };
      // 多选和填空答案肯为数组,要转换JSON格式
      if (
@@ -107,7 +108,7 @@
          if (item == "input") {
            questionObj.stem[i] = {
              num: index,
              data: "input",
              data: "input"
            };
            questionObj.userAnswer[index] = "";
            index++;
@@ -142,7 +143,7 @@
            '<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");
          .replace("../file", process.env.VUE_APP_API_URL + "/file");
      }
      // 选项富文本处理
      if (
@@ -156,7 +157,7 @@
            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");
              .replace("../file", process.env.VUE_APP_API_URL + "/file");
        });
      }
      // 解析富文本处理
@@ -183,9 +184,7 @@
      } else if (item.Embedded_QuestionBank_QuestionType == "singleChoice") {
        questionObj.type = "单选题";
        singleChoiceArr.push(questionObj);
      } else if (
        item.Embedded_QuestionBank_QuestionType == "multipleChoice"
      ) {
      } else if (item.Embedded_QuestionBank_QuestionType == "multipleChoice") {
        questionObj.type = "多选题";
        multipleChoiceArr.push(questionObj);
      } else if (item.Embedded_QuestionBank_QuestionType == "completion") {
@@ -197,11 +196,11 @@
      }
    });
  }
  cardList[0].infoList = singleChoiceArr
  cardList[1].infoList = judgeArr
  cardList[2].infoList = multipleChoiceArr
  cardList[3].infoList = completionArr
  cardList[4].infoList = shortArr
  cardList[0].infoList = singleChoiceArr;
  cardList[1].infoList = judgeArr;
  cardList[2].infoList = multipleChoiceArr;
  cardList[3].infoList = completionArr;
  cardList[4].infoList = shortArr;
  for (let index = 0; index < cardList.length; index++) {
    const item = cardList[index];
    for (let cindex = 0; cindex < item.infoList.length; cindex++) {
@@ -209,23 +208,23 @@
      citem.number = cindex + 1;
    }
  }
  return cardList.filter(item=>item.infoList.length > 0);
  return cardList.filter((item) => item.infoList.length > 0);
};
const getQuestionData = async (chapter,chapterData) => {
const getQuestionData = async (chapter, chapterData) => {
  const data = { ...chapterData };
  const oldAnswerData =  localStorage.getItem('oldAnswerData')
  const oldData = oldAnswerData ? JSON.parse(oldAnswerData) :{}
  let oldChapterData
  if(oldData) {
    oldChapterData = oldData[chapter]
  const oldAnswerData = localStorage.getItem("oldAnswerData");
  const oldData = oldAnswerData ? JSON.parse(oldAnswerData) : {};
  let oldChapterData;
  if (oldData) {
    oldChapterData = oldData[chapter];
  }
  for (let key in chapterData) {
    let oldList = []
    if(oldChapterData) {
      oldList = oldChapterData[key]
    let oldList = [];
    if (oldChapterData) {
      oldList = oldChapterData[key];
    }
    data[key] = await getQuestionList(oldList,chapterData[key]);
    data[key] = await getQuestionList(oldList, chapterData[key]);
  }
  return data;
};
src/assets/methods/resources.js
@@ -1,6 +1,5 @@
import config from "../js/config"
const getResourcePath = (md5) => {
  return  config.requestCtx + '/file/api/ApiDownload?md5=' + md5
  return  process.env.VUE_APP_API_URL + '/file/api/ApiDownload?md5=' + md5
}
export default getResourcePath
src/books/childHealth/assets/examinationList.js
@@ -1,147 +1,193 @@
  const testData =  {
const testData = {
  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:[
    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:[
    42_1: [
      65944, 65945, 65946, 65947, 65948, 65949, 65950, 65951, 65952, 65953,
      65954, 65955, 65956, 65957, 65958, 65959
    ],
  42_2:[
    42_2: [
      65962, 65963, 65964, 65965, 65966, 65967, 65968, 65969, 65970, 65971,
      65972, 65973, 65974, 65975, 65976, 65977
    ]
  },
  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]
  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],
  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:[
    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:[
  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:[
    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:[
  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:[
    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:[
  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:[
    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:[
  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:[
    209_1: [
      66303, 66304, 66305, 66306, 66307, 66308, 66309, 66310, 66311, 66312,
      66323, 66324, 66325, 66326, 66327, 66328
    ],
    209_2:[
    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:[
  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:[
    232: [66356, 66357, 66358],
    234_1: [
      66363, 66364, 66365, 66366, 66367, 66368, 66369, 66370, 66371, 66372,
      66383, 66384, 66385, 66386, 66387, 66388
    ],
    234_2:[
    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]
  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]
  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
    ]
  },
  11:{
    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],
  11: {
    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
    ]
  }
}
};
export default testData
export default testData;
src/books/content/js/examinationList.js
@@ -1,7 +1,7 @@
  const testData =  {
const testData = {
  1: {
    9: [66984,66985,66986],
  },
}
    9: [66984, 66985, 66986]
  }
};
export default testData
export default testData;
src/plugin/axios/index.js
@@ -3,7 +3,7 @@
// import toolClass from '@/assets/js/toolClass.js'
// 创建 axios 实例
const service = axios.create({
  baseURL: myConfig.requestCtx,
  baseURL: process.env.VUE_APP_API_URL,
  timeout: myConfig.requestTimeOut // 请求超时时间
})
vue.config.js
@@ -1,7 +1,6 @@
const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  // publicPath: 'http://182.92.203.7:3007/books/book/3',
  publicPath:'/books/book',
  publicPath: process.env.PUBLIC_PATH,
  transpileDependencies: true,
  lintOnSave: false,
  // devServer: {
@@ -19,8 +18,8 @@
    output: {
      library: `app-content`,
      libraryTarget: "umd",
      chunkLoadingGlobal: `webpackJsonp_app-content`,
    },
      chunkLoadingGlobal: `webpackJsonp_app-content`
    }
  },
  chainWebpack: (config) => {
    config.module
@@ -32,8 +31,8 @@
      .loader("change-prefix-loader")
      .options({
        prefix: "el-",
        replace: "gp-",
        replace: "gp-"
      })
      .end();
  },
  }
});