historyOfIncorrectQuestions.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <!-- 历史错题 -->
  2. <template>
  3. <div class="page-container historyOfIncorrectQuestions-addPage">
  4. <div class="page-container-top-max-big-box">
  5. <p class="top-1-p">历史错题</p>
  6. <p class="top-2-p" @click="backPage()">返回</p>
  7. </div>
  8. <div class="page-form-title-box">
  9. <el-form :model="queryParams" class="form-box" ref="queryForm"
  10. :inline="true" style="width:100%;">
  11. <el-form-item label="" prop="knowledgePointId" v-if="historyOfIncorrectQuestionsPropsData.type!=3">
  12. <el-cascader
  13. v-model="queryParams.knowledgePointId"
  14. :options="optionListA"
  15. :props="{
  16. emitPath:false,
  17. checkStrictly: true,
  18. value: 'id',
  19. label: 'knowledgePointName',
  20. children: 'children',
  21. }"
  22. style="width: 180px"
  23. :show-all-levels="false"
  24. filterable
  25. placeholder="知识点"
  26. ></el-cascader>
  27. </el-form-item>
  28. <el-form-item label="" prop="questionType">
  29. <el-select v-model="queryParams.questionType" placeholder="题型" style="width: 200px">
  30. <el-option
  31. v-for="dict in optionListB"
  32. :key="dict.value"
  33. :label="dict.label"
  34. :value="dict.value"
  35. />
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item label="" prop="difficulty">
  39. <el-select v-model="queryParams.difficulty" placeholder="难度" style="width: 200px">
  40. <el-option
  41. v-for="dict in optionListC"
  42. :key="dict.value"
  43. :label="dict.label"
  44. :value="dict.value"
  45. />
  46. </el-select>
  47. </el-form-item>
  48. <el-form-item label="" prop="searchValue">
  49. <el-input
  50. maxLength="30"
  51. v-model="queryParams.searchValue"
  52. placeholder="搜索名称"
  53. style="width: 200px"
  54. />
  55. </el-form-item>
  56. <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
  57. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  58. <p class="page-submit-common-style-button"
  59. v-if="dataList[0]"
  60. style="float: right;"
  61. @click="tableButton(1)"
  62. >开始训练</p>
  63. </el-form>
  64. </div>
  65. <div class="page-content-box">
  66. <el-table class="table-box" border :data="dataList">
  67. <el-table-column label="题干" prop="questionContent" show-overflow-tooltip>
  68. <template slot-scope="scope">
  69. <span>{{ cleanRichText(scope.row.questionContent) }}</span>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="题型" prop="content" width="200" show-overflow-tooltip>
  73. <template slot-scope="scope">
  74. <span>{{ scope.row.questionType == 1?'单选题':(scope.row.questionType == 2?'多选题':(scope.row.questionType == 3?'判断题':'')) }}</span>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="难度" prop="content" width="200" show-overflow-tooltip>
  78. <template slot-scope="scope">
  79. <span>{{ scope.row.difficulty == 1?'简单':(scope.row.difficulty == 2?'一般':(scope.row.difficulty == 3?'较难':(scope.row.difficulty == 4?'极难':''))) }}</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column label="做对次数" prop="correctCount" width="200" show-overflow-tooltip/>
  83. <el-table-column label="做错次数" prop="errorCount" width="200" show-overflow-tooltip/>
  84. <el-table-column label="操作" width="200" show-overflow-tooltip>
  85. <template slot-scope="scope">
  86. <div class="table-button-box">
  87. <p class="table-button-null"></p>
  88. <p class="table-button-p"
  89. @click="tableButton(2,scope.row)"
  90. >查看答案</p>
  91. <p class="table-button-null"></p>
  92. </div>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <pagination :page-sizes="[20, 30, 40, 50]"
  97. v-show="total>0"
  98. :total="total"
  99. :page.sync="queryParams.page"
  100. :limit.sync="queryParams.pageSize"
  101. @pagination="getList"
  102. />
  103. </div>
  104. <el-drawer
  105. size="40%"
  106. custom-class="historyOfIncorrectQuestions-addPage-drawer"
  107. :append-to-body="true"
  108. :title="drawerTitle"
  109. ref="drawer"
  110. :visible.sync="drawer"
  111. direction="rtl">
  112. <answerKey v-if="drawer" :answerKeyPropsData="answerKeyPropsData"></answerKey>
  113. </el-drawer>
  114. </div>
  115. </template>
  116. <script>
  117. //import { getDicts } from "@/api/commonality/noPermission";
  118. //import { systemUserSelect } from "@/api/commonality/permission";
  119. import answerKey from "@/views/safetyEducationExaminationNew/components/answerKey.vue";
  120. import {
  121. examElKnowledgePointTreeList,examElExamAttemptAnswerExamAnswer,
  122. examElExamAttemptAnswerAttemptAnswer,examUserPracticeWrongQuestions,
  123. } from "@/api/safetyEducationExaminationNew/index";
  124. export default {
  125. name: 'addPage',
  126. components: {
  127. answerKey,
  128. },
  129. props: {
  130. historyOfIncorrectQuestionsPropsData: {}
  131. },
  132. data() {
  133. return {
  134. //下拉列表数据
  135. optionListA: [],
  136. optionListB: [{value:'1',label:'单选'},{value:'2',label:'多选'},{value:'3',label:'判断'}],
  137. optionListC: [{value:"1",label:'简单'},{value:"2",label:'一般'},{value:"3",label:'较难'},{value:"4",label:'极难'}],
  138. queryParams: {
  139. page: 1,
  140. pageSize: 20,
  141. knowledgePointId: null,
  142. questionType: null,
  143. difficulty: null,
  144. searchValue: '',
  145. },
  146. //列表数据
  147. dataList:[],
  148. //数据数量
  149. total:0,
  150. //弹窗相关
  151. drawerTitle: '',
  152. drawerType: '',
  153. drawer: false,
  154. answerKeyPropsData:{},
  155. }
  156. },
  157. created() {
  158. },
  159. mounted() {
  160. this.getList();
  161. this.examElKnowledgePointTreeList();
  162. },
  163. methods: {
  164. // 返回按钮
  165. backPage() {
  166. this.$parent.tableButton(6)
  167. },
  168. // 提交按钮
  169. submitButton() {
  170. },
  171. tableButton(type,row){
  172. if(type == '1'){
  173. //开始训练
  174. let obj = {};
  175. if(this.historyOfIncorrectQuestionsPropsData.type == 1){
  176. obj.source = 2;
  177. obj.examId = this.historyOfIncorrectQuestionsPropsData.examId;
  178. }else if(this.historyOfIncorrectQuestionsPropsData.type == 2){
  179. obj.source = 3;
  180. obj.attemptId = this.historyOfIncorrectQuestionsPropsData.attemptId;
  181. }else if(this.historyOfIncorrectQuestionsPropsData.type == 3){
  182. obj.source = 1;
  183. obj.knowledgePointId = this.historyOfIncorrectQuestionsPropsData.knowledgePointId;
  184. }
  185. this.$router.push({
  186. path: '/startTraining',
  187. query: obj
  188. })
  189. }else if(type == 2){
  190. //查看答案
  191. this.$set(this, 'drawerTitle', '查看试题答案')
  192. this.$set(this, 'drawerType', 1)
  193. this.$set(this, 'drawer', true)
  194. this.$set(this,'answerKeyPropsData',{
  195. id:this.historyOfIncorrectQuestionsPropsData.type == 3?row.questionId:row.sourceQuestionId,
  196. });
  197. }
  198. },
  199. //弹窗返回
  200. drawerReturnButton(){
  201. this.$refs.drawer.closeDrawer();
  202. },
  203. //查询按钮
  204. handleQuery(){
  205. this.$set(this.queryParams,'page',1);
  206. this.getList();
  207. },
  208. //重置按钮
  209. resetQuery(){
  210. this.$set(this,'queryParams',{
  211. page:1,
  212. pageSize:20,
  213. knowledgePointId: null,
  214. questionType: null,
  215. difficulty: null,
  216. searchValue: '',
  217. });
  218. this.getList();
  219. },
  220. //获取数据列表
  221. getList(){
  222. let obj = JSON.parse(JSON.stringify(this.queryParams))
  223. if(this.historyOfIncorrectQuestionsPropsData.type == 1){
  224. obj.examId = this.historyOfIncorrectQuestionsPropsData.examId;
  225. examElExamAttemptAnswerExamAnswer(obj).then(response => {
  226. this.$set(this,'dataList',response.data.records);
  227. this.$set(this,'total',response.data.total);
  228. });
  229. }else if(this.historyOfIncorrectQuestionsPropsData.type == 2){
  230. obj.attemptId = this.historyOfIncorrectQuestionsPropsData.attemptId;
  231. examElExamAttemptAnswerAttemptAnswer(obj).then(response => {
  232. this.$set(this,'dataList',response.data.records);
  233. this.$set(this,'total',response.data.total);
  234. });
  235. }else if(this.historyOfIncorrectQuestionsPropsData.type == 3){
  236. obj.knowledgePointId = this.historyOfIncorrectQuestionsPropsData.knowledgePointId;
  237. examUserPracticeWrongQuestions(obj).then(response => {
  238. this.$set(this,'dataList',response.data.records);
  239. this.$set(this,'total',response.data.total);
  240. });
  241. }
  242. },
  243. examElKnowledgePointTreeList(){
  244. examElKnowledgePointTreeList({}).then(response => {
  245. const list = response.data || [];
  246. this.formatTreeData(list);
  247. this.$set(this, 'optionListA', list);
  248. });
  249. },
  250. //清洗富文本
  251. cleanRichText(htmlStr, maxLength = 50) {
  252. if (!htmlStr) return '';
  253. const tempDiv = document.createElement('div');
  254. tempDiv.innerHTML = htmlStr;
  255. let text = tempDiv.textContent || tempDiv.innerText || '';
  256. text = text.replace(/\s+/g, ' ').trim();
  257. if (maxLength && text.length > maxLength) {
  258. return text.substring(0, maxLength) + '...';
  259. }
  260. return text;
  261. },
  262. }
  263. }
  264. </script>
  265. <style scoped lang="scss">
  266. .historyOfIncorrectQuestions-addPage {
  267. .content-box {
  268. flex: 1;
  269. display: flex;
  270. flex-direction: column;
  271. overflow: hidden;
  272. padding: 20px;
  273. }
  274. }
  275. </style>