index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. <template>
  2. <div class="scroll_content">
  3. <div class="select_box">
  4. <el-radio-group v-model="errorType" size="medium" @change="_queryStudentErrorQuestion">
  5. <el-radio-button :label="-1">全部试题({{ allErrorCount }})</el-radio-button>
  6. <el-radio-button :label="0">未掌握({{ unMasterCount }})</el-radio-button>
  7. <el-radio-button :label="1">已掌握({{ masterCount }})</el-radio-button>
  8. <el-radio-button :label="2">复习题({{ reviewCount }})</el-radio-button>
  9. </el-radio-group>
  10. </div>
  11. <div class="content">
  12. <div class="right_btn" v-if="errorType !== 1">
  13. <el-button size="medium" @click="downloadDialogVisible = true; isVariation = 0">下载错题本</el-button>
  14. <el-button type="primary" size="medium"
  15. @click="downloadDialogVisible = true; isVariation = 1">下载个性化提升手册</el-button>
  16. </div>
  17. <Download :visible.sync="downloadDialogVisible" :examId="examId" :subjectCode="subjectCode"
  18. :isVariation="isVariation" />
  19. <template v-if="questionList.length > 0">
  20. <div v-for="(question, index) in questionList" :key="question.questionId">
  21. <div class="question_card">
  22. <div class="card_top">
  23. <div class="card_top_info">
  24. <div class="left">
  25. <span class="number mr_10">{{ countGlobalIndex(index + 1) }}</span>
  26. <span class="gray">试题类型:</span>
  27. <span class="black mr_10">{{ question.questionType }}</span>
  28. <span class="tag" v-if="question.classScoreRate < 40">高频错题</span>
  29. </div>
  30. </div>
  31. <div class="question_content line_height_20" v-if="question.sourceType === 1"
  32. v-html="question.questionData.questionStem"></div>
  33. <div class="question_content" v-if="question.sourceType === 2">
  34. <img :src="question.questionImg" alt="" width="100%">
  35. </div>
  36. <div class="card_footer">
  37. <div class="footer_item">
  38. <span class="gray">满分:</span>
  39. <span class="blue">{{ question.fullScore }}</span>
  40. <span class="gray">分</span>
  41. </div>
  42. <div class="footer_item">
  43. <span class="gray">我的得分:</span>
  44. <span class="blue">{{ question.score }}</span>
  45. <span class="gray">分</span>
  46. </div>
  47. <div class="footer_item">
  48. <span class="gray">难度:</span>
  49. <span style="font-weight: bold;" :class="countDiffcutyClass(question.difficulty)">
  50. {{ question.difficulty }}
  51. </span>
  52. </div>
  53. </div>
  54. </div>
  55. <div class="card_buttom">
  56. <div class="btn_box">
  57. <span class="black" :class="{ blue: question.answerShow }" size="small"
  58. @click="ShowAnserAndParse(1, question);">
  59. <i class="iconfont icon_daan"></i>
  60. 我的答案
  61. <i class="answerShow_content" v-if="question.answerShow && !question.parseShow"></i>
  62. </span>
  63. <span class="black" :class="{ blue: question.parseShow }" size="small"
  64. @click="ShowAnserAndParse(2, question);">
  65. <i class="iconfont icon_jiexi"></i>
  66. 查看解析
  67. <i class="parseShow_content" v-if="question.parseShow && !question.answerShow"></i>
  68. </span>
  69. <template v-if="question.errorStatus === 0">
  70. <template v-if="errorType === -1 || errorType === 0">
  71. <span class="black" size="small"
  72. @click="_markStudentErrorQuestion(question, 1)">
  73. <i class="iconfont icon_biaojiyizhangwo"></i>
  74. 标记为已掌握
  75. </span>
  76. <span class="black" size="small"
  77. @click="_markStudentErrorQuestion(question, 2)">
  78. <i class="iconfont icon_jiarufuxiben"></i>
  79. 加入复习本
  80. </span>
  81. </template>
  82. </template>
  83. <template v-if="errorType === 1 || question.errorStatus === 1">
  84. <span class="black" size="small" @click="_markStudentErrorQuestion(question, 0)">
  85. <i class="iconfont icon_biaojiweizhangwo"></i>
  86. 标记为未掌握
  87. </span>
  88. </template>
  89. <template v-if="errorType === 2 || question.errorStatus === 2">
  90. <span class="black" size="small" @click="_markStudentErrorQuestion(question, 0)">
  91. <i class="iconfont icon_yichufuxiben"></i>
  92. 移除复习本
  93. </span>
  94. </template>
  95. </div>
  96. <div class="content" v-if="question.parseShow && !question.answerShow">
  97. <div class="flex">
  98. <div class="flex_left" style="line-height: 28px;">知识点:</div>
  99. <div class="flex_right">
  100. <template v-if="question.knowledgePoint && question.knowledgePoint.length > 0">
  101. <KnowledgePoint v-for="(know, index) in question.knowledgePoint"
  102. :key="index" :text="know" />
  103. </template>
  104. </div>
  105. </div>
  106. <div class="flex">
  107. <div class="flex_left">答&nbsp;&nbsp;&nbsp;&nbsp;案:</div>
  108. <div class="flex_right">
  109. <div v-if="question.sourceType === 1" v-html="question.questionData.answer">
  110. </div>
  111. <div v-if="question.sourceType === 2">
  112. <img :src="question.answerImg" alt="" width="100%" />
  113. </div>
  114. </div>
  115. </div>
  116. <div class="flex">
  117. <div class="flex_left">解&nbsp;&nbsp;&nbsp;&nbsp;析:</div>
  118. <div class="flex_right">
  119. <div style="line-height: 1.5;" v-show="question.sourceType === 1"
  120. v-html="question.questionData.analysis">
  121. </div>
  122. <div v-if="question.sourceType === 2">
  123. <img :src="question.parseImg" alt="" width="100%" />
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <div class="content" v-if="question.answerShow && !question.parseShow">
  129. <div class="content_inner" v-if="question.sourceType === 1"
  130. v-html="question.studentAnswer"></div>
  131. <div class="content_inner" v-if="question.sourceType === 2">
  132. <img :src="question.studentAnswerImg" alt="" width="100%" />
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. <!-- 变式题推送 -->
  138. <div class="question_card" v-if="question.variationQuestion">
  139. <div class="card_top">
  140. <div class="card_top_info">
  141. <div class="left">
  142. <span class="number mr_10"
  143. :class="countLevel(question.variationQuestion.questionLevel).color">
  144. {{ countLevel(question.variationQuestion.questionLevel).text }}
  145. </span>
  146. <span class="gray">试题类型:</span>
  147. <span class="black" style="margin-right: 20px;">
  148. {{ question.variationQuestion.questionType }}
  149. </span>
  150. <span class="gray">难度:</span>
  151. <span style="font-weight: bold;"
  152. :class="countDiffcutyClass(question.variationQuestion.difficulty)">
  153. {{ question.variationQuestion.difficulty }}
  154. </span>
  155. </div>
  156. </div>
  157. <div class="question_content line_height_20"
  158. v-html="question.variationQuestion.questionStem">这是题目内容</div>
  159. <!-- <div class="yuwen">
  160. <span class="btn_span active">1</span>
  161. <span class="btn_span">2</span>
  162. <div class="question_list"></div>
  163. </div> -->
  164. <div class="card_footer">
  165. <div class="gray">知识点:</div>
  166. <KnowledgePoint :text="question.variationQuestion.knowledgePoint" />
  167. </div>
  168. </div>
  169. </div>
  170. </div>
  171. <div style="text-align: right;">
  172. <el-pagination background layout="prev, pager, next" :total="pageParam.total"
  173. :page-size="pageParam.pageSize" :current-page="pageParam.pageNum"
  174. @current-change="handleCurrentChange">
  175. </el-pagination>
  176. </div>
  177. </template>
  178. <NoData v-else>暂无数据</NoData>
  179. </div>
  180. </div>
  181. </template>
  182. <script>
  183. import {
  184. queryStudentErrorQuestion,
  185. markStudentErrorQuestion,
  186. downloadStudentErrorQuestion,
  187. } from '../../../http/api/errorQuestion';
  188. import Download from './Download.vue';
  189. import loadImg from './loadImg.js'
  190. import { Loading } from 'element-ui';
  191. import NoData from './NoData/NoData.vue';
  192. import KnowledgePoint from './KnowledgePoint.vue';
  193. export default {
  194. components: {
  195. Download,
  196. NoData,
  197. KnowledgePoint,
  198. },
  199. data() {
  200. return {
  201. pageParam: {
  202. pageNum: 1,
  203. pageSize: 10,
  204. total: 0,
  205. },
  206. questionList: [],
  207. allErrorCount: 0,
  208. unMasterCount: 0,
  209. masterCount: 0,
  210. reviewCount: 0,
  211. answerUrls: [],
  212. uploadPaperUrls: [],
  213. errorType: -1, // -1全部 0未掌握 1已掌握 2复习题
  214. examId: null,
  215. examType: null,
  216. gradeCode: null,
  217. downloadDialogVisible: false,
  218. isVariation: 0,
  219. };
  220. },
  221. computed: {
  222. subjectCode() {
  223. return this.$store.state.report.filterObject.subjectCode;
  224. }, //分析报告公共参数变量
  225. IsVariation() {
  226. return this.$store.state.question.isVariation;
  227. },
  228. },
  229. watch: {
  230. subjectCode(newVal, oldVal) {
  231. if (newVal !== oldVal) {
  232. this._queryStudentErrorQuestion();
  233. }
  234. },
  235. IsVariation(newVal) {
  236. if (newVal === 0 || newVal === 1) {
  237. this.downloadDialogVisible = true
  238. this.isVariation = newVal
  239. }
  240. },
  241. },
  242. created() {
  243. const ExamInfoItem = JSON.parse(localStorage.getItem("ExamInfoItem") || "{}");
  244. const reportExamCourseItem = JSON.parse(localStorage.getItem("reportExamCourseItem") || "{}");
  245. this.examId = reportExamCourseItem.examId;
  246. this.gradeCode = ExamInfoItem.examData.gradeCode;
  247. this.examType = ExamInfoItem.examData.examType;
  248. },
  249. async mounted() {
  250. await this._queryStudentErrorQuestion();
  251. },
  252. methods: {
  253. countGlobalIndex(index) {
  254. return (this.pageParam.pageNum - 1) * this.pageParam.pageSize + index;
  255. },
  256. countDiffcutyClass(difficulty) {
  257. // 容易:#90CB75 较易:#FAC858 一般:#5470C6 较难:#EA7ACB 困难:#EE6666
  258. const classMap = {
  259. '容易': 'easy',
  260. '较易': 'medium_easy',
  261. '一般': 'medium',
  262. '较难': 'medium_hard',
  263. '困难': 'hard'
  264. }
  265. return classMap[difficulty] || ''
  266. },
  267. countLevel(num) {
  268. // 1 :拔高题 2:进阶题 3:巩固题
  269. console.log('num', num);
  270. const arr = ['拔高题', '进阶题', '巩固题']
  271. const color = ['bg_hard', 'bg_medium', 'bg_easy',]
  272. return {
  273. text: arr[num - 1],
  274. color: color[num - 1],
  275. }
  276. },
  277. ShowAnserAndParse(type, question) {
  278. if (type === 1) {
  279. question.answerShow = !question.answerShow;
  280. question.parseShow = false
  281. }
  282. if (type === 2) {
  283. question.parseShow = !question.parseShow;
  284. question.answerShow = false
  285. }
  286. },
  287. async _queryStudentErrorQuestion() {
  288. const instance = Loading.service({ fullscreen: true });
  289. const { subjectCode, gradeCode, examType, examId, errorType, pageParam: { pageNum, pageSize } } = this
  290. const res = await queryStudentErrorQuestion({ subjectCode, gradeCode, examType, examId, errorType, pageNum, pageSize });
  291. if (res.code === 200) {
  292. const { allErrorCount, unMasterCount, masterCount, reviewCount, questionList, answerUrls, uploadPaperUrls } = res.data.records[0];
  293. this.allErrorCount = allErrorCount;
  294. this.masterCount = masterCount;
  295. this.unMasterCount = unMasterCount;
  296. this.reviewCount = reviewCount;
  297. this.answerUrls = answerUrls;
  298. this.uploadPaperUrls = uploadPaperUrls;
  299. this.pageParam.total = res.data.total * 1;
  300. for (let i = 0; i < questionList.length; i++) {
  301. const { sourceType, titleCoordinates, answerCoordinates, parseCoordinates, paintingPosition } = questionList[i]
  302. questionList[i].answerShow = false;
  303. questionList[i].parseShow = false;
  304. if (sourceType === 2) {
  305. const questionImg = await loadImg(this.uploadPaperUrls, titleCoordinates);
  306. questionList[i].questionImg = questionImg;
  307. const answerImg = await loadImg(this.answerUrls, answerCoordinates);
  308. questionList[i].answerImg = answerImg;
  309. const parseImg = await loadImg(this.answerUrls, parseCoordinates);
  310. questionList[i].parseImg = parseImg;
  311. // TODO: 学生答案图片加载,由于
  312. const studentAnswerImg = await loadImg(this.answerUrls, paintingPosition);
  313. questionList[i].studentAnswerImg = studentAnswerImg;
  314. }
  315. }
  316. this.questionList = questionList;
  317. // 缓慢滚动到顶部
  318. this.scrollToTop();
  319. }
  320. instance.close();
  321. },
  322. scrollToTop() {
  323. // 等待 DOM 更新完成
  324. this.$nextTick(() => {
  325. const container = document.querySelector('.content_right');
  326. if (container) {
  327. container.scrollTo({ top: 0, behavior: 'smooth' });
  328. }
  329. });
  330. },
  331. async _markStudentErrorQuestion(question, markStatus) {
  332. const res = await markStudentErrorQuestion({
  333. questionId: question.questionId,
  334. examId: this.examId,
  335. subjectCode: this.subjectCode,
  336. markStatus
  337. })
  338. if (res.code === 200) {
  339. this.$message.success('操作成功');
  340. await this._queryStudentErrorQuestion();
  341. } else {
  342. this.$message.error(res.message || '操作失败');
  343. }
  344. },
  345. async handleCurrentChange(page) {
  346. this.pageParam.pageNum = page;
  347. await this._queryStudentErrorQuestion();
  348. },
  349. },
  350. }
  351. </script>
  352. <style scoped lang="scss">
  353. .flex {
  354. display: flex;
  355. margin-bottom: 10px;
  356. .flex_left {
  357. width: 60px;
  358. }
  359. .flex_right {
  360. flex: 1;
  361. display: flex;
  362. flex-wrap: wrap;
  363. }
  364. }
  365. .bg_easy {
  366. background-color: #3BA272 !important;
  367. }
  368. .bg_medium {
  369. background-color: #5470C6 !important;
  370. }
  371. .bg_hard {
  372. background-color: #EE6666 !important;
  373. }
  374. .select_box {
  375. background-color: #ffffff;
  376. border-radius: 10px;
  377. padding: 10px;
  378. margin-bottom: 10px;
  379. }
  380. .content {
  381. background-color: #ffffff;
  382. border-radius: 10px;
  383. padding: 20px;
  384. margin-bottom: 10px;
  385. }
  386. .right_btn {
  387. display: flex;
  388. justify-content: flex-end;
  389. margin-bottom: 10px;
  390. }
  391. .question_card {
  392. margin-bottom: 10px;
  393. border: 1px solid #ebeef5;
  394. border-radius: 10px;
  395. overflow: hidden;
  396. .card_top {
  397. padding: 20px;
  398. }
  399. .card_top_info {
  400. display: flex;
  401. justify-content: space-between;
  402. margin-bottom: 20px;
  403. .left {
  404. display: flex;
  405. align-items: center;
  406. span {
  407. font-size: 14px;
  408. }
  409. .tag {
  410. color: #ffffff;
  411. padding: 4px 5px;
  412. font-size: 12px;
  413. background-color: #F56C6C;
  414. border-radius: 2px;
  415. position: relative;
  416. &::before {
  417. content: '';
  418. position: absolute;
  419. left: -5px;
  420. top: 50%;
  421. transform: translateY(-50%);
  422. width: 0;
  423. height: 0;
  424. border-top: 5px solid transparent;
  425. border-bottom: 5px solid transparent;
  426. border-right: 5px solid #EE6666;
  427. }
  428. }
  429. }
  430. }
  431. .number {
  432. color: #ffffff;
  433. font-size: 14px;
  434. padding: 5px 9px;
  435. background-color: #2E64FA;
  436. border-radius: 4px;
  437. }
  438. .btn_span {
  439. color: #2E64FA;
  440. font-size: 14px;
  441. padding: 5px 9px;
  442. border: 1px solid #2E64FA;
  443. border-radius: 4px;
  444. cursor: pointer;
  445. margin-right: 10px;
  446. &.active {
  447. color: #ffffff;
  448. background-color: #2E64FA;
  449. border-radius: 4px;
  450. }
  451. }
  452. .gray {
  453. color: #999;
  454. }
  455. .black {
  456. color: #333;
  457. }
  458. .blue {
  459. color: #2E64FA;
  460. }
  461. .question_content {
  462. margin-bottom: 20px;
  463. }
  464. .yuwen {
  465. margin-top: 20px;
  466. .question_list {
  467. margin-top: 20px;
  468. height: 100px;
  469. padding-top: 20px;
  470. border-top: 1px solid #EBEEF5;
  471. }
  472. }
  473. .card_footer {
  474. display: flex;
  475. align-items: center;
  476. padding-top: 20px;
  477. border-top: 1px solid #EBEEF5;
  478. .footer_item {
  479. margin-right: 40px;
  480. }
  481. }
  482. .card_buttom {
  483. background-color: #F0F2F5;
  484. padding: 15px 20px;
  485. .btn_box {
  486. display: flex;
  487. justify-content: flex-end;
  488. span {
  489. margin-left: 20px;
  490. cursor: pointer;
  491. }
  492. }
  493. .content {
  494. padding: 20px;
  495. background-color: #ffffff;
  496. margin-top: 20px;
  497. border-radius: 10px;
  498. .content_inner {
  499. border: 2px dotted #DCDFE6;
  500. border-radius: 4px;
  501. padding: 10px;
  502. }
  503. }
  504. .parseShow_content {
  505. position: relative;
  506. &::before {
  507. content: '';
  508. position: absolute;
  509. right: 20px;
  510. /* 根据需要调整三角水平位置 */
  511. top: 24px;
  512. /* 三角放置在外部,超出上方 */
  513. width: 0;
  514. height: 0;
  515. border-left: 10px solid transparent;
  516. border-right: 10px solid transparent;
  517. border-bottom: 12px solid #ffffff;
  518. z-index: 2;
  519. }
  520. }
  521. .answerShow_content {
  522. position: relative;
  523. &::before {
  524. content: '';
  525. position: absolute;
  526. right: 20px;
  527. /* 根据需要调整三角水平位置 */
  528. top: 24px;
  529. /* 三角放置在外部,超出上方 */
  530. width: 0;
  531. height: 0;
  532. border-left: 10px solid transparent;
  533. border-right: 10px solid transparent;
  534. border-bottom: 12px solid #ffffff;
  535. z-index: 2;
  536. }
  537. }
  538. }
  539. ::v-deep .qml-answer {
  540. margin-left: 0;
  541. margin-bottom: 0;
  542. }
  543. ::v-deep .qml-explanation .qml-seg p {
  544. margin-left: 0 !important;
  545. }
  546. ::v-deep .qml-explanation .qml-seg p,
  547. ::v-deep .qml-exps-sq {
  548. margin-left: 0 !important;
  549. }
  550. }
  551. </style>