index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <!-- 刷题练习 -->
  2. <template>
  3. <div class="app-container practiceQuestions">
  4. <div class="page-container practiceQuestionsPage" v-if="pageType === 1">
  5. <p class="pageTitle">刷题练习</p>
  6. <div class="max-big-box">
  7. <div class="left-box scrollbar-box">
  8. <p @click="leftCheckButton(index)"
  9. v-for="(item,index) in letDataList" :key="index"
  10. class="left-for-p" :class="index==leftDataIndex?'leftCheck':''">
  11. {{item.knowledgePointName}}
  12. </p>
  13. </div>
  14. <div class="right-box">
  15. <div class="page-form-title-box">
  16. <el-form :model="queryParams" class="form-box" ref="queryForm"
  17. :inline="true" style="width:100%;">
  18. <div class="table-top-button-box">
  19. <div>
  20. <p :class="practiceStatus === ''?'check-table-button':''" @click="tableTypeButton('')">全部</p>
  21. <p :class="practiceStatus === 0?'check-table-button':''" @click="tableTypeButton(0)">未开始</p>
  22. <p :class="practiceStatus === 1?'check-table-button':''" @click="tableTypeButton(1)">练习中</p>
  23. <p :class="practiceStatus === 2?'check-table-button':''" @click="tableTypeButton(2)">已学完</p>
  24. </div>
  25. </div>
  26. <el-form-item label="" prop="knowledgePointId">
  27. <el-cascader
  28. v-model="queryParams.knowledgePointId"
  29. :options="optionListB"
  30. :props="{
  31. emitPath:false,
  32. checkStrictly: true,
  33. value: 'id',
  34. label: 'knowledgePointName',
  35. children: 'children',
  36. }"
  37. style="width: 180px"
  38. :show-all-levels="false"
  39. filterable
  40. placeholder="知识点"
  41. ></el-cascader>
  42. </el-form-item>
  43. <el-form-item label="" prop="searchName">
  44. <el-input
  45. maxLength="30"
  46. v-model="queryParams.searchName"
  47. placeholder="搜索名称"
  48. style="width: 200px"
  49. />
  50. </el-form-item>
  51. <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
  52. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  53. </el-form>
  54. </div>
  55. <div class="page-content-box">
  56. <div class="for-max-big-box scrollbar-box">
  57. <div class="for-big-box" v-for="(item,index) in dataList" :key="index" @click="tableButton(1,item)">
  58. <p class="title-p">{{item.knowledgePointName}}</p>
  59. <div class="text-box">
  60. <div class="text-min-box">
  61. <p class="el-icon-time"></p>
  62. <p :style="!item.lastAnswerTime?'font-size:14px;':''">{{item.lastAnswerTime?parseTime(item.lastAnswerTime,"{y}-{m}-{d} {h}:{i}"):'未练习'}}</p>
  63. </div>
  64. <p class="text-p">练习进度:{{item.answeredCount}} / {{item.totalCount}}</p>
  65. <p class="text-p">正确数:{{item.correctCount}} 丨 错题数:{{item.wrongCount}} 丨 正确率:{{item.correctRate}}%</p>
  66. </div>
  67. <p class="position-p" v-if="item.hasWrongQuestion" @click.stop="tableButton(2,item)">历史错题</p>
  68. <el-progress
  69. class="num-p" type="circle"
  70. :stroke-width="4"
  71. :width="60" :percentage="item.progress">
  72. </el-progress>
  73. </div>
  74. </div>
  75. <pagination :page-sizes="[20, 30, 40, 50]"
  76. style="margin-right:20px;"
  77. v-show="total>0"
  78. :total="total"
  79. :page.sync="queryParams.page"
  80. :limit.sync="queryParams.pageSize"
  81. @pagination="getList"
  82. />
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <historyOfIncorrectQuestions :historyOfIncorrectQuestionsPropsData="historyOfIncorrectQuestionsPropsData" v-if="pageType === 2"></historyOfIncorrectQuestions>
  88. </div>
  89. </template>
  90. <script>
  91. //import { getDicts } from "@/api/commonality/noPermission";
  92. //import { systemUserSelect } from "@/api/commonality/permission";
  93. //import { getInfo } from "@/api/basicsModules/index";
  94. //import addPage from "./addPage.vue";
  95. import { examUserPracticeList,examElKnowledgePointTreeList, } from "@/api/safetyEducationExaminationNew/index";
  96. import historyOfIncorrectQuestions from "@/views/safetyEducationExaminationNew/components/historyOfIncorrectQuestions.vue";
  97. export default {
  98. name: 'index',
  99. components: {
  100. historyOfIncorrectQuestions,
  101. },
  102. data() {
  103. return {
  104. //页面状态
  105. pageType: 1,
  106. letDataList:[],
  107. leftDataIndex:0,
  108. //下拉列表数据
  109. optionListB: [],
  110. //查询条件
  111. practiceStatus:'',
  112. queryParams: {
  113. page: 1,
  114. pageSize: 20,
  115. knowledgePointId: null,
  116. searchName: ''
  117. },
  118. //列表数据
  119. dataList: [],
  120. //数据数量
  121. total: 0,
  122. historyOfIncorrectQuestionsPropsData:{},
  123. }
  124. },
  125. created() {
  126. },
  127. mounted() {
  128. this.examElKnowledgePointTreeList();
  129. },
  130. methods: {
  131. //左侧列表切换
  132. leftCheckButton(index){
  133. if(this.leftDataIndex != index){
  134. this.$set(this,'leftDataIndex',index);
  135. this.$set(this.queryParams, 'knowledgePointId', null);
  136. this.$set(this, 'optionListB', this.letDataList[index].children?this.letDataList[index].children:[]);
  137. this.handleQuery();
  138. }
  139. },
  140. //切换按钮
  141. tableTypeButton(val){
  142. if(this.practiceStatus !== val){
  143. this.$set(this,'practiceStatus',val);
  144. this.handleQuery();
  145. }
  146. },
  147. //查询按钮
  148. handleQuery() {
  149. this.$set(this.queryParams, 'page', 1)
  150. this.getList()
  151. },
  152. //重置按钮
  153. resetQuery() {
  154. this.$set(this, 'queryParams', {
  155. page: 1,
  156. pageSize: 20,
  157. knowledgePointId: null,
  158. searchName: ''
  159. })
  160. this.getList()
  161. },
  162. //获取数据列表
  163. getList() {
  164. let obj = JSON.parse(JSON.stringify(this.queryParams))
  165. if(!this.queryParams.knowledgePointId){
  166. obj.knowledgePointId = this.letDataList[this.leftDataIndex].id
  167. }
  168. obj.practiceStatus = this.practiceStatus;
  169. examUserPracticeList(obj).then(response => {
  170. this.$set(this, 'dataList', response.data.records)
  171. this.$set(this, 'total', response.data.total)
  172. })
  173. },
  174. //操作按钮
  175. tableButton(type, item) {
  176. let self = this
  177. if (type == 1) {
  178. //刷题练习
  179. this.$router.push({
  180. path: '/startPracticing',
  181. query: {
  182. knowledgePointId: item.knowledgePointId,
  183. type: '1'
  184. }
  185. })
  186. } else if (type == 2) {
  187. //历史错题
  188. this.$set(this,'historyOfIncorrectQuestionsPropsData',{
  189. type:3,
  190. knowledgePointId:item.knowledgePointId,
  191. });
  192. this.$set(this, 'pageType', 2)
  193. } else if (type == 6) {
  194. //返回并刷新
  195. this.$set(this, 'pageType', 1)
  196. this.getList()
  197. }
  198. },
  199. examElKnowledgePointTreeList(){
  200. let self = this;
  201. examElKnowledgePointTreeList({ dataScope:2 }).then(response => {
  202. const list = response.data || [];
  203. this.formatTreeData(list);
  204. this.$set(this, 'letDataList', [{knowledgePointName:'全部',id:''},...list]);
  205. if(this.$route.query.knowledgePointId){
  206. for(let i=0;i<self.letDataList.length;i++){
  207. if(self.letDataList[i].id == this.$route.query.knowledgePointId){
  208. self.$set(self,'leftDataIndex',i);
  209. }
  210. }
  211. }
  212. // this.$set(this, 'optionListB', list[0].children?list[0].children:[]);
  213. this.getList();
  214. });
  215. },
  216. }
  217. }
  218. </script>
  219. <style scoped lang="scss">
  220. .practiceQuestions {
  221. .practiceQuestionsPage {
  222. .pageTitle{
  223. height:60px;
  224. line-height:60px;
  225. padding:0 20px;
  226. border-bottom:1px solid #dedede;
  227. }
  228. .max-big-box{
  229. flex: 1;
  230. display: flex;
  231. overflow: hidden;
  232. .left-box{
  233. width:200px;
  234. border-right:1px solid #dedede;
  235. padding:20px 0 ;
  236. .left-for-p{
  237. margin:5px 0;
  238. padding:0 20px;
  239. text-align: center;
  240. border-left:6px solid #ffffff;
  241. cursor: pointer;
  242. font-weight:700;
  243. font-size:16px;
  244. line-height:40px;
  245. /*单行省略号*/
  246. display:block;
  247. overflow:hidden;
  248. text-overflow:ellipsis;
  249. white-space:nowrap;
  250. }
  251. .left-for-p:hover{
  252. background-color: #0183fa;
  253. color: #ffffff;
  254. }
  255. .leftCheck{
  256. color: #fff;
  257. background-color: #0183fa;
  258. /*border-right:4px solid #0183fa;*/
  259. }
  260. }
  261. .right-box{
  262. flex:1;
  263. display: flex;
  264. flex-direction: column;
  265. overflow: hidden;
  266. .top-max-button-box{
  267. display: flex;
  268. margin:20px 0 0 20px;
  269. p{
  270. width:120px;
  271. line-height:40px;
  272. border-radius:4px;
  273. color:#333;
  274. border:1px solid #333;
  275. text-align: center;
  276. margin-right:20px;
  277. cursor: pointer;
  278. }
  279. .top-check-button{
  280. border:1px solid #0183fa;
  281. background-color: #0183fa;
  282. color:#fff;
  283. }
  284. }
  285. .table-top-button-box{
  286. display: inline-block;
  287. vertical-align: top;
  288. margin-right:10px;
  289. div{
  290. display: flex;
  291. p{
  292. border:1px solid #DCDFE6;
  293. width:80px;
  294. text-align: center;
  295. height:40px;
  296. line-height:40px;
  297. cursor: pointer;
  298. font-size:14px;
  299. }
  300. p:nth-child(1){
  301. border-top-left-radius:4px;
  302. border-bottom-left-radius:4px;
  303. }
  304. p:nth-child(2){
  305. border-left:none;
  306. }
  307. p:nth-child(3){
  308. border-left:none;
  309. border-right:none;
  310. }
  311. p:nth-child(4){
  312. border-top-right-radius:4px;
  313. border-bottom-right-radius:4px;
  314. }
  315. .check-table-button{
  316. border:1px solid #0183fa;
  317. background-color: #0183fa;
  318. color:#fff;
  319. }
  320. }
  321. }
  322. .page-content-box{
  323. padding:20px 0;
  324. }
  325. .for-max-big-box{
  326. flex:1;
  327. .for-big-box{
  328. cursor: pointer;
  329. display: inline-block;
  330. width:660px;
  331. margin:0 0 20px 20px;
  332. border-radius:10px;
  333. overflow: hidden;
  334. box-shadow: 4px 4px 4px 4px rgba(0,0,0,0.1);
  335. position: relative;
  336. border:1px solid rgba(222,222,222,0.4);
  337. background-color: rgba(222,222,222,0.2);
  338. .title-p{
  339. margin:20px;
  340. font-size:16px;
  341. font-weight:700;
  342. }
  343. .text-box{
  344. margin:0 20px 20px 20px;
  345. background-color: rgba(1,131,250,0.1);
  346. overflow: hidden;
  347. border-radius:10px;
  348. padding:10px 20px;
  349. .text-min-box{
  350. height:40px;
  351. line-height: 40px;
  352. color:#0183fa;
  353. display: flex;
  354. p:nth-child(1){
  355. font-size:24px;
  356. line-height: 40px;
  357. margin-right:6px;
  358. }
  359. p:nth-child(2){
  360. font-size:16px;
  361. font-weight:700;
  362. }
  363. }
  364. .text-p{
  365. font-size:14px;
  366. color:#666;
  367. line-height:30px;
  368. font-weight:700;
  369. }
  370. }
  371. .position-p{
  372. position: absolute;
  373. right:20px;
  374. top:20px;
  375. color:#0183fa;
  376. font-weight:700;
  377. }
  378. .position-time{
  379. position: absolute;
  380. right:40px;
  381. bottom:29px;
  382. font-size:14px;
  383. color:#666;
  384. line-height:30px;
  385. font-weight:700;
  386. }
  387. .num-p{
  388. position: absolute;
  389. right:40px;
  390. bottom:65px;
  391. }
  392. .num-p ::v-deep .el-progress__text {
  393. margin-left:0!important;
  394. font-size:12px!important;
  395. }
  396. .num-p ::v-deep svg path:first-child {
  397. stroke: #cccccc !important; /* 修改为红色 */
  398. }
  399. }
  400. }
  401. }
  402. }
  403. }
  404. }
  405. </style>