openf12 V2.1.8
yujialong 12 months ago
parent 6afe1afaec
commit 82822d6c92
  1. 1
      src/api/index.js
  2. 125
      src/components/TestPanel.vue
  3. 3
      src/components/codemirror.vue
  4. 2
      src/components/upload/index.vue
  5. 2
      src/components/upload/upload.js
  6. 2
      src/config/index.js
  7. 1
      src/views/Home.vue

@ -1,5 +1,6 @@
import config from '@/config' import config from '@/config'
export default { export default {
getCurrentTime : `competition/competition/management/getCurrentTime`,
getProjectDetail: 'occupationlab/occupationlab/projectManage/getProjectDetail', getProjectDetail: 'occupationlab/occupationlab/projectManage/getProjectDetail',
submit: 'python/python/submit', submit: 'python/python/submit',
runPythonCode: 'python/python/runPythonCode', runPythonCode: 'python/python/runPythonCode',

@ -351,6 +351,7 @@ export default {
seconds: 0, // seconds: 0, //
minutes: 0, // minutes: 0, //
hour: 0, // hour: 0, //
now: '',
projectList: [], // projectList: [], //
pd: {}, pd: {},
experimentTarget: '', // experimentTarget: '', //
@ -404,34 +405,37 @@ export default {
mavonEditor mavonEditor
}, },
mounted () { mounted () {
// 210 this.getNow().then(now => {
this.projectPermissions = this.assessmentId ? this.entryTime = now
1 : // 210
this.competitionId ? this.projectPermissions = this.assessmentId ?
2 : 1 :
0 this.competitionId ?
if (this.assessmentId) { // assessmentIdcompetitionId) 2 :
this.getAssList() 0
} else { // if (this.assessmentId) { // assessmentIdcompetitionId)
if (Cookie.get('doneProjectId')) { this.getAssList()
this.projectId = +Cookie.get('doneProjectId') } else { //
} if (Cookie.get('doneProjectId')) {
Cookie.remove('doneProjectId') this.projectId = +Cookie.get('doneProjectId')
//
this.getList().then(() => {
let cache = localStorage.getItem('codeCache') //
//
if (cache) {
this.getCache(JSON.parse(cache))
} else {
this.getCache()
} }
}).catch(res => { }) Cookie.remove('doneProjectId')
} //
this.competitionId && this.getCompetitionStatus() // this.getList().then(() => {
this.getUserDetail() let cache = localStorage.getItem('codeCache') //
// this.drag() //
this.tableHeight = window.innerHeight - 360 if (cache) {
this.getCache(JSON.parse(cache))
} else {
this.getCache()
}
}).catch(res => { })
}
this.competitionId && this.getCompetitionStatus() //
this.getUserDetail()
// this.drag()
this.tableHeight = window.innerHeight - 360
})
}, },
methods: { methods: {
// //
@ -515,8 +519,10 @@ export default {
this.text = isPrac ? '已用' : '剩余' this.text = isPrac ? '已用' : '剩余'
// //
if (!this.competitionId) { if (!this.competitionId) {
this.countVal = isPrac ? 0 : (new Date(this.endTime).getTime() - Date.now()) / 1000 // 0 this.getNow().then(now => {
this.startCount() this.countVal = isPrac ? 0 : (new Date(this.endTime) - now) / 1000 // 0
this.startCount()
})
} }
resolve() resolve()
}).catch(err => { }).catch(err => {
@ -524,6 +530,13 @@ export default {
}) })
}) })
}, },
//
getNow () {
return new Promise(async (resolve, reject) => {
const res = await this.$get(this.api.getCurrentTime)
resolve(new Date(res.currentTime))
})
},
// loadingtrue // loadingtrue
closeLoad () { closeLoad () {
this.$parent.loadIns.close() this.$parent.loadIns.close()
@ -603,6 +616,7 @@ export default {
const judgmentId = e.judgmentId const judgmentId = e.judgmentId
promiseList.push(new Promise((resolve, reject) => { promiseList.push(new Promise((resolve, reject) => {
this.$post(this.api.getLastCache, { this.$post(this.api.getLastCache, {
competitionId: this.competitionId,
assessmentId: assessmentId ? Number(assessmentId) : '', assessmentId: assessmentId ? Number(assessmentId) : '',
bcId: judgmentId, bcId: judgmentId,
projectId, // id projectId, // id
@ -656,6 +670,7 @@ export default {
// //
points.map(e => { points.map(e => {
e.code && this.$post(this.api.delCache, { e.code && this.$post(this.api.delCache, {
competitionId: this.competitionId,
assessmentId, assessmentId,
bcId: e.judgmentId, bcId: e.judgmentId,
projectId, projectId,
@ -685,20 +700,22 @@ export default {
// //
getCompetitionStatus () { getCompetitionStatus () {
// //
this.isSubmit || this.$post(`${this.api.getCompetition}?competitionId=${this.competitionId}`).then(({ competition }) => { this.isSubmit || this.$post(`${this.api.getCompetition}?competitionId=${this.competitionId}`).then(async ({ competition }) => {
const stages = competition.competitionStage const stages = competition.competitionStage
if (stages) { if (stages) {
const stage = stages.find(e => e.stageId == this.stageId) const stage = stages.find(e => e.stageId == this.stageId)
const endTime = new Date(stage.endTime).getTime() const endTime = new Date(stage.endTime)
const now = Date.now()
const res = await this.$get(this.api.getCurrentTime)
const now = new Date(res.currentTime)
// //
if (now >= new Date(stage.endTime)) { if (now >= endTime) {
this.$alert('竞赛时间已到,系统已自动交卷', '提示', { this.$alert('竞赛时间已到,系统已自动交卷', '提示', {
confirmButtonText: '确定' confirmButtonText: '确定'
}) })
this.submit() this.submit()
} else { // } else { //
this.countVal = (endTime - Date.now()) / 1000 this.countVal = (endTime - now) / 1000
this.startCount() this.startCount()
} }
} }
@ -747,7 +764,7 @@ export default {
} }
}, },
// //
reload () { async reload () {
this.reloadCount() this.reloadCount()
this.grade = '00' this.grade = '00'
localStorage.removeItem('codeCache') localStorage.removeItem('codeCache')
@ -764,6 +781,7 @@ export default {
this.$emit('recoveryCode') this.$emit('recoveryCode')
this.startCount() this.startCount()
this.clearReport() this.clearReport()
this.entryTime = await this.getNow()
}, },
// //
ready () { ready () {
@ -831,7 +849,9 @@ export default {
}).then(({ codeId }) => { }).then(({ codeId }) => {
this.$parent.workbench[0].codeId = codeId this.$parent.workbench[0].codeId = codeId
this.submit() this.submit()
}).catch(err => { }) }).catch(err => {
this.submiting = false
})
} else { } else {
this.submit() this.submit()
} }
@ -841,12 +861,12 @@ export default {
}) })
}, },
// //
submit () { async submit () {
if (this.isSubmit) return false if (this.isSubmit) return false
const pointList = this.$parent.workbench const pointList = this.$parent.workbench
const date = new Date() const date = await this.getNow()
const entryTime = this.entryTime const entryTime = this.entryTime
const timeSum = Math.ceil((date.getTime() - entryTime.getTime()) / 60000) // const timeSum = Math.ceil((date - entryTime) / 60000) //
const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date) const submitTime = util.formatDate('yyyy-MM-dd hh:mm:ss', date)
const projectId = this.projectId const projectId = this.projectId
const pro = this.projectList.find(e => e.projectId == projectId) const pro = this.projectList.find(e => e.projectId == projectId)
@ -909,12 +929,16 @@ export default {
this.editReport(reportId) this.editReport(reportId)
this.submiting = false this.submiting = false
// //
// this.competitionId && this.resultsDetails == 0 && this.$alert(`${this.resultAnnouncementTime != 0 ? '' + this.resultAnnouncementTime + '' : ''}`, '', { if (this.competitionId) {
// confirmButtonText: '', this.$alert(`提交成功!${this.resultsDetails == 0 && this.resultAnnouncementTime != 0 ? '成绩将在' + this.resultAnnouncementTime + '小时后发布,请去参赛信息模块查看' : ''}`, '提示', {
// callback: action => { confirmButtonText: '确定',
// this.$parent.back() callback: action => {
// } this.$parent.back()
// }) }
})
} else {
this.$message.success('提交成功!')
}
}).catch(err => { }).catch(err => {
this.submiting = false this.submiting = false
}) })
@ -1188,7 +1212,11 @@ export default {
} }
} }
/deep/.ql-editor { /deep/.ql-editor {
font-family: 'Microsoft Yahei';
font-size: 13px; font-size: 13px;
.ql-syntax {
font-family: 'Microsoft Yahei';
}
} }
/deep/.el-collapse-item__wrap { /deep/.el-collapse-item__wrap {
border-bottom: none; border-bottom: none;
@ -1395,11 +1423,18 @@ export default {
/deep/.v-note-wrapper { /deep/.v-note-wrapper {
min-height: 0; min-height: 0;
height: auto; height: auto;
font-family: 'Microsoft Yahei';
.v-note-panel .v-note-show { .v-note-panel .v-note-show {
font-family: 'Microsoft Yahei';
overflow: visible; overflow: visible;
.v-show-content { .v-show-content {
font-family: 'Microsoft Yahei';
overflow: visible; overflow: visible;
} }
pre,
code {
font-family: 'Microsoft Yahei';
}
} }
} }
</style> </style>

@ -628,6 +628,9 @@ export default {
.text-wrapper { .text-wrapper {
white-space: pre-wrap; white-space: pre-wrap;
} }
/deep/.CodeMirror-code {
font-family: 'Microsoft Yahei';
}
/deep/.answer { /deep/.answer {
.el-tab-pane { .el-tab-pane {
padding: 0 10px; padding: 0 10px;

@ -102,7 +102,7 @@ export default {
this.uploading = true this.uploading = true
this.showFiles = false this.showFiles = false
// oss // oss
const { name } = await this.client.multipartUpload(file.name, file, { const { name } = await this.client.multipartUpload(Date.now() + '.' + Util.getFileExt(file.name), file, {
progress: this.handleProgress progress: this.handleProgress
}); });

@ -17,7 +17,7 @@ export default {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
// 上传到阿里云oss // 上传到阿里云oss
const res = await client.multipartUpload(file.name, file); const res = await client.multipartUpload(Date.now() + '.' + Util.getFileExt(file.name), file);
resolve({ resolve({
format: Util.getFileExt(file.name), format: Util.getFileExt(file.name),
name: file.name, name: file.name,

@ -66,5 +66,5 @@ export default {
/** /**
* @description 长时间未操作自动退出登录时间 * @description 长时间未操作自动退出登录时间
*/ */
autoLogoutTime: 1000 * 60 * 60 autoLogoutTime: 1000 * 60 * 60 * 3
} }

@ -148,6 +148,7 @@ export default {
list.map(e => { list.map(e => {
if (e.code) { if (e.code) {
let data = { let data = {
competitionId: this.competitionId,
assessmentId: this.assessmentId, assessmentId: this.assessmentId,
code: e.code, code: e.code,
bcId: e.judgmentId, bcId: e.judgmentId,

Loading…
Cancel
Save