feat: 页面绘制

This commit is contained in:
cgd_mac 2022-01-16 20:57:31 +08:00
parent 584b2135f5
commit 7c3530e498
5 changed files with 119 additions and 35 deletions

View File

@ -2,6 +2,9 @@ import request from '@/utils/request'
const examApi = { const examApi = {
examList: 'exam/list', // 我的考试-预约考试列表 examList: 'exam/list', // 我的考试-预约考试列表
attendList: 'exam/attend', // 我的考试-已参加考试
exam: 'exam/exam', // 我的考试进入考试
viewReport: 'exam/viewReport' // 查看报告
} }
export function reqExamList (params) { export function reqExamList (params) {
@ -11,3 +14,27 @@ export function reqExamList (params) {
params: params params: params
}) })
} }
export function reqExamAttendList (params) {
return request({
url: examApi.attendList,
method: 'get',
params: params
})
}
export function reqExamExam (params) {
return request({
url: examApi.exam,
method: 'get',
params: params
})
}
export function reqExamViewReport (params) {
return request({
url: examApi.viewReport,
method: 'get',
params: params
})
}

View File

@ -24,9 +24,20 @@
<span slot="index" slot-scope="text, record, index"> <span slot="index" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
</span> </span>
<span slot="action" slot-scope="text, record, index"> <template slot="testType" slot-scope="text, record">
<a v-if="index % 2 == 0" @click="handlerGoExam">进入考试</a> <a-tag v-if="record.testType == '1'" color="red">必修课</a-tag>
<a v-if="index % 2 == 1" disabled>已预约</a> <a-tag v-if="record.testType == '2'" color="blue">选修课</a-tag>
</template>
<template slot="examTime" slot-scope="text, record">
{{ record.examTime }}分钟
</template>
<span slot="action" slot-scope="text, record">
<template v-if="record.subscribeStatus == 0">
<a disabled>预约考试</a>
</template>
<template v-else>
<a @click="handlerGoExam(record)">进入考试</a>
</template>
</span> </span>
</s-table> </s-table>
</a-tab-pane> </a-tab-pane>
@ -40,8 +51,15 @@
<span slot="index" slot-scope="text, record, index"> <span slot="index" slot-scope="text, record, index">
{{ index + 1 }} {{ index + 1 }}
</span> </span>
<span slot="action" slot-scope="text, record, index"> <template slot="testType" slot-scope="text, record">
<a @click="handlerGoReport">查看详情</a> <a-tag v-if="record.testType == '1'" color="red">必修课</a-tag>
<a-tag v-if="record.testType == '2'" color="blue">选修课</a-tag>
</template>
<template slot="examTime" slot-scope="text, record">
{{ record.examTime }}分钟
</template>
<span slot="action" slot-scope="text, record">
<a @click="handlerGoReport(record)">查看详情</a>
</span> </span>
</s-table> </s-table>
</a-tab-pane> </a-tab-pane>
@ -51,7 +69,7 @@
<script> <script>
import { STable, SearchCom } from '@/components' import { STable, SearchCom } from '@/components'
import { reqExamList } from '@/api/myexam/exam' import { reqExamList, reqExamAttendList } from '@/api/myexam/exam'
export default { export default {
components: { STable, SearchCom }, components: { STable, SearchCom },
@ -74,23 +92,25 @@ export default {
}, },
{ {
title: '考试科目', title: '考试科目',
dataIndex: 'name' dataIndex: 'projectName'
}, },
{ {
title: '准考证号', title: '准考证号',
dataIndex: 'carId' dataIndex: 'candidateNo'
}, },
{ {
title: '考试形式', title: '考试形式',
dataIndex: 'type' dataIndex: 'testType',
scopedSlots: { customRender: 'testType' }
}, },
{ {
title: '考试时间', title: '考试时间',
dataIndex: 'date' dataIndex: 'examSdate'
}, },
{ {
title: '考试时长', title: '考试时长',
dataIndex: 'length' dataIndex: 'examTime',
scopedSlots: { customRender: 'examTime' }
}, },
{ {
title: '考试资格', title: '考试资格',
@ -112,27 +132,29 @@ export default {
}, },
{ {
title: '考试科目', title: '考试科目',
dataIndex: 'name' dataIndex: 'projectName'
}, },
{ {
title: '准考证号', title: '准考证号',
dataIndex: 'carId' dataIndex: 'candidateNo'
}, },
{ {
title: '考试形式', title: '考试形式',
dataIndex: 'type' dataIndex: 'testType',
scopedSlots: { customRender: 'testType' }
}, },
{ {
title: '答卷时间', title: '答卷时间',
dataIndex: 'date' dataIndex: 'practiceSdate'
}, },
{ {
title: '考试时长', title: '考试时长',
dataIndex: 'length' dataIndex: 'examTime',
scopedSlots: { customRender: 'examTime' }
}, },
{ {
title: '考试成绩', title: '考试成绩',
dataIndex: 'zige' dataIndex: 'score'
}, },
{ {
title: '操作', title: '操作',
@ -147,14 +169,13 @@ export default {
}) })
}, },
loadExamDoneData: parameter => { loadExamDoneData: parameter => {
return reqExamList(Object.assign(parameter, this.queryParam)).then(res => { return reqExamAttendList(Object.assign(parameter, this.queryParam)).then(res => {
return res return res
}) })
} }
} }
}, },
mounted () { mounted () {
this.getExamTypeList()
}, },
methods: { methods: {
// //
@ -166,15 +187,14 @@ export default {
this.$refs.examDoneColumns.refresh() this.$refs.examDoneColumns.refresh()
} }
}, },
handlerGoExam () { handlerGoExam (row) {
this.$router.push({ path: '/myexamDetail', query: { type: 'exam' } }) // 5(...)
// const diff = new Date().getTime() - new Date(examSdate).getTime()
// if(diff > -1000*60*5){}
this.$router.push({ path: '/myexamDetail', query: { type: 'exam', projectId: row.id } })
}, },
handlerGoReport () { handlerGoReport (row) {
this.$router.push({ path: '/myreport', query: { type: 'exam' } }) this.$router.push({ path: '/myreport', query: { type: 'exam', reportId: row.id } })
},
//
getExamTypeList () {
} }
} }
} }

View File

@ -7,6 +7,7 @@
<script> <script>
import DbExam from '@/components/DbExam/index' import DbExam from '@/components/DbExam/index'
import { practiceStartAnswer, practiceExecuteSubmit } from '@/api/practice/practice' import { practiceStartAnswer, practiceExecuteSubmit } from '@/api/practice/practice'
import { reqExamExam } from '@/api/myexam/exam.js'
import _ from 'lodash' import _ from 'lodash'
export default { export default {
components: { DbExam }, components: { DbExam },
@ -26,15 +27,22 @@ export default {
initData () { initData () {
const { type } = this.query const { type } = this.query
if (type === 'practice') { if (type === 'practice') {
console.log('练习')
this.getPracticeDetail() this.getPracticeDetail()
} }
if (type === 'exam') {
this.getExamDetail()
}
}, },
// //
getPracticeDetail () { getPracticeDetail () {
const query = this.query const query = this.query
practiceStartAnswer({ projectId: Number(query.projectId), courseId: Number(query.courseId), type: Number(query.practiceType || 1) }).then(res => { practiceStartAnswer({ projectId: Number(query.projectId), courseId: Number(query.courseId), type: Number(query.practiceType || 1) }).then(res => {
console.log('res', res) this.examData = res.data
})
},
//
getExamDetail () {
reqExamExam({ projectId: this.query.projectId }).then((res) => {
this.examData = res.data this.examData = res.data
}) })
}, },

View File

@ -0,0 +1,15 @@
<template>
<a-card :bordered="false">
我的公告
</a-card>
</template>
<script>
export default {
}
</script>
<style lang="less" scoped>
</style>

View File

@ -4,8 +4,8 @@
<a-tab-pane key="1" tab="答题报告"> <a-tab-pane key="1" tab="答题报告">
<a-card :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}"> <a-card :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}">
<template slot="title"> <template slot="title">
<h3>{{viewReport.courseName}}</h3> <h3>{{ viewReport.courseName }}</h3>
<div class="sub-info"><span>交卷时间{{viewReport.submitTime}}</span><span v-if="viewReport.totalScore">答题用时{{viewReport.totalScore}}</span></div> <div class="sub-info"><span>交卷时间{{ viewReport.submitTime }}</span><span v-if="viewReport.totalScore">答题用时{{ viewReport.totalScore }}</span></div>
<DbReport :data="viewReport.reportItems"></DbReport> <DbReport :data="viewReport.reportItems"></DbReport>
</template> </template>
</a-card> </a-card>
@ -13,7 +13,7 @@
<a-tab-pane key="2" tab="查看解析"> <a-tab-pane key="2" tab="查看解析">
<a-card :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}"> <a-card :bordered="false" :bodyStyle="{padding: '0px !important'}" :headStyle="{paddingLeft: '0px !important'}">
<template slot="title"> <template slot="title">
<h4>{{viewReport.courseName}}</h4> <h4>{{ viewReport.courseName }}</h4>
<div class="sub-info"><span>选择题30/30</span><span>选择题30/30</span><span>选择题30/30</span></div> <div class="sub-info"><span>选择题30/30</span><span>选择题30/30</span><span>选择题30/30</span></div>
</template> </template>
<template v-for="(item, index) in viewResolution" > <template v-for="(item, index) in viewResolution" >
@ -32,6 +32,7 @@
import DbQuestionInfoItem from '@/components/DbQuestionInfoItem/index.vue' import DbQuestionInfoItem from '@/components/DbQuestionInfoItem/index.vue'
import DbReport from '@/components/DbReport/index.vue' import DbReport from '@/components/DbReport/index.vue'
import { answerViewReport, answerViewResolution } from '@/api/practice/report' import { answerViewReport, answerViewResolution } from '@/api/practice/report'
import { reqExamViewReport } from '@/api/myexam/exam.js'
export default { export default {
components: { DbQuestionInfoItem, DbReport }, components: { DbQuestionInfoItem, DbReport },
@ -44,11 +45,24 @@ export default {
} }
}, },
mounted () { mounted () {
this.query = this.$route.query const query = this.$route.query
this.getAnswerViewReport() this.query = query
this.getAnswerViewResolution() if (query.type === 'practice') {
this.getAnswerViewReport()
this.getAnswerViewResolution()
}
if (query.type === 'exam') {
this.getExamViewReport()
}
}, },
methods: { methods: {
// start
getExamViewReport () {
reqExamViewReport({ projectId: this.query.reportId }).then(res => {
this.viewReport = res.data
})
},
// start
getAnswerViewReport () { getAnswerViewReport () {
answerViewReport({ reportId: Number(this.query.reportId) }).then(res => { answerViewReport({ reportId: Number(this.query.reportId) }).then(res => {
this.viewReport = res.data this.viewReport = res.data