|
|
|
@ -102,14 +102,16 @@ |
|
|
|
|
<!-- 简答题需要展示题干文件及富文本 --> |
|
|
|
|
<template v-if="item.questionType === 'essay'"> |
|
|
|
|
<div v-if="ques.stemAttachment" class="m-b-20"> |
|
|
|
|
<el-link class="m-r-10" type="primary">{{ ques.stemAttachment }}</el-link> |
|
|
|
|
<el-button type="primary" size="mini" round @click="download(ques.stemAttachment)">下载</el-button> |
|
|
|
|
<el-link class="m-r-10" type="primary" @click="preview(ques.stemAttachment)">{{ ques.fileName || |
|
|
|
|
ques.stemAttachment }}</el-link> |
|
|
|
|
<el-button type="primary" size="mini" round |
|
|
|
|
@click="download(ques.fileName || ques.stemAttachment, ques.stemAttachment)">下载</el-button> |
|
|
|
|
</div> |
|
|
|
|
<UeditorPlus :ref="'essayAnswer' + ques.id" v-model="ques.answer" |
|
|
|
|
@ready="editor => essayAnswerReady(editor, ques)" /> |
|
|
|
|
<div v-if="ques.allowAttachment" class="m-t-20"> |
|
|
|
|
<div v-if="ques.uploadInstructions" class="flex m-b-10 fs-12"> |
|
|
|
|
<span>上传附件:</span> |
|
|
|
|
<span>上传要求说明:</span> |
|
|
|
|
<div v-html="ques.uploadInstructions"></div> |
|
|
|
|
</div> |
|
|
|
|
<Upload style="max-width: 700px;" accept=".csv,.xlsx,.xls,.docx,.doc,.pdf,.jpg,.png,.zip,.rar,.7z" |
|
|
|
@ -129,6 +131,12 @@ |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="图片预览" :visible.sync="previewImgVisible" width="800px" :close-on-click-modal="false"> |
|
|
|
|
<el-image style="max-width: 100px; max-height: 100px" :src="previewImg" :preview-src-list="[previewImg]"> |
|
|
|
|
</el-image> |
|
|
|
|
</el-dialog> |
|
|
|
|
<PdfDia :key="pdfVisible" :visible.sync="pdfVisible" :src.sync="pdfSrc" /> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -141,11 +149,12 @@ import _ from 'lodash' |
|
|
|
|
import Oss from '@/components/upload/upload.js' |
|
|
|
|
import Upload from '@/components/upload' |
|
|
|
|
import UeditorPlus from '@/components/ueditorPlus' |
|
|
|
|
import PdfDia from '@/components/pdf' |
|
|
|
|
import Bus from '@/libs/bus' |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
Upload, UeditorPlus |
|
|
|
|
Upload, UeditorPlus, PdfDia |
|
|
|
|
}, |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
@ -166,6 +175,7 @@ export default { |
|
|
|
|
stageName: '', |
|
|
|
|
paperName: '', |
|
|
|
|
}, |
|
|
|
|
timer: null, |
|
|
|
|
counterTimer: null, |
|
|
|
|
countVal: 0, |
|
|
|
|
// 倒计时 |
|
|
|
@ -193,12 +203,15 @@ export default { |
|
|
|
|
submited: false, |
|
|
|
|
warned: 0, |
|
|
|
|
quesWrapWidth: 0, |
|
|
|
|
previewImgVisible: false, |
|
|
|
|
previewImg: '', |
|
|
|
|
pdfVisible: false, |
|
|
|
|
pdfSrc: '', |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
mounted () { |
|
|
|
|
this.$once('hook:beforeDestroy', function () { |
|
|
|
|
clearInterval(this.counterTimer) |
|
|
|
|
this.submited || this.submit(0) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
// websocket实时刷新 |
|
|
|
@ -328,6 +341,12 @@ export default { |
|
|
|
|
n.answered = hasFillLen === inputs.length ? 1 : 0 |
|
|
|
|
n.partAnswer = hasFillLen && hasFillLen !== inputs.length ? 1 : 0 |
|
|
|
|
|
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
this.submit(0) |
|
|
|
|
this.calcProgress() |
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
|
|
text = text.trim() |
|
|
|
|
|
|
|
|
|
// // 调整宽度 |
|
|
|
@ -473,11 +492,13 @@ export default { |
|
|
|
|
|
|
|
|
|
ques.answered = 1 |
|
|
|
|
this.calcProgress() |
|
|
|
|
this.submit(0) |
|
|
|
|
}, |
|
|
|
|
// 多选题回调 |
|
|
|
|
mulChange (ques) { |
|
|
|
|
ques.answered = ques.questionAnswerVersionsList.some(e => e.answer) |
|
|
|
|
this.calcProgress() |
|
|
|
|
this.submit(0) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 简答题富文本加载完毕回调 |
|
|
|
@ -487,13 +508,31 @@ export default { |
|
|
|
|
const content = editor.getContent() |
|
|
|
|
ques.answered = content ? 1 : 0 |
|
|
|
|
ques.answers = content |
|
|
|
|
this.calcProgress() |
|
|
|
|
|
|
|
|
|
clearTimeout(this.timer) |
|
|
|
|
this.timer = setTimeout(() => { |
|
|
|
|
this.submit(0) |
|
|
|
|
this.calcProgress() |
|
|
|
|
}, 500) |
|
|
|
|
}) |
|
|
|
|
ques.answer && editor.setContent(ques.answer) |
|
|
|
|
}, |
|
|
|
|
// 预览附件 |
|
|
|
|
preview (url) { |
|
|
|
|
const ext = url.split('.').pop() |
|
|
|
|
if (Util.isDoc(ext)) { |
|
|
|
|
window.open('https://view.officeapps.live.com/op/view.aspx?src=' + url) |
|
|
|
|
} else if (Util.isImg(ext)) { |
|
|
|
|
this.previewImgVisible = true |
|
|
|
|
this.previewImg = url |
|
|
|
|
} else if (ext === 'pdf') { |
|
|
|
|
this.pdfVisible = true |
|
|
|
|
this.pdfSrc = url |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 下载附件 |
|
|
|
|
download (url) { |
|
|
|
|
Util.downloadFile(url, url) |
|
|
|
|
download (name, url) { |
|
|
|
|
Util.downloadFile(name, url) |
|
|
|
|
}, |
|
|
|
|
handleRemove (ques) { |
|
|
|
|
Oss.del(ques.attachmentUrl) |
|
|
|
@ -531,11 +570,10 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
async submit (isSubmit) { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
if (isSubmit && this.submiting) return false |
|
|
|
|
try { |
|
|
|
|
this.submiting = true |
|
|
|
|
if (isSubmit) this.submiting = true |
|
|
|
|
const form = _.cloneDeep(this.form) |
|
|
|
|
const now = await Util.getNow() |
|
|
|
|
const { entryTime, curStage } = this |
|
|
|
|
const ques = [] |
|
|
|
|
form.paperOutline.map(e => { |
|
|
|
@ -564,27 +602,31 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
const timeSum = Math.ceil((now - entryTime) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
|
const submitTime = Util.formatDate('yyyy-MM-dd hh:mm:ss', now) |
|
|
|
|
|
|
|
|
|
// 缓存跟提交接口的参数一样 |
|
|
|
|
await this.$post(this.api[isSubmit ? 'submitTheExamPaper' : 'examPaperRecordCache'], { |
|
|
|
|
const data = { |
|
|
|
|
competitionId: this.id, |
|
|
|
|
stageId: curStage.stageId, |
|
|
|
|
teamId: this.teamId, |
|
|
|
|
startTime: Util.formatDate('yyyy-MM-dd hh:mm:ss', entryTime), // 取页面进入的时间 |
|
|
|
|
endTime: this.per ? curStage.endTime : submitTime, // 结束时间(考核:直接从职站取考核的结束时间;练习:取提交时间) |
|
|
|
|
submitTime, // 提交时间,即当前时间(这3个时间都是传完整的日期时间格式) |
|
|
|
|
timeSum, |
|
|
|
|
totalScore: form.score, |
|
|
|
|
paperId: curStage.paperId, |
|
|
|
|
examSubmitJudgeList: ques, |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
// if (isSubmit) { |
|
|
|
|
const now = isSubmit ? await Util.getNow() : new Date() |
|
|
|
|
const submitTime = Util.formatDate('yyyy-MM-dd hh:mm:ss', now) |
|
|
|
|
data.endTime = this.per ? curStage.endTime : submitTime |
|
|
|
|
data.submitTime = submitTime |
|
|
|
|
data.timeSum = Math.ceil((now - entryTime) / 60000) // 计算实验用时(分钟),向上取整 |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// 缓存跟提交接口的参数一样 |
|
|
|
|
await this.$post(this.api[isSubmit ? 'submitTheExamPaper' : 'examPaperRecordCache'], data) |
|
|
|
|
|
|
|
|
|
clearInterval(this.counterTimer) |
|
|
|
|
this.submiting = false |
|
|
|
|
this.submited = true |
|
|
|
|
if (isSubmit) { |
|
|
|
|
clearInterval(this.counterTimer) |
|
|
|
|
this.submiting = false |
|
|
|
|
this.submited = true |
|
|
|
|
// 如果是竞赛,并且勾选了公布成绩详情的选项,则弹框提示 |
|
|
|
|
if (this.id) { |
|
|
|
|
const time = curStage.resultAnnouncementTime |
|
|
|
@ -669,7 +711,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.type-wrap { |
|
|
|
|
max-height: calc(100vh - 294); |
|
|
|
|
max-height: calc(100vh - 297px); |
|
|
|
|
padding: 10px; |
|
|
|
|
overflow: auto; |
|
|
|
|
|
|
|
|
@ -866,7 +908,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.stem { |
|
|
|
|
max-width: calc(100% - 191px); |
|
|
|
|
max-width: calc(100% - 197px); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.fill-input { |
|
|
|
|