feat: 考试时间

This commit is contained in:
cgd_mac 2022-02-23 19:02:46 +08:00
parent 2eab206ee2
commit 15c636acd0
4 changed files with 76 additions and 42 deletions

View File

@ -3,9 +3,9 @@
<div class="answer-card"> <div class="answer-card">
<a-card :bordered="false"> <a-card :bordered="false">
<div @click="handlerBack" class="answer-card-title"><a-icon type="arrow-left" style="margin-right: 6px;" />答题卡</div> <div @click="handlerBack" class="answer-card-title"><a-icon type="arrow-left" style="margin-right: 6px;" />答题卡</div>
<div class="answer-cart-time"> <div v-if="data.examTime" class="answer-cart-time">
倒计时: 倒计时:
<b style="margin-left: 5px;"><a-statistic-countdown :value="deadline" :valueStyle="{ fontSize: '16px' }" @finish="onFinish"/></b> <b style="margin-left: 5px;"><a-statistic-countdown :value="Date.now() + data.examTime*60*1000" :valueStyle="{ fontSize: '16px' }" @finish="onFinish"/></b>
</div> </div>
<DbAnswerCard :data="data"></DbAnswerCard> <DbAnswerCard :data="data"></DbAnswerCard>
<div class="answer-cart-footer flex-center" style="margin-top: 20px;"> <div class="answer-cart-footer flex-center" style="margin-top: 20px;">
@ -89,12 +89,23 @@ export default {
}, },
methods: { methods: {
// //
onFinish () {}, onFinish () {
this.$emit('submit', this.data)
},
handlerBack () { handlerBack () {
this.$router.go(-1) this.$router.go(-1)
}, },
handlerSubmit () { handlerSubmit () {
this.$emit('submit', this.data) const _this = this
this.$confirm({
title: '安全培训',
content: '一但提交将不能修改,确定要现在提交吗?',
onOk () {
// change()
_this.$emit('submit', _this.data)
},
onCancel () {}
})
} }
} }
} }

View File

@ -163,10 +163,14 @@ export default {
methods: { methods: {
// //
goback() { goback() {
if(this.$route.query.isOther){
this.$router.go(-1)
}else{
this.$router.push({ this.$router.push({
path: '/course/CoursewareList', path: '/course/CoursewareList',
query: { id: this.$route.query.courseId, type: this.$route.query.types }, query: { id: this.$route.query.courseId, type: this.$route.query.types },
}) })
}
}, },
/// ///

View File

@ -19,10 +19,12 @@ export default {
data () { data () {
return { return {
examData: {}, examData: {},
query: {} query: {},
startTime: 0
} }
}, },
mounted () { mounted () {
this.startTime = Date.now()
this.query = this.$route.query this.query = this.$route.query
this.$nextTick(() => { this.$nextTick(() => {
this.initData() this.initData()
@ -134,7 +136,7 @@ export default {
const params = { const params = {
projectId: query.projectId, projectId: query.projectId,
courseId: query.courseId, courseId: query.courseId,
answerTime: 0, answerTime: Number.parseInt((Date.now() - this.startTime) / 1000),
type: query.practiceType, type: query.practiceType,
questionList: this.formatSubmit(result) questionList: this.formatSubmit(result)
} }
@ -149,7 +151,7 @@ export default {
const params = { const params = {
projectId: query.projectId, projectId: query.projectId,
courseId: query.courseId, courseId: query.courseId,
answerTime: 0, answerTime: Number.parseInt((Date.now() - this.startTime) / 1000),
type: query.practiceType, type: query.practiceType,
questionList: this.formatSubmit(result) questionList: this.formatSubmit(result)
} }
@ -164,7 +166,7 @@ export default {
const params = { const params = {
projectId: query.projectId, projectId: query.projectId,
courseId: query.courseId, courseId: query.courseId,
answerTime: 0, answerTime: Number.parseInt((Date.now() - this.startTime) / 1000),
type: query.practiceType, type: query.practiceType,
examType: query.type === 'test' ? 1 : (query.type === 'operation' ? 3 : 2), examType: query.type === 'test' ? 1 : (query.type === 'operation' ? 3 : 2),
questionList: this.formatSubmit(result) questionList: this.formatSubmit(result)

View File

@ -7,21 +7,42 @@
@search="handleRefresh" @search="handleRefresh"
@reset=" @reset="
() => { () => {
queryParam = {} queryParam = {};
handleRefresh() handleRefresh();
} }
"></SearchCom> "
></SearchCom>
</div> </div>
<template v-if="dataList && dataList.length > 0"> <template v-if="dataList && dataList.length > 0">
<a-card v-for="(item, index) in dataList" :key="index" style="margin-bottom: 15px;"> <a-card v-for="(item, index) in dataList" :key="index" style="margin-bottom: 15px;">
<div class="flex-center"> <div class="flex-center">
<div style="flex: 1;"> <div style="flex: 1;">
<h3>{{ item.name }}</h3> <h3>{{ item.name }}</h3>
<div><span style="margin-right: 20px;">下载次数{{ item.rightQuestions }}</span><span>预览次数{{ item.submitTime }}</span></div> <div>
<span style="margin-right: 20px;">下载次数{{ item.downCount || 0 }}</span>
<span>预览次数{{ item.viewCount }}</span>
</div>
</div> </div>
<div style="flex: 0 0 200px; text-align: right;"> <div style="flex: 0 0 200px; text-align: right;">
<div @click="handlerDown(item)" :span="24" style="margin-bottom: 10px;"><a-button type="primary" size="small" >下载</a-button></div> <!-- <div @click="handlerDown(item)" :span="24" style="margin-bottom: 10px;"><a-button type="primary" size="small" >下载</a-button></div> -->
<div @click="handlerPreview(item)" :span="24"><a-button type="danger" size="small">预览</a-button></div> <a-popover title="资源下载">
<template slot="content">
<a
style="display: block;margin-bottom:15px"
v-for="j in item.videoList"
:href="j.path"
:key="j.id"
>
{{ j.name }}
</a>
</template>
<div :span="24" style="margin-bottom: 10px;">
<a-button type="primary" size="small">下载</a-button>
</div>
</a-popover>
<div @click="handlerPreview(item)" :span="24">
<a-button type="danger" size="small">预览</a-button>
</div>
</div> </div>
</div> </div>
</a-card> </a-card>
@ -32,7 +53,6 @@
<template v-else> <template v-else>
<a-empty style="margin: 30px 0;" /> <a-empty style="margin: 30px 0;" />
</template> </template>
</a-card> </a-card>
</template> </template>
@ -54,24 +74,27 @@ export default {
pageNum: 1 pageNum: 1
}, },
queryParam: { queryParam: {
name: '', // classify: ''
trainWay: ''
}, },
queryOptions: [ queryOptions: [
{ type: 'select-dic-tree', placeholder: '课程类别', key: 'trainWay', options: [] } { type: 'select-dic-tree', placeholder: '课件类别', key: 'classify', options: [] }
] ]
} }
}, },
created () {
this.dictionaryDropDown()
},
mounted () { mounted () {
this.dictionaryDropDown()
this.getList() this.getList()
}, },
methods: { methods: {
//
dictionaryDropDown () {
dictionaryDropDown({ dictionaryCode: '0009' }).then(res => {
this.queryOptions[0].options = dictToTree(res.data, [], 0)
this.loading = false
})
},
getList () { getList () {
gerMyresource(this.params).then(res => { gerMyresource({ ...this.params, ...this.queryParam }).then(res => {
console.log('>>>>>>', res)
this.dataList = res.rows this.dataList = res.rows
this.total = res.total this.total = res.total
}) })
@ -83,24 +106,18 @@ export default {
this.getList() this.getList()
}) })
}, },
handlerDown () { handlerDown () {},
handlerPreview (data) {
this.$router.push({
path: '/course/CoursewarePreview',
query: { coursewareId: data.id, courseId: data.courseId, types: 'self', isOther: 1 }
})
}, },
handlerPreview () {},
handleRefresh () { handleRefresh () {
this.getList() this.getList()
},
//
dictionaryDropDown () {
dictionaryDropDown({ dictionaryCode: '0006' }).then((res) => {
this.queryOptions[1].options = dictToTree(res.data, [], 0)
this.loading = false
})
} }
} }
} }
</script> </script>
<style lang="less"> <style lang="less"></style>
</style>