| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407 |
- <!-- 刷题练习 -->
- <template>
- <div class="app-container practiceQuestions">
- <div class="page-container practiceQuestionsPage" v-if="pageType === 1">
- <p class="pageTitle">刷题练习</p>
- <div class="max-big-box">
- <div class="left-box scrollbar-box">
- <p @click="leftCheckButton(index)"
- v-for="(item,index) in letDataList" :key="index"
- class="left-for-p" :class="index==leftDataIndex?'leftCheck':''">
- {{item.knowledgePointName}}
- </p>
- </div>
- <div class="right-box">
- <div class="page-form-title-box">
- <el-form :model="queryParams" class="form-box" ref="queryForm"
- :inline="true" style="width:100%;">
- <div class="table-top-button-box">
- <div>
- <p :class="practiceStatus === ''?'check-table-button':''" @click="tableTypeButton('')">全部</p>
- <p :class="practiceStatus === 0?'check-table-button':''" @click="tableTypeButton(0)">未开始</p>
- <p :class="practiceStatus === 1?'check-table-button':''" @click="tableTypeButton(1)">练习中</p>
- <p :class="practiceStatus === 2?'check-table-button':''" @click="tableTypeButton(2)">已学完</p>
- </div>
- </div>
- <el-form-item label="" prop="knowledgePointId">
- <el-cascader
- v-model="queryParams.knowledgePointId"
- :options="optionListB"
- :props="{
- emitPath:false,
- checkStrictly: true,
- value: 'id',
- label: 'knowledgePointName',
- children: 'children',
- }"
- style="width: 180px"
- :show-all-levels="false"
- filterable
- placeholder="知识点"
- ></el-cascader>
- </el-form-item>
- <el-form-item label="" prop="searchName">
- <el-input
- maxLength="30"
- v-model="queryParams.searchName"
- placeholder="搜索名称"
- style="width: 200px"
- />
- </el-form-item>
- <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
- <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
- </el-form>
- </div>
- <div class="page-content-box">
- <div class="for-max-big-box scrollbar-box">
- <div class="for-big-box" v-for="(item,index) in dataList" :key="index" @click="tableButton(1,item)">
- <p class="title-p">{{item.knowledgePointName}}</p>
- <div class="text-box">
- <div class="text-min-box">
- <p class="el-icon-time"></p>
- <p :style="!item.lastAnswerTime?'font-size:14px;':''">{{item.lastAnswerTime?parseTime(item.lastAnswerTime,"{y}-{m}-{d} {h}:{i}"):'未练习'}}</p>
- </div>
- <p class="text-p">练习进度:{{item.answeredCount}} / {{item.totalCount}}</p>
- <p class="text-p">正确数:{{item.correctCount}} 丨 错题数:{{item.wrongCount}} 丨 正确率:{{item.correctRate}}%</p>
- </div>
- <p class="position-p" v-if="item.hasWrongQuestion" @click.stop="tableButton(2,item)">历史错题</p>
- <el-progress
- class="num-p" type="circle"
- :stroke-width="4"
- :width="60" :percentage="item.progress">
- </el-progress>
- </div>
- </div>
- <pagination :page-sizes="[20, 30, 40, 50]"
- style="margin-right:20px;"
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.page"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- </div>
- </div>
- </div>
- <historyOfIncorrectQuestions :historyOfIncorrectQuestionsPropsData="historyOfIncorrectQuestionsPropsData" v-if="pageType === 2"></historyOfIncorrectQuestions>
- </div>
- </template>
- <script>
- //import { getDicts } from "@/api/commonality/noPermission";
- //import { systemUserSelect } from "@/api/commonality/permission";
- //import { getInfo } from "@/api/basicsModules/index";
- //import addPage from "./addPage.vue";
- import { examUserPracticeList,examElKnowledgePointTreeList, } from "@/api/safetyEducationExaminationNew/index";
- import historyOfIncorrectQuestions from "@/views/safetyEducationExaminationNew/components/historyOfIncorrectQuestions.vue";
- export default {
- name: 'index',
- components: {
- historyOfIncorrectQuestions,
- },
- data() {
- return {
- //页面状态
- pageType: 1,
- letDataList:[],
- leftDataIndex:0,
- //下拉列表数据
- optionListB: [],
- //查询条件
- practiceStatus:'',
- queryParams: {
- page: 1,
- pageSize: 20,
- knowledgePointId: null,
- searchName: ''
- },
- //列表数据
- dataList: [],
- //数据数量
- total: 0,
- historyOfIncorrectQuestionsPropsData:{},
- }
- },
- created() {
- },
- mounted() {
- this.examElKnowledgePointTreeList();
- },
- methods: {
- //左侧列表切换
- leftCheckButton(index){
- if(this.leftDataIndex != index){
- this.$set(this,'leftDataIndex',index);
- this.$set(this.queryParams, 'knowledgePointId', null);
- this.$set(this, 'optionListB', this.letDataList[index].children?this.letDataList[index].children:[]);
- this.handleQuery();
- }
- },
- //切换按钮
- tableTypeButton(val){
- if(this.practiceStatus !== val){
- this.$set(this,'practiceStatus',val);
- this.handleQuery();
- }
- },
- //查询按钮
- handleQuery() {
- this.$set(this.queryParams, 'page', 1)
- this.getList()
- },
- //重置按钮
- resetQuery() {
- this.$set(this, 'queryParams', {
- page: 1,
- pageSize: 20,
- knowledgePointId: null,
- searchName: ''
- })
- this.getList()
- },
- //获取数据列表
- getList() {
- let obj = JSON.parse(JSON.stringify(this.queryParams))
- if(!this.queryParams.knowledgePointId){
- obj.knowledgePointId = this.letDataList[this.leftDataIndex].id
- }
- obj.practiceStatus = this.practiceStatus;
- examUserPracticeList(obj).then(response => {
- this.$set(this, 'dataList', response.data.records)
- this.$set(this, 'total', response.data.total)
- })
- },
- //操作按钮
- tableButton(type, item) {
- let self = this
- if (type == 1) {
- //刷题练习
- this.$router.push({
- path: '/startPracticing',
- query: {
- knowledgePointId: item.knowledgePointId,
- type: '1'
- }
- })
- } else if (type == 2) {
- //历史错题
- this.$set(this,'historyOfIncorrectQuestionsPropsData',{
- type:3,
- knowledgePointId:item.knowledgePointId,
- });
- this.$set(this, 'pageType', 2)
- } else if (type == 6) {
- //返回并刷新
- this.$set(this, 'pageType', 1)
- this.getList()
- }
- },
- examElKnowledgePointTreeList(){
- let self = this;
- examElKnowledgePointTreeList({ dataScope:2 }).then(response => {
- const list = response.data || [];
- this.formatTreeData(list);
- this.$set(this, 'letDataList', [{knowledgePointName:'全部',id:''},...list]);
- if(this.$route.query.knowledgePointId){
- for(let i=0;i<self.letDataList.length;i++){
- if(self.letDataList[i].id == this.$route.query.knowledgePointId){
- self.$set(self,'leftDataIndex',i);
- }
- }
- }
- // this.$set(this, 'optionListB', list[0].children?list[0].children:[]);
- this.getList();
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .practiceQuestions {
- .practiceQuestionsPage {
- .pageTitle{
- height:60px;
- line-height:60px;
- padding:0 20px;
- border-bottom:1px solid #dedede;
- }
- .max-big-box{
- flex: 1;
- display: flex;
- overflow: hidden;
- .left-box{
- width:200px;
- border-right:1px solid #dedede;
- padding:20px 0 ;
- .left-for-p{
- margin:5px 0;
- padding:0 20px;
- text-align: center;
- border-left:6px solid #ffffff;
- cursor: pointer;
- font-weight:700;
- font-size:16px;
- line-height:40px;
- /*单行省略号*/
- display:block;
- overflow:hidden;
- text-overflow:ellipsis;
- white-space:nowrap;
- }
- .left-for-p:hover{
- background-color: #0183fa;
- color: #ffffff;
- }
- .leftCheck{
- color: #fff;
- background-color: #0183fa;
- /*border-right:4px solid #0183fa;*/
- }
- }
- .right-box{
- flex:1;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- .top-max-button-box{
- display: flex;
- margin:20px 0 0 20px;
- p{
- width:120px;
- line-height:40px;
- border-radius:4px;
- color:#333;
- border:1px solid #333;
- text-align: center;
- margin-right:20px;
- cursor: pointer;
- }
- .top-check-button{
- border:1px solid #0183fa;
- background-color: #0183fa;
- color:#fff;
- }
- }
- .table-top-button-box{
- display: inline-block;
- vertical-align: top;
- margin-right:10px;
- div{
- display: flex;
- p{
- border:1px solid #DCDFE6;
- width:80px;
- text-align: center;
- height:40px;
- line-height:40px;
- cursor: pointer;
- font-size:14px;
- }
- p:nth-child(1){
- border-top-left-radius:4px;
- border-bottom-left-radius:4px;
- }
- p:nth-child(2){
- border-left:none;
- }
- p:nth-child(3){
- border-left:none;
- border-right:none;
- }
- p:nth-child(4){
- border-top-right-radius:4px;
- border-bottom-right-radius:4px;
- }
- .check-table-button{
- border:1px solid #0183fa;
- background-color: #0183fa;
- color:#fff;
- }
- }
- }
- .page-content-box{
- padding:20px 0;
- }
- .for-max-big-box{
- flex:1;
- .for-big-box{
- cursor: pointer;
- display: inline-block;
- width:660px;
- margin:0 0 20px 20px;
- border-radius:10px;
- overflow: hidden;
- box-shadow: 4px 4px 4px 4px rgba(0,0,0,0.1);
- position: relative;
- border:1px solid rgba(222,222,222,0.4);
- background-color: rgba(222,222,222,0.2);
- .title-p{
- margin:20px;
- font-size:16px;
- font-weight:700;
- }
- .text-box{
- margin:0 20px 20px 20px;
- background-color: rgba(1,131,250,0.1);
- overflow: hidden;
- border-radius:10px;
- padding:10px 20px;
- .text-min-box{
- height:40px;
- line-height: 40px;
- color:#0183fa;
- display: flex;
- p:nth-child(1){
- font-size:24px;
- line-height: 40px;
- margin-right:6px;
- }
- p:nth-child(2){
- font-size:16px;
- font-weight:700;
- }
- }
- .text-p{
- font-size:14px;
- color:#666;
- line-height:30px;
- font-weight:700;
- }
- }
- .position-p{
- position: absolute;
- right:20px;
- top:20px;
- color:#0183fa;
- font-weight:700;
- }
- .position-time{
- position: absolute;
- right:40px;
- bottom:29px;
- font-size:14px;
- color:#666;
- line-height:30px;
- font-weight:700;
- }
- .num-p{
- position: absolute;
- right:40px;
- bottom:65px;
- }
- .num-p ::v-deep .el-progress__text {
- margin-left:0!important;
- font-size:12px!important;
- }
- .num-p ::v-deep svg path:first-child {
- stroke: #cccccc !important; /* 修改为红色 */
- }
- }
- }
- }
- }
- }
- }
- </style>
|