AnswerDetails.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470
  1. <template>
  2. <div style="padding: 20px">
  3. <!-- 头部 -->
  4. <el-card>
  5. <div class="header">
  6. <div class="header_tit">
  7. <span>答题情况</span>
  8. <span class="more" @click="onShowJuYiFanSan" v-if="knowledgeId"
  9. >举一反三</span
  10. >
  11. </div>
  12. <!-- 基本信息 -->
  13. <table class="basic_info">
  14. <tr>
  15. <th>科目</th>
  16. <th>正确</th>
  17. <th>错误</th>
  18. <th>正确率</th>
  19. <th>用时</th>
  20. <th>日期</th>
  21. </tr>
  22. <tbody>
  23. <td>{{ topInfo.coursename || "" }}</td>
  24. <td>{{ topInfo.rights || 0 }}</td>
  25. <td>{{ topInfo.wrongs || 0 }}</td>
  26. <td>{{ topInfo.rate || 0 }}</td>
  27. <td>{{ topInfo.seconds || 0 }} 秒</td>
  28. <td>{{ topInfo.day || "0000-00-00" }}</td>
  29. </tbody>
  30. </table>
  31. </div>
  32. </el-card>
  33. <!-- 做题详情 -->
  34. <el-card class="info" id="question_list">
  35. <el-table
  36. ref="expandstable"
  37. :data="items"
  38. style="width: 100%"
  39. align="center"
  40. @expand-change="expandChange"
  41. >
  42. <el-table-column type="index" label="序号" width="150px">
  43. </el-table-column>
  44. <el-table-column
  45. label="章节"
  46. width="500"
  47. ><template>
  48. {{topInfo.chapterName}}
  49. </template></el-table-column>
  50. <el-table-column prop="detail.answer" label="你的答案">
  51. </el-table-column>
  52. <el-table-column prop="detail.correct" label="正确答案">
  53. </el-table-column>
  54. <el-table-column label="对错">
  55. <template slot-scope="scope">
  56. <img
  57. v-if="scope.row.detail.answer == scope.row.detail.correct"
  58. src="@/assets/images/icon_right.png"
  59. />
  60. <img v-else src="@/assets/images/icon_wrong.png" />
  61. </template>
  62. </el-table-column>
  63. <el-table-column type="expand" label="操作">
  64. <template slot-scope="scope">
  65. <!-- 题目解析 -->
  66. <div class="que_info">
  67. <div class="collect">
  68. <img src="" alt="" />
  69. </div>
  70. <div class="info_right">
  71. <div class="que_tit">
  72. <div>【题文】</div>
  73. <div class="center" v-html="scope.row.title"></div>
  74. <div class="fix">
  75. <span>正确答案</span>
  76. <span>{{ scope.row.answer1 }}</span>
  77. </div>
  78. </div>
  79. <div class="option-list">
  80. <div class="option-item">
  81. <span class="option-symbol">A</span>
  82. <span v-html="scope.row.optionA"></span>
  83. </div>
  84. <div class="option-item">
  85. <span class="option-symbol">B</span>
  86. <span v-html="scope.row.optionB"></span>
  87. </div>
  88. <div class="option-item">
  89. <span class="option-symbol">C</span>
  90. <span v-html="scope.row.optionC"></span>
  91. </div>
  92. <div class="option-item">
  93. <span class="option-symbol">D</span>
  94. <span v-html="scope.row.optionD"></span>
  95. </div>
  96. </div>
  97. <div class="que_options"></div>
  98. <div class="prase">
  99. <div class="jiexi">解析</div>
  100. <div v-html="scope.row.parse"></div>
  101. </div>
  102. </div>
  103. </div>
  104. </template>
  105. </el-table-column>
  106. <template slot="empty">
  107. <div class="empty-box">
  108. <img src="@/assets/images/icon_data.png" />
  109. <span>没有信息</span>
  110. </div>
  111. </template>
  112. </el-table>
  113. </el-card>
  114. <div class="btn">
  115. <span @click="backPractice">返回练习 </span>
  116. </div>
  117. <!-- 弹出警告 -->
  118. <el-dialog title="举一反三" :visible.sync="isShowJuYiFanSan" width="80%">
  119. <div class="paper_questions" id="question_simulate">
  120. <div class="que_item" v-for="(item, index) in queList" :key="item.id">
  121. <!-- 题目 -->
  122. <div class="que_content" style="display: flex">
  123. <div>{{ index + 1 }}.</div>
  124. <span v-html="item.title"></span>
  125. </div>
  126. <!-- 选项 -->
  127. <div class="options">
  128. <el-radio-group
  129. text-color="#ccc"
  130. v-model="item['group']"
  131. @change="onOptionClick(item)"
  132. >
  133. <div class="option" v-if="item.optionA">
  134. <el-radio label="A">
  135. <span class="option-symbol">A</span>
  136. <span v-html="item.optionA"></span>
  137. </el-radio>
  138. </div>
  139. <div class="option" v-if="item.optionB">
  140. <el-radio label="B">
  141. <span class="option-symbol">B</span>
  142. <span v-html="item.optionB"></span>
  143. </el-radio>
  144. </div>
  145. <div class="option" v-if="item.optionC">
  146. <el-radio label="C">
  147. <span class="option-symbol">C</span>
  148. <span v-html="item.optionC"></span>
  149. </el-radio>
  150. </div>
  151. <div class="option" v-if="item.optionD">
  152. <el-radio label="D">
  153. <span class="option-symbol">D</span>
  154. <span v-html="item.optionD"></span>
  155. </el-radio>
  156. </div>
  157. </el-radio-group>
  158. </div>
  159. <!-- :class="item['group'][0]==item.answer1?'success':'error'" -->
  160. <div class="is-correct" v-if="item['group'].length > 0">
  161. <div class="correct-text" :class="item['group'][0]==item.answer1?'success':'error'">正确答案:{{ item.answer1 }}</div>
  162. <div class="prase">
  163. <div class="jiexi">解析</div>
  164. <div v-html="item.parse"></div>
  165. </div>
  166. </div>
  167. </div>
  168. <el-button @click="onShowJuYiFanSan">确定</el-button>
  169. </div>
  170. </el-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. import {
  175. diagnosticRecordsDetail,
  176. getQuestionsByIds,
  177. drawInferences,
  178. } from "@/api/webApi/webQue.js";
  179. export default {
  180. data() {
  181. return {
  182. topInfo: {},
  183. subjectName: "",
  184. wrongNum: 0,
  185. seconds: 0,
  186. isShowJuYiFanSan: false,
  187. date: "",
  188. correctPercent: "",
  189. correctNum: 0,
  190. items: [],
  191. chapterName: "",
  192. batchno: 0,
  193. knowledgeId: 0,
  194. recordsDetail: {},
  195. queList: [],
  196. answerForm: [],
  197. };
  198. },
  199. created() {
  200. let query = this.$route.query;
  201. let info = query.info;
  202. if (query.hasOwnProperty("knowledgeId")) {
  203. this.knowledgeId = query.knowledgeId;
  204. }
  205. if (query.hasOwnProperty("batchno")) {
  206. this.batchno = query.batchno;
  207. }
  208. if (query.hasOwnProperty("type") && query.type == 1) {
  209. this.formatData(JSON.parse(decodeURIComponent(info)));
  210. return;
  211. } else {
  212. this.topInfo = JSON.parse(decodeURIComponent(info));
  213. if (this.topInfo.hasOwnProperty("rate")) {
  214. this.topInfo["rate"] = this.topInfo["rate"] + "%";
  215. }
  216. console.log("topInfo", this.topInfo);
  217. this.httpDiagnosticRecordsDetail();
  218. }
  219. },
  220. methods: {
  221. onShowJuYiFanSan() {
  222. this.isShowJuYiFanSan = !this.isShowJuYiFanSan;
  223. if (this.isShowJuYiFanSan) {
  224. this.httpDrawInferences();
  225. this.$nextTick(_=>this.mxGlobal.MathQueue('question_simulate'))
  226. }
  227. },
  228. httpDiagnosticRecordsDetail() {
  229. diagnosticRecordsDetail({
  230. batchno: this.batchno,
  231. }).then((res) => {
  232. this.getQuestionIds(res.rows);
  233. });
  234. },
  235. httpDrawInferences() {
  236. drawInferences({
  237. knowledgeId: this.knowledgeId,
  238. }).then((res) => {
  239. this.queList = this.formatQueData(res.data);
  240. console.log(res);
  241. });
  242. },
  243. formatQueData(data) {
  244. let len = data.length;
  245. for (let i = 0; i < len; i++) {
  246. data[i]["group"] = [];
  247. }
  248. return data;
  249. },
  250. onOptionClick(res, row) {
  251. console.log(res);
  252. console.log(row);
  253. },
  254. formatData(data) {
  255. data["coursename"] = data["subjectName"];
  256. data["rights"] = data["correctNum"];
  257. data["wrongs"] = data["wrongNum"];
  258. data["rate"] = data["correctPercent"];
  259. data["day"] = data["date"];
  260. let list = data.items;
  261. let len = list.length;
  262. let qList = [];
  263. for (let i = 0; i < len; i++) {
  264. let data = list[i]["question"];
  265. data["detail"] = list[i]["question"];
  266. data["detail"]["answer"] = list[i]["yourAnswer"];
  267. data["detail"]["correct"] = list[i]["correctAnswer"];
  268. qList.push(data);
  269. }
  270. this.items = qList;
  271. this.topInfo = data;
  272. },
  273. getQuestionIds(data) {
  274. let len = data.length;
  275. let ids = [];
  276. for (let i = 0; i < len; i++) {
  277. let id = data[i]["questionid"];
  278. ids.push(id);
  279. this.recordsDetail[id] = data[i];
  280. }
  281. getQuestionsByIds({
  282. ids: ids.toString(),
  283. }).then((res) => {
  284. this.formatQusestion(res.data);
  285. });
  286. },
  287. formatQusestion(questionList) {
  288. let len = questionList.length;
  289. for (let i = 0; i < len; i++) {
  290. let qid = questionList[i]["id"];
  291. if (this.recordsDetail[qid]) {
  292. questionList[i]["detail"] = this.recordsDetail[qid];
  293. }
  294. }
  295. console.log(questionList);
  296. this.items = questionList;
  297. this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))
  298. },
  299. expandChange(item, rows) {
  300. this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))
  301. console.log(item);
  302. },
  303. expandsHandle(row) {
  304. console.log(row);
  305. this.$refs.expandstable.toggleRowExpansion(row, true);
  306. this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))
  307. },
  308. backPractice() {
  309. this.$router.push({
  310. path: "/question-center/smartExercise",
  311. });
  312. },
  313. },
  314. };
  315. </script>
  316. <style scoped>
  317. .header_tit {
  318. padding: 16px 32px 16px 20px;
  319. border-bottom: 1px solid #b7b7b7;
  320. display: flex;
  321. justify-content: space-between;
  322. align-items: center;
  323. font-weight: 500;
  324. color: #343434;
  325. }
  326. .more {
  327. color: white;
  328. background: #47c6a2;
  329. right: 32px;
  330. padding: 6px 16px;
  331. border-radius: 16px;
  332. }
  333. .basic_info {
  334. width: 100%;
  335. text-align: left;
  336. padding: 36px 21px;
  337. }
  338. .basic_info tr {
  339. font-size: 12px;
  340. font-family: PingFangSC-Regular, PingFang SC;
  341. font-weight: 400;
  342. color: #717171;
  343. line-height: 17px;
  344. }
  345. .basic_info td {
  346. font-size: 21px;
  347. font-family: PingFangSC-Medium, PingFang SC;
  348. font-weight: 500;
  349. color: #343434;
  350. line-height: 29px;
  351. }
  352. .info {
  353. margin-top: 16px;
  354. padding: 0;
  355. }
  356. .view {
  357. cursor: pointer;
  358. color: #47c6a2;
  359. display: flex;
  360. align-items: center;
  361. }
  362. .view img {
  363. margin-right: 5px;
  364. height: 100%;
  365. }
  366. .prase {
  367. border: 2px solid #47c6a2;
  368. display: flex;
  369. margin-top: 24px;
  370. }
  371. .prase .jiexi {
  372. background: #47c6a2;
  373. display: flex;
  374. justify-content: center;
  375. align-items: center;
  376. padding: 0 22px;
  377. color: white;
  378. }
  379. .prase div:last-child {
  380. padding: 10px;
  381. }
  382. .empty-box {
  383. display: flex;
  384. flex-direction: column;
  385. align-items: center;
  386. }
  387. .que_tit {
  388. display: flex;
  389. position: relative;
  390. }
  391. .que_tit .fix {
  392. position: absolute;
  393. right: 0;
  394. }
  395. .que_tit .fix > span:first-child {
  396. background: #47c6a2;
  397. color: white;
  398. padding: 4px;
  399. border-radius: 3px;
  400. margin-right: 28px;
  401. }
  402. .btn {
  403. display: flex;
  404. justify-content: center;
  405. margin-top: 16px;
  406. }
  407. .btn span {
  408. padding: 14px 29px;
  409. color: white;
  410. background: #47c6a2;
  411. border-radius: 4px;
  412. cursor: pointer;
  413. }
  414. .center {
  415. width: 1000px;
  416. }
  417. .option-list {
  418. margin-top: 10px;
  419. }
  420. .option-item {
  421. line-height: 30px;
  422. }
  423. .option-symbol {
  424. margin-right: 10px;
  425. }
  426. .que_item {
  427. border-radius: 1px;
  428. border: 1px solid #dedede;
  429. margin-bottom: 8px;
  430. }
  431. .que_content {
  432. padding: 12px 24px 0 33px;
  433. font-size: 14px;
  434. font-family: PingFangSC-Medium, PingFang SC;
  435. font-weight: 500;
  436. color: #4c4c4c;
  437. line-height: 27px;
  438. margin-bottom: 40px;
  439. }
  440. .options {
  441. padding-left: 36px;
  442. font-size: 14px;
  443. font-family: PingFangSC-Regular, PingFang SC;
  444. font-weight: 400;
  445. color: #4c4c4c;
  446. line-height: 27px;
  447. }
  448. .options .option {
  449. margin-bottom: 10px;
  450. }
  451. .paper_questions {
  452. display: flex;
  453. flex-direction: column;
  454. align-items: center;
  455. }
  456. .que_item {
  457. width: 100%;
  458. }
  459. .is-correct {
  460. padding: 10px 36px;
  461. }
  462. .correct-text.success {
  463. color: #47c6a2;
  464. }
  465. .correct-text.error {
  466. color: crimson;
  467. }
  468. </style>