AnswerDetails.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <div style="padding: 20px" class=".answer-details-container">
  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">{{returnText}}</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. returnText: '返回练习',
  183. topInfo: {},
  184. subjectName: "",
  185. wrongNum: 0,
  186. seconds: 0,
  187. isShowJuYiFanSan: false,
  188. date: "",
  189. correctPercent: "",
  190. correctNum: 0,
  191. items: [],
  192. chapterName: "",
  193. batchno: 0,
  194. knowledgeId: 0,
  195. recordsDetail: {},
  196. queList: [],
  197. answerForm: [],
  198. };
  199. },
  200. created() {
  201. let query = this.$route.query;
  202. let info = query.info;
  203. if (query.hasOwnProperty("knowledgeId")) {
  204. this.knowledgeId = query.knowledgeId;
  205. }
  206. if (query.hasOwnProperty("batchno")) {
  207. this.batchno = query.batchno;
  208. }
  209. if (query.hasOwnProperty("type") && query.type == 1) {
  210. this.formatData(JSON.parse(decodeURIComponent(info)));
  211. return;
  212. } else {
  213. this.topInfo = JSON.parse(decodeURIComponent(info));
  214. if (this.topInfo.hasOwnProperty("rate")) {
  215. this.topInfo["rate"] = this.topInfo["rate"] + "%";
  216. }
  217. console.log("topInfo", this.topInfo);
  218. this.httpDiagnosticRecordsDetail();
  219. }
  220. },
  221. methods: {
  222. onShowJuYiFanSan() {
  223. this.isShowJuYiFanSan = !this.isShowJuYiFanSan;
  224. if (this.isShowJuYiFanSan) {
  225. this.httpDrawInferences();
  226. this.$nextTick(_=>this.mxGlobal.MathQueue('question_simulate'))
  227. }
  228. },
  229. httpDiagnosticRecordsDetail() {
  230. diagnosticRecordsDetail({
  231. batchno: this.batchno,
  232. }).then((res) => {
  233. this.getQuestionIds(res.rows);
  234. });
  235. },
  236. httpDrawInferences() {
  237. drawInferences({
  238. knowledgeId: this.knowledgeId,
  239. }).then((res) => {
  240. this.queList = this.formatQueData(res.data);
  241. console.log(res);
  242. });
  243. },
  244. formatQueData(data) {
  245. let len = data.length;
  246. for (let i = 0; i < len; i++) {
  247. data[i]["group"] = [];
  248. }
  249. return data;
  250. },
  251. onOptionClick(res, row) {
  252. console.log(res);
  253. console.log(row);
  254. },
  255. formatData(data) {
  256. data["coursename"] = data["subjectName"];
  257. data["rights"] = data["correctNum"];
  258. data["wrongs"] = data["wrongNum"];
  259. data["rate"] = data["correctPercent"];
  260. data["day"] = data["date"];
  261. let list = data.items;
  262. let len = list.length;
  263. let qList = [];
  264. for (let i = 0; i < len; i++) {
  265. let data = list[i]["question"];
  266. data["detail"] = list[i]["question"];
  267. data["detail"]["answer"] = list[i]["yourAnswer"];
  268. data["detail"]["correct"] = list[i]["correctAnswer"];
  269. qList.push(data);
  270. }
  271. this.items = qList;
  272. this.topInfo = data;
  273. },
  274. getQuestionIds(data) {
  275. let len = data.length;
  276. let ids = [];
  277. for (let i = 0; i < len; i++) {
  278. let id = data[i]["questionid"];
  279. ids.push(id);
  280. this.recordsDetail[id] = data[i];
  281. }
  282. getQuestionsByIds({
  283. ids: ids.toString(),
  284. }).then((res) => {
  285. this.formatQusestion(res.data);
  286. });
  287. },
  288. formatQusestion(questionList) {
  289. let len = questionList.length;
  290. for (let i = 0; i < len; i++) {
  291. let qid = questionList[i]["id"];
  292. if (this.recordsDetail[qid]) {
  293. questionList[i]["detail"] = this.recordsDetail[qid];
  294. }
  295. }
  296. console.log(questionList);
  297. this.items = questionList;
  298. this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))
  299. },
  300. expandChange(item, rows) {
  301. this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))
  302. },
  303. expandsHandle(row) {
  304. this.$refs.expandstable.toggleRowExpansion(row, true);
  305. this.$nextTick(_=>this.mxGlobal.MathQueue('question_list'))
  306. },
  307. backPractice() {
  308. this.$router.push({
  309. path: "/question-center/smartExercise",
  310. });
  311. },
  312. },
  313. };
  314. </script>
  315. <style scoped>
  316. @import "~@/views/questioncenter/practice-answer-detail.scss";
  317. </style>