diff --git a/package-lock.json b/package-lock.json
index 9cb3e9d..bb7a64c 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7881,6 +7881,11 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-1.0.2.tgz",
"integrity": "sha1-ykMJ2t7mtUzAuNJH6NfHoJdb3Js="
},
+ "lodash": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz",
+ "integrity": "sha512-0VSEDVec/Me2eATuoiQd8IjyBMMX0fahob8YJ96V1go2RjvCk1m1GxmtfXn8RNSaLaTtop7fsuhhu9oLk3hUgA=="
+ },
"minimatch": {
"version": "0.2.14",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz",
@@ -10522,9 +10527,9 @@
}
},
"lodash": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-1.0.2.tgz",
- "integrity": "sha1-j1dWDIO1n8JwvT1WG2kAQ0MOJVE="
+ "version": "4.17.21",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
+ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"lodash._basecopy": {
"version": "3.0.1",
diff --git a/package.json b/package.json
index bf71d3c..d7b4ea2 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
"js-cookie": "^2.2.1",
"jsencrypt": "^3.3.2",
"jspdf": "^2.5.1",
+ "lodash": "^4.17.21",
"mavon-editor": "^2.10.4",
"moment": "^2.29.4",
"tinymce": "^6.7.3",
diff --git a/src/api/index.js b/src/api/index.js
index ea41285..a9e4041 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -167,6 +167,9 @@ export default {
competitionTeamAutomaticAllocationRecordSave: `competition/competitionTeamAutomaticAllocationRecord/saveOrUpdate`,
whetherTheTeamHasReport: `competition/competitionAutomaticAllocationRecord/whetherTheTeamHasReport`,
examPaperDetails: `exam/exam/paper/examPaperDetails`,
+ examPaperRecordCache: `exam/exam/paper/examPaperRecordCache`,
+ submitTheExamPaper: `exam/exam/paper/submitTheExamPaper`,
+ getExamPaperCache: `exam/exam/paper/getExamPaperCache`,
// 创业活动
activityList: `occupationlab/occupationlab/activity/activityList`,
diff --git a/src/assets/img/exit.svg b/src/assets/img/exit.svg
new file mode 100644
index 0000000..9e3d775
--- /dev/null
+++ b/src/assets/img/exit.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/assets/img/tag-active.svg b/src/assets/img/tag-active.svg
new file mode 100644
index 0000000..c5183d4
--- /dev/null
+++ b/src/assets/img/tag-active.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/assets/img/tag.svg b/src/assets/img/tag.svg
new file mode 100644
index 0000000..2661143
--- /dev/null
+++ b/src/assets/img/tag.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/pages/match/details/index.vue b/src/pages/match/details/index.vue
index f2b9903..c54c61b 100644
--- a/src/pages/match/details/index.vue
+++ b/src/pages/match/details/index.vue
@@ -1639,22 +1639,28 @@ export default {
// 进入子系统
toSub () {
const { form } = this
- const { systemId, systemName, projectId, cid, stageId, startTime, endTime, mallId, resultAnnouncementTime } = this.curStage
+ const { systemId, systemName, projectId, cid, stageId, startTime, endTime, mallId, resultAnnouncementTime, method } = this.curStage
const competitionId = form.id
const teamId = form.competitionRegistration.teamId || ''
- let token = Util.local.get(Setting.tokenKey);
- if (systemId == 11) {
- // 银行系统
- location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`
- } else if (systemId == 12) {
- // 众筹系统
- window.open(`http://${Setting.zcPath}?systemId=${systemId}&courseId=${cid}&projectId=${projectId}&token=${token}&userId=${this.userId}&classId=1&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&startTime=${startTime}&endTime=${endTime}&mallId=${mallId}${Setting.isTest ? '&beta=1' : ''}`);
- } else if (systemId == 19) {
- // 沙盘
- location.href = `${Setting.sandPath}/#/?curriculumName=${systemName}&token=${token}&cid=${cid}&mallId=${mallId}&systemId=${systemId}&projectId=${projectId}&assessmentId=&classId=&startTime=&stopTime=${endTime}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&resultAnnouncementTime=${isNaN(resultAnnouncementTime) ? '' : resultAnnouncementTime}&userId=${this.userId}&account=${this.account}&referrer=${encodeURIComponent(location.href)}`
+
+ // 理论考试
+ if (method === 1) {
+ this.$router.push(`theoryExam?id=${form.id}&stageId=${stageId}`)
} else {
- // python系统
- this.toPython(this.curProject)
+ let token = Util.local.get(Setting.tokenKey);
+ if (systemId == 11) {
+ // 银行系统
+ location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`
+ } else if (systemId == 12) {
+ // 众筹系统
+ window.open(`http://${Setting.zcPath}?systemId=${systemId}&courseId=${cid}&projectId=${projectId}&token=${token}&userId=${this.userId}&classId=1&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&startTime=${startTime}&endTime=${endTime}&mallId=${mallId}${Setting.isTest ? '&beta=1' : ''}`);
+ } else if (systemId == 19) {
+ // 沙盘
+ location.href = `${Setting.sandPath}/#/?curriculumName=${systemName}&token=${token}&cid=${cid}&mallId=${mallId}&systemId=${systemId}&projectId=${projectId}&assessmentId=&classId=&startTime=&stopTime=${endTime}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&resultAnnouncementTime=${isNaN(resultAnnouncementTime) ? '' : resultAnnouncementTime}&userId=${this.userId}&account=${this.account}&referrer=${encodeURIComponent(location.href)}`
+ } else {
+ // python系统
+ this.toPython(this.curProject)
+ }
}
}
}
diff --git a/src/pages/match/list/index.vue b/src/pages/match/list/index.vue
index b525d25..d372351 100644
--- a/src/pages/match/list/index.vue
+++ b/src/pages/match/list/index.vue
@@ -967,22 +967,28 @@ export default {
// 进入子系统
toSub () {
const form = this.curItem
- const { systemId, systemName, projectId, cid, stageId, startTime, endTime, mallId, resultAnnouncementTime } = form.curStage
+ const { systemId, systemName, projectId, cid, stageId, startTime, endTime, mallId, resultAnnouncementTime, method } = form.curStage
const competitionId = form.id
const teamId = form.teamId || ''
- let token = Util.local.get(Setting.tokenKey);
- if (systemId == 11) {
- // 银行系统
- location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`
- } else if (systemId == 12) {
- // 众筹系统
- window.open(`http://${Setting.zcPath}?systemId=${systemId}&courseId=${cid}&projectId=${projectId}&token=${token}&userId=${this.userId}&classId=1&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&startTime=${startTime}&endTime=${endTime}&mallId=${mallId}${Setting.isTest ? '&beta=1' : ''}`);
- } else if (systemId == 19) {
- // 沙盘
- location.href = `${Setting.sandPath}/#/?curriculumName=${systemName}&token=${token}&cid=${cid}&mallId=${mallId}&systemId=${systemId}&projectId=${projectId}&assessmentId=&classId=&startTime=&stopTime=${endTime}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&resultAnnouncementTime=${isNaN(resultAnnouncementTime) ? '' : resultAnnouncementTime}&userId=${this.userId}&account=${this.account}&referrer=${encodeURIComponent(location.href)}`
+
+ // 理论考试
+ if (method === 1) {
+ this.$router.push(`theoryExam?id=${form.id}&stageId=${stageId}`)
} else {
- // python系统
- this.toPython()
+ let token = Util.local.get(Setting.tokenKey)
+ if (systemId == 11) {
+ // 银行系统
+ location.href = `${Setting.systemPath}/#/index/list?curriculumName=${this.curriculumName}&token=${token}&cid=${cid}&systemId=${systemId}&projectId=${projectId}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&assessmentId=&classId=&stopTime=&test=true`
+ } else if (systemId == 12) {
+ // 众筹系统
+ window.open(`http://${Setting.zcPath}?systemId=${systemId}&courseId=${cid}&projectId=${projectId}&token=${token}&userId=${this.userId}&classId=1&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&startTime=${startTime}&endTime=${endTime}&mallId=${mallId}${Setting.isTest ? '&beta=1' : ''}`);
+ } else if (systemId == 19) {
+ // 沙盘
+ location.href = `${Setting.sandPath}/#/?curriculumName=${systemName}&token=${token}&cid=${cid}&mallId=${mallId}&systemId=${systemId}&projectId=${projectId}&assessmentId=&classId=&startTime=&stopTime=${endTime}&competitionId=${competitionId}&stageId=${stageId}&teamId=${teamId}&resultAnnouncementTime=${isNaN(resultAnnouncementTime) ? '' : resultAnnouncementTime}&userId=${this.userId}&account=${this.account}&referrer=${encodeURIComponent(location.href)}`
+ } else {
+ // python系统
+ this.toPython()
+ }
}
}
}
diff --git a/src/pages/match/theoryExam/index.vue b/src/pages/match/theoryExam/index.vue
index 2ecf728..6583073 100644
--- a/src/pages/match/theoryExam/index.vue
+++ b/src/pages/match/theoryExam/index.vue
@@ -2,27 +2,28 @@
+
{{ curStage.stageName }}:{{ curStage.paperName }}
-
-
+
阶段剩余时间
- {{ day }}天
- {{ hour }}小时
- {{ minutes }}分
- {{ seconds }}秒
+ {{ counterVal.day }}天
+ {{ counterVal.hour }}小时
+ {{ counterVal.minutes }}分
+ {{ counterVal.seconds }}秒
用时
- {{ day }}天
- {{ hour }}小时
- {{ minutes }}分
- {{ seconds }}秒
+ {{ timeSum.day }}天
+ {{ timeSum.hour }}小时
+ {{ timeSum.minutes }}分
+ {{ timeSum.seconds }}秒
-
提交
+
提交
+
@@ -39,15 +40,23 @@
{{ arabicToChinese(i + 1) }}、{{ item.questionTypeName }}(本题共{{ item.questionNum }}小题,共{{
item.targetScore }}分)
- - {{ j + 1 }}
+
+ -
+
+ {{ j + 1 }}
+
+
- - 未作答
- - 已作答
- - 部分已作答
- - 已标记
+ - 未作答
+ - 已作答
+ - 部分已作答
+
已标记
@@ -64,18 +73,20 @@
{{ j + 1 }} / {{ item.questionNum }}
{{ item.questionTypeName }}
-
+
({{ ques.score }}分)
+
-
-
+
+
{{ numToLetter(j) }}.
@@ -87,17 +98,25 @@
{{ ques.stemAttachment }}
下载
-
-
-
-
上传附件
+
essayAnswerReady(editor, ques)" />
+
+
+
-
- 上传说明内容,支持.csv;.xlsx; .docx; .pdf; .jpg; .zip 等常见文件格式;上传文件大小不能超过50MB
-
-
+
uploadSuccess(e, ques)">
+
+ 上传文件
+
+
+
+
+
+
@@ -112,9 +131,11 @@ import Util from '@/libs/util'
import Setting from "@/setting"
import QuesConst from '@/const/ques'
import TestPaperConst from '@/const/testPaper'
+import _ from 'lodash'
import Oss from '@/components/upload/upload.js'
import Upload from '@/components/upload'
import UeditorPlus from '@/components/ueditorPlus'
+
export default {
components: {
Upload, UeditorPlus
@@ -122,6 +143,7 @@ export default {
data () {
return {
routes: [],
+ per: 2, // 项目权限(0、练习 1、考核 2、竞赛)
questionTypes: QuesConst.questionTypes,
numToLetter: Util.numToLetter,
arabicToChinese: Util.arabicToChinese,
@@ -129,59 +151,228 @@ export default {
token: Util.local.get(Setting.tokenKey)
},
token: Util.local.get(Setting.tokenKey),
- // id: +this.$route.query.id,
- id: 43,
+ id: +this.$route.query.id, // 赛事id
+ stageId: +this.$route.query.stageId,
+ entryTime: '',
+ curStage: {
+ stageName: '',
+ paperName: '',
+ },
counterTimer: null, // 获取setInterval对象值
- day: 0, // 天数
- seconds: 0, // 秒数
- minutes: 0, // 分钟数
- hour: 0, // 小时数
+ countVal: 0,
+ // 倒计时
+ counterVal: {
+ day: 0,
+ seconds: 0,
+ minutes: 0,
+ hour: 0,
+ },
+ timeSumVal: 0,
+ // 用时
+ timeSum: {
+ day: 0,
+ seconds: 0,
+ minutes: 0,
+ hour: 0,
+ },
+ sheetStatus: '',
form: {},
- uploadList: [],
+ submiting: false,
+ warned: 0,
};
},
mounted () {
this.$once('hook:beforeDestroy', function () {
- clearInterval(this.timer)
- this.timerList.forEach(n => {
- clearTimeout(n)
- })
- this.timerList = []
+ clearInterval(this.counterTimer)
+ this.submiting || this.submit(0)
})
- this.getDetail()
- // this.initOss()
+ this.getCompetition()
},
methods: {
+ // 获取竞赛信息
+ async getCompetition () {
+ // clearInterval(this.timer)
+ const { competition } = await this.$post(`${this.api.getCompetition}?competitionId=${this.id}`)
+ const stages = competition.contentList
+ if (stages) {
+ const stage = stages.find(e => e.stageId === this.stageId)
+ const item = competition.competitionStage.find(e => e.stageId === this.stageId)
+ if (item) {
+ stage.stageName = item.stageName
+ stage.resultAnnouncementTime = item.resultAnnouncementTime
+ }
+ this.curStage = stage
+ const endTime = new Date(stage.endTime)
+ const now = await Util.getNow()
+ // 如果已经结束
+ if (now >= endTime) {
+ this.$alert('竞赛时间已到,系统已自动交卷', '提示', {
+ confirmButtonText: '确定'
+ })
+ this.submit(1)
+ } else { // 没结束,则显示倒计时
+ this.countVal = (endTime - now) / 1000
+ this.getPaper(now)
+ }
+ }
+ },
// 获取试卷详情
- async getDetail () {
+ async getPaper (now) {
try {
- const { id } = this
- if (id) {
- const res = await this.$get(this.api.examPaperDetails, {
- id
+ const { paperId, stageId } = this.curStage
+ if (paperId) {
+ // 试卷详情
+ const { examPaper } = await this.$get(this.api.examPaperDetails, { id: paperId })
+
+ // 缓存,如果有,则全部回显到页面上
+ const res = await this.$post(this.api.getExamPaperCache, {
+ competitionId: this.id,
+ paperId,
+ stageId
})
- const r = res.examPaper
+ const cache = res.examSubmitReq
+ let cacheQues = []
+ if (cache) {
+ this.entryTime = new Date(cache.startTime)
+ this.timeSumVal = (now - new Date(cache.startTime)) / 1000
+ cacheQues = cache.examSubmitJudgeList
+ } else {
+ this.entryTime = now
+ }
+ this.startCount()
+
+ const r = examPaper
const paper = r.paperOutline
const types = this.questionTypes
paper.map(e => {
- e.questionTypeName = types.find(n => n.id === e.questionType).name
+ const type = e.questionType
+ e.questionTypeName = types.find(n => n.id === type).name
e.shrink = false
e.examQuestions.map(n => {
Object.assign(n, n.question)
+ const curQues = cacheQues.find(m => m.outlineId === e.outlineId && m.questionVersionId === n.questionVersionId) // 缓存里的试题
+ n.sign = curQues ? curQues.sign : 0
+
+ if (type !== 'fill_blank' && type !== 'essay' && n.questionAnswerVersionsList) { // 选择题
+ n.questionAnswerVersionsList.map(m => {
+ m.answer = curQues && curQues.answer && curQues.answer.length && curQues.answer.some(n => n == m.optionNumber) ? 1 : 0
+ })
+ if (n.questionAnswerVersionsList.some(m => m.answer)) n.answered = 1
+ } else if (type === 'fill_blank') { // 填空题
+ n.fills = curQues && curQues.answer && curQues.answer.length ? curQues.answer : ''
+ if (n.fills) n.answered = 1
+ } else { // 简答题
+ n.answer = type === 'essay' && curQues ? curQues.answerContent : ''
+ n.attachmentName = curQues ? curQues.attachmentName : ''
+ n.attachmentUrl = curQues ? curQues.attachmentUrl : ''
+ // 附件
+ const url = n.attachmentUrl
+ if (url) {
+ n.uploadList = [{
+ name: n.attachmentName || url,
+ url
+ }]
+ }
+ if (n.answer || url) n.answered = 1
+ }
})
-
})
this.form = r
+
+ // 给填空题的每个空监听input事件,用以显示已作答状态
+ this.$nextTick(() => {
+ paper.map(e => {
+ e.examQuestions.map(n => {
+ if (e.questionType === 'fill_blank') {
+ const stem = document.querySelector(`#stem` + n.id)
+ if (stem) {
+ const inputs = stem.querySelectorAll('.fill-input')
+ if (inputs) {
+ for (const e of inputs) {
+ e.addEventListener('input', () => {
+ const answers = []
+ for (const e of inputs) {
+ e.value && answers.push(e.value)
+ }
+ n.answered = answers.length === inputs.length ? 1 : 0
+ n.partAnswer = answers.length && answers.length !== inputs.length ? 1 : 0
+ })
+ }
+ }
+ }
+ }
+ })
+ })
+ })
+ console.log("🚀 ~ getPaper ~ r:", r)
}
} catch (e) { }
},
+ // 计时器
+ handleCounter (counterTime, isCount) {
+ let leave1 = counterTime % (24 * 3600) //计算天数后剩余的毫秒数
+ let leave2 = leave1 % 3600 //计算小时数后剩余的毫秒数
+ let leave3 = leave2 % 60 //计算分钟数后剩余的毫秒数
+ let day = Math.floor(counterTime / (24 * 3600)) //计算相差天数
+ let hour = Math.floor(leave1 / 3600) //计算相差小时
+ let minutes = Math.floor(leave2 / 60) //计算相差分钟
+ let seconds = Math.round(leave3) //计算相差秒
+ day = this.timeFormat(day)
+ hour = this.timeFormat(hour)
+ minutes = this.timeFormat(minutes)
+ seconds = this.timeFormat(seconds)
+ const count = this[isCount ? 'counterVal' : 'timeSum']
+ count.day = day
+ count.hour = hour
+ count.minutes = minutes
+ count.seconds = seconds
+ },
+ // 计时前的判断
+ counter (counterTime) {
+ if (counterTime <= 0) {
+ if (this.per) { // 竞赛/考核
+ clearInterval(this.counterTimer)
+ this.$alert(`${this.per == 2 ? '竞赛' : '考核'}时间已到,系统已自动交卷`, '提示', {
+ confirmButtonText: '确定',
+ type: 'warning'
+ })
+ this.submit(1)
+ } else {
+ this.handleCounter(counterTime, 1)
+ }
+ } else {
+ // 剩15分钟时要提示
+ if (counterTime <= 900) {
+ this.warned || this.$alert(`请注意,${this.per == 2 ? '比赛' : '考核'}还剩15分钟,请尽快完成答题并提交试卷。`, '提示', {
+ confirmButtonText: '确定',
+ type: 'warning'
+ })
+ this.warned = 1
+ }
+ this.handleCounter(counterTime, 1)
+ }
+ },
+ // 启动倒计时
+ startCount () {
+ clearInterval(this.counterTimer)
+ this.counterTimer = setInterval(() => {
+ this.counter(this.per ? this.countVal-- : this.countVal++)
+ this.timeSumVal >= 0 && this.handleCounter(this.timeSumVal++)
+ }, 1000)
+ },
+ timeFormat (param) {
+ return param < 10 ? '0' + param : param
+ },
+ // 答题卡筛选
+ filterStatus (e) {
+ this.sheetStatus = this.sheetStatus === e ? '' : e
+ },
// 处理题干显示
getQuesStem (ques) {
let { stem } = ques
if (ques.questionType === 'fill_blank') { // 填空题
- let { jsonText } = ques
- if (jsonText) jsonText = JSON.parse(jsonText)
+ let { fills } = ques
const regex = /______<\/span>/g
let match
@@ -189,7 +380,7 @@ export default {
let result = stem
while ((match = regex.exec(stem)) !== null) {
- const newInput = ``
+ const newInput = ``
result = result.replace(match[0], newInput)
index++
}
@@ -198,34 +389,147 @@ export default {
return stem
}
},
+ // 单选题回调
+ singleChange (ques, j) {
+ ques.questionAnswerVersionsList.map(e => {
+ e.answer = 0
+ })
+ ques.questionAnswerVersionsList[j].answer = 1
+
+ ques.answered = 1
+ },
+ // 多选题回调
+ mulChange (ques) {
+ ques.answered = ques.questionAnswerVersionsList.some(e => e.answer)
+ },
+
+ // 简答题富文本加载完毕回调
+ essayAnswerReady (editor, ques) {
+ editor.ques = ques
+ editor.addListener('contentChange', () => {
+ ques.answered = editor.getContent() ? 1 : 0
+ })
+ ques.answer && editor.setContent(ques.answer)
+ },
// 下载附件
download (url) {
Util.downloadFile(url, url)
},
- handleRemove () {
- Oss.del(this.form.stemAttachment)
- this.form.stemAttachment = ''
+ handleRemove (ques) {
+ Oss.del(ques.attachmentUrl)
+ ques.attachmentName = ''
+ ques.attachmentUrl = ''
},
- uploadSuccess (file) {
- this.form.stemAttachment = file.url
+ uploadSuccess (file, ques) {
+ ques.attachmentName = file.name
+ ques.attachmentUrl = file.url
},
// 解析富文本加载完毕回调
answerAnalysisReady (editor) {
this.answerAnalysis && editor.setContent(this.answerAnalysis)
},
- // 提交
- async submit () {
+ // 提交询问
+ async confirmSubmit () {
+ if (this.submiting) return false
let msg = '此操作将视为结束答题,确认要提交吗?'
- // if (!isVscode) msg = '实验报告未填写,实验成绩为零,是否确认提交?'
+
+ for (const e of this.form.paperOutline) {
+ if (e.examQuestions.some(n => !n.answered)) {
+ msg = '还有试题未答完,确认要提交吗?'
+ break
+ }
+ }
try {
await this.$confirm(msg, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
+ // confirmButtonText: '确定',
+ // cancelButtonText: '取消',
type: 'warning',
closeOnClickModal: false
})
+ this.submit(1)
} catch (e) { }
},
+ // 提交
+ async submit (isSubmit) {
+ if (this.submiting) return false
+ try {
+ this.submiting = true
+ const form = _.cloneDeep(this.form)
+ const now = await Util.getNow()
+ const { entryTime, curStage } = this
+ const ques = []
+ form.paperOutline.map(e => {
+ const type = e.questionType
+ e.examQuestions.map(n => {
+ let answer = []
+ let answerContent = ''
+ if (type !== 'fill_blank' && type !== 'essay') { // 选择题
+ answer = n.questionAnswerVersionsList.filter(m => m.answer).map(m => m.optionNumber)
+ } else if (type === 'essay') { // 简答题
+ const editor = this.$refs['essayAnswer' + n.id]
+ // console.log("🚀 ~ submit ~ editor:", n.id, editor, this.$refs)
+ if (editor && editor.length) answerContent = editor[0].getUEContent()
+ } else { // 填空题
+ const stem = document.querySelector(`#stem` + n.id)
+ if (stem) {
+ const inputs = stem.querySelectorAll('.fill-input')
+ console.log("🚀 ~ submit ~ editor333:", stem, inputs)
+ if (inputs) {
+ for (const e of inputs) {
+ answer.push(e.value)
+ }
+ }
+ }
+ }
+ ques.push({
+ answer,
+ answerContent,
+ attachmentName: n.attachmentName,
+ attachmentUrl: n.attachmentUrl,
+ outlineId: e.outlineId,
+ questionType: type,
+ questionVersionId: n.questionVersionId,
+ serialNumber: n.serialNumber,
+ setScore: n.score,
+ sign: n.sign,
+ })
+ })
+ })
+ const timeSum = Math.ceil((now - entryTime) / 60000) // 计算实验用时(分钟),向上取整
+ const submitTime = Util.formatDate('yyyy-MM-dd hh:mm:ss', now)
+ // debugger
+ // 缓存跟提交接口的参数一样
+ const res = await this.$post(this.api[isSubmit ? 'submitTheExamPaper' : 'examPaperRecordCache'], {
+ competitionId: this.id,
+ stageId: curStage.stageId,
+ 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 (this.id) {
+ const time = curStage.resultAnnouncementTime
+ const msg =
+ time === '0' ? '提交成功!成绩将在比赛结束后公布,请前往参赛信息模块查看' : time > 0 ? `提交成功!成绩将在比赛结束后${time}小时公布,请前往参赛信息模块查看` : '提交成功';
+ this.$alert(msg, '提示', {
+ confirmButtonText: '确定',
+ type: 'success',
+ callback: () => {
+ this.$router.back()
+ }
+ })
+ } else {
+ this.$message.success('提交成功!')
+ }
+ } catch (e) {
+ this.submiting = false
+ }
+ },
}
};
@@ -235,7 +539,7 @@ export default {
display: flex;
justify-content: space-between;
align-items: center;
- padding: 10px;
+ padding: 10px 20px;
color: #fff;
background-color: #5786fc;
@@ -244,10 +548,24 @@ export default {
align-items: center;
}
+ .names {
+ font-size: 18px;
+ font-weight: 600;
+ }
+
.submit {
width: 106px;
font-size: 15px;
}
+
+ .exit {
+ margin-left: 20px;
+ cursor: pointer;
+
+ &:hover {
+ opacity: .9;
+ }
+ }
}
/deep/.wrap {
@@ -293,13 +611,30 @@ export default {
margin-top: 5px;
li {
+ position: relative;
width: 35px;
margin: 7px 9px;
font-size: 13px;
text-align: center;
line-height: 35px;
- color: #fff;
- background-color: #66b2ff;
+ color: #505050;
+ border: 1px solid #d3d3d3;
+
+ &.answered {
+ color: #fff;
+ background-color: #66b2ff;
+ border-color: #66b2ff;
+ }
+
+ &.partAnswer {
+ border-color: #66b2ff;
+ }
+ }
+
+ .tag {
+ position: absolute;
+ top: -2px;
+ left: -4px;
}
}
@@ -312,11 +647,13 @@ export default {
li {
display: inline-flex;
align-items: center;
+ padding: 0 3px;
font-size: 12px;
color: #333;
cursor: pointer;
+ border: 1px solid transparent;
- &:before {
+ &:not(:last-child):before {
content: '';
width: 13px;
height: 13px;
@@ -333,9 +670,15 @@ export default {
border-color: #56aaff;
}
- &:last-child:before {
- // background-color: #54b6ff;
- // border: 0;
+ &.active {
+ font-weight: 600;
+ color: #007eff;
+ border-color: #007eff;
+
+ &:last-child {
+ color: #d81e06;
+ border-color: #d81e06;
+ }
}
}
}
@@ -395,6 +738,15 @@ export default {
margin-bottom: 10px;
}
+ .tag {
+ margin-left: 10px;
+ cursor: pointer;
+
+ &:hover {
+ opacity: .9;
+ }
+ }
+
.label {
padding: 3px 5px;
margin-right: 10px;