|
|
|
@ -616,6 +616,58 @@ |
|
|
|
|
@click="memberVisible = false">确定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="阶段赛名称" |
|
|
|
|
:visible.sync="stageVisible" |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
width="600px"> |
|
|
|
|
<template v-if="curStage && curStage.competitionStageContentSetting"> |
|
|
|
|
<el-button v-if="curStage.competitionStageContentSetting.systemLink" |
|
|
|
|
type="text" |
|
|
|
|
style="font-size: 13px" |
|
|
|
|
@click="toOffline">进入{{ curStage.stageName }}</el-button> |
|
|
|
|
<div v-if="curStage.competitionStageContentSetting.fileUrl" |
|
|
|
|
class="flex a-center m-b-10"> |
|
|
|
|
<p class="m-r-10" |
|
|
|
|
style="font-size: 13px">文件下载:{{ curStage.competitionStageContentSetting.fileName }}</p> |
|
|
|
|
<el-button type="text" |
|
|
|
|
style="font-size: 13px" |
|
|
|
|
@click="download({fileName: curStage.competitionStageContentSetting.fileName, filePath: curStage.competitionStageContentSetting.fileUrl})">点击下载</el-button> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="flex m-b-20"> |
|
|
|
|
<span style="font-size: 12px">文件上传:</span> |
|
|
|
|
<el-upload :before-upload="beforeUpload" |
|
|
|
|
:on-remove="handleRemove" |
|
|
|
|
:on-error="uploadError" |
|
|
|
|
:on-success="uploadSuccess" |
|
|
|
|
:before-remove="beforeRemove" |
|
|
|
|
:limit="1" |
|
|
|
|
:on-exceed="handleExceed" |
|
|
|
|
:action="api.fileUploadNakadai" |
|
|
|
|
:headers="headers" |
|
|
|
|
name="file"> |
|
|
|
|
<el-button size="small" |
|
|
|
|
type="primary">上传试卷</el-button> |
|
|
|
|
<div slot="tip" |
|
|
|
|
class="el-upload__tip"> |
|
|
|
|
<p>请上传大小1G以内的文件,支持常见文件格式。</p> |
|
|
|
|
<p>只允许上传一个文件,如有多个文件则需打包再上传。</p> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div>说明:{{ curStage.competitionStageContentSetting.stageExplain }}</div> |
|
|
|
|
</template> |
|
|
|
|
<span slot="footer" |
|
|
|
|
class="dialog-footer"> |
|
|
|
|
<el-button size="small" |
|
|
|
|
type="primary" |
|
|
|
|
@click="stageSubmit">提交</el-button> |
|
|
|
|
<el-button size="small" |
|
|
|
|
@click="stageVisible = false">取消</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
@ -629,6 +681,9 @@ export default { |
|
|
|
|
name: 'matchdetail', |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
headers: { |
|
|
|
|
token: util.local.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
|
token: util.local.get(Setting.tokenKey), |
|
|
|
|
id: +this.$route.query.id, |
|
|
|
|
end: '', |
|
|
|
@ -733,6 +788,10 @@ export default { |
|
|
|
|
peopleSignupForm: { |
|
|
|
|
registrationInvitationCode: '' |
|
|
|
|
}, |
|
|
|
|
submiting: false, |
|
|
|
|
|
|
|
|
|
stageVisible: false, |
|
|
|
|
filesResult: {} |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
@ -815,99 +874,105 @@ export default { |
|
|
|
|
let signUpEndTime = new Date(this.core.dateCompatible(form.signUpEndTime)) // 报名结束时间 |
|
|
|
|
let playStartTime = new Date(this.core.dateCompatible(form.playStartTime)) // 比赛开始时间 |
|
|
|
|
let playEndTime = new Date(this.core.dateCompatible(form.playEndTime)) // 比赛结束时间 |
|
|
|
|
this.timer = setInterval(() => { |
|
|
|
|
const now = new Date() |
|
|
|
|
if (now < signUpStartTime) { // 报名没开始 |
|
|
|
|
status = 0 |
|
|
|
|
total = signUpStartTime - now |
|
|
|
|
} else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 |
|
|
|
|
// 1已报名,2立即报名(没登录的情况下,直接显示立即报名,登录了则取报名信息,有则已报名,无则立即报名) |
|
|
|
|
status = this.token ? |
|
|
|
|
(form.competitionRegistration ? |
|
|
|
|
1 : |
|
|
|
|
2) : |
|
|
|
|
2 |
|
|
|
|
total = signUpEndTime - now |
|
|
|
|
} else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 |
|
|
|
|
status = 3 |
|
|
|
|
total = playStartTime - now |
|
|
|
|
} else if (now > playStartTime && now < playEndTime) { // 比赛进行中 |
|
|
|
|
// 如果是完整比赛 |
|
|
|
|
if (form.releaseType) { |
|
|
|
|
// 进行中的赛事,则遍历每个阶段的开始结束时间,看阶段比赛是否开始 |
|
|
|
|
let curStage = null |
|
|
|
|
const stages = form.competitionStage |
|
|
|
|
if (stages) { |
|
|
|
|
this.playingStages = [] |
|
|
|
|
form.competitionRegistration && stages.forEach(e => { |
|
|
|
|
if (now >= new Date(e.startTime) && now <= new Date(e.endTime) && (e.method !== 2 || this.isLink(e))) this.playingStages.push(e) |
|
|
|
|
}) |
|
|
|
|
let endText = '' |
|
|
|
|
for (const i in stages) { |
|
|
|
|
const e = stages[i] |
|
|
|
|
const startTime = new Date(e.startTime) |
|
|
|
|
const endTime = new Date(e.endTime) |
|
|
|
|
if (now < startTime) { // 阶段比赛未开始,不显示进入比赛按钮 |
|
|
|
|
endText = '阶段开始' |
|
|
|
|
total = startTime - now |
|
|
|
|
break |
|
|
|
|
} else if (now >= startTime && now <= endTime && (e.method !== 2 || this.isLink(e))) { // 阶段比赛进行中,显示进入比赛按钮 |
|
|
|
|
if (e.method !== 2) { |
|
|
|
|
if (form.competitionRegistration) { // 报名了才能进入比赛 |
|
|
|
|
this.statusList[4] = e.count ? '已提交' : '进入' + e.stageName |
|
|
|
|
curStage = e |
|
|
|
|
} else if (!this.token) { |
|
|
|
|
this.statusList[4] = '进入' + e.stageName |
|
|
|
|
curStage = e |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// this.timer = setInterval(() => { |
|
|
|
|
const now = new Date() |
|
|
|
|
if (now < signUpStartTime) { // 报名没开始 |
|
|
|
|
status = 0 |
|
|
|
|
total = signUpStartTime - now |
|
|
|
|
} else if (now > signUpStartTime && now < signUpEndTime) { // 报名进行中 |
|
|
|
|
// 1已报名,2立即报名(没登录的情况下,直接显示立即报名,登录了则取报名信息,有则已报名,无则立即报名) |
|
|
|
|
status = this.token ? |
|
|
|
|
(form.competitionRegistration ? |
|
|
|
|
1 : |
|
|
|
|
2) : |
|
|
|
|
2 |
|
|
|
|
total = signUpEndTime - now |
|
|
|
|
} else if (now > signUpEndTime && now < playStartTime) { // 报名结束了,但比赛没开始 |
|
|
|
|
status = 3 |
|
|
|
|
total = playStartTime - now |
|
|
|
|
} else if (now > playStartTime && now < playEndTime) { // 比赛进行中 |
|
|
|
|
// 如果是完整比赛 |
|
|
|
|
if (form.releaseType) { |
|
|
|
|
// 进行中的赛事,则遍历每个阶段的开始结束时间,看阶段比赛是否开始 |
|
|
|
|
let curStage = null |
|
|
|
|
const stages = form.competitionStage |
|
|
|
|
if (stages) { |
|
|
|
|
this.playingStages = [] |
|
|
|
|
form.competitionRegistration && stages.forEach(e => { |
|
|
|
|
if (now >= new Date(e.startTime) && now <= new Date(e.endTime) && (e.method !== 2 || this.offlineCanEntry(e))) this.playingStages.push(e) |
|
|
|
|
}) |
|
|
|
|
let endText = '' |
|
|
|
|
for (const i in stages) { |
|
|
|
|
const e = stages[i] |
|
|
|
|
const startTime = new Date(e.startTime) |
|
|
|
|
const endTime = new Date(e.endTime) |
|
|
|
|
console.log("🚀 ~ file: index.vue:901 ~ //this.timer=setInterval ~ form.competitionRegistration:", stages, startTime, endTime, now >= startTime && now <= endTime) |
|
|
|
|
if (now < startTime) { // 阶段比赛未开始,不显示进入比赛按钮 |
|
|
|
|
endText = '阶段开始' |
|
|
|
|
total = startTime - now |
|
|
|
|
break |
|
|
|
|
} else if (now >= startTime && now <= endTime) { // 阶段比赛进行中,显示进入比赛按钮 |
|
|
|
|
// 非线下赛事 |
|
|
|
|
if (e.method !== 2) { |
|
|
|
|
if (form.competitionRegistration) { // 报名了才能进入比赛 |
|
|
|
|
this.statusList[4] = e.count ? '已提交' : '进入' + e.stageName |
|
|
|
|
curStage = e |
|
|
|
|
} else if (!this.token) { |
|
|
|
|
this.statusList[4] = '进入' + e.stageName |
|
|
|
|
curStage = e |
|
|
|
|
} |
|
|
|
|
endText = '阶段结束' |
|
|
|
|
total = endTime - now |
|
|
|
|
break |
|
|
|
|
} else if (stages[i + 1] && now > endTime && now < new Date(stages[i + 1].startTime)) { // 过了该阶段的结束时间,但是没到下个阶段的开始时间,不显示进入比赛按钮 |
|
|
|
|
endText = '阶段开始' |
|
|
|
|
total = new Date(stages[i + 1].startTime) - now |
|
|
|
|
break |
|
|
|
|
} else if (i === stages.length - 1) { // 当前时间在比赛开始结束时间之间,并且是最后一个阶段结束时间之后 |
|
|
|
|
this.$set(form, 'stageName', '') |
|
|
|
|
endText = '竞赛结束' |
|
|
|
|
total = playEndTime - now |
|
|
|
|
break |
|
|
|
|
} else if (this.offlineCanEntry(e)) { // 线下(输入了系统链接或者上传文件选择了是,才需要显示进入按钮) |
|
|
|
|
// 当系统链接为空,且上传文件为否时,无需展示入口 |
|
|
|
|
// 当系统链接不为空,且上传文件为否时,点击入口,直接跳转到链接页面,无需弹窗 |
|
|
|
|
// 当上传文件为是时,点击入口需弹窗,共两种样式 |
|
|
|
|
this.statusList[4] = '进入' + e.stageName |
|
|
|
|
console.log("🚀 ~ file: index.vue:924 ~ //this.timer=setInterval ~ e:", e, this.playingStages) |
|
|
|
|
curStage = e |
|
|
|
|
} |
|
|
|
|
endText = '阶段结束' |
|
|
|
|
total = endTime - now |
|
|
|
|
break |
|
|
|
|
} else if (stages[i + 1] && now > endTime && now < new Date(stages[i + 1].startTime)) { // 过了该阶段的结束时间,但是没到下个阶段的开始时间,不显示进入比赛按钮 |
|
|
|
|
endText = '阶段开始' |
|
|
|
|
total = new Date(stages[i + 1].startTime) - now |
|
|
|
|
break |
|
|
|
|
} else if (i === stages.length - 1) { // 当前时间在比赛开始结束时间之间,并且是最后一个阶段结束时间之后 |
|
|
|
|
this.$set(form, 'stageName', '') |
|
|
|
|
endText = '竞赛结束' |
|
|
|
|
total = playEndTime - now |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
this.endList[4] = endText |
|
|
|
|
} |
|
|
|
|
this.curStage = curStage |
|
|
|
|
} else { // 仅发布信息 |
|
|
|
|
total = playEndTime - now |
|
|
|
|
this.endList[4] = endText |
|
|
|
|
} |
|
|
|
|
status = 4 |
|
|
|
|
} else if (now > playEndTime) { // 比赛结束 |
|
|
|
|
status = 5 |
|
|
|
|
} |
|
|
|
|
this.status = status |
|
|
|
|
total = total / 1000 |
|
|
|
|
--total |
|
|
|
|
if (total > 86400) { // 超过一天则显示天数 |
|
|
|
|
// clearInterval(this.timer) |
|
|
|
|
this.end = Math.floor(total / 86400) + '天' |
|
|
|
|
} else if (total > 0) { // 一天之内,显示时分秒 |
|
|
|
|
let hours = Math.floor(total / (60 * 60)) |
|
|
|
|
let minutes = Math.floor(total % (60 * 60) / 60) |
|
|
|
|
let seconds = Math.floor(total % (60 * 60) % 60) |
|
|
|
|
time = `${this.core.formateTime(hours)}:${this.core.formateTime(minutes)}:${this.core.formateTime(seconds)}` |
|
|
|
|
if (total > 0) this.end = time |
|
|
|
|
} else if (this.status === 5) { // 竞赛结束,清除定时器 |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
this.curStage = curStage |
|
|
|
|
} else { // 仅发布信息 |
|
|
|
|
total = playEndTime - now |
|
|
|
|
} |
|
|
|
|
}, 1000) |
|
|
|
|
status = 4 |
|
|
|
|
} else if (now > playEndTime) { // 比赛结束 |
|
|
|
|
status = 5 |
|
|
|
|
} |
|
|
|
|
this.status = status |
|
|
|
|
total = total / 1000 |
|
|
|
|
--total |
|
|
|
|
if (total > 86400) { // 超过一天则显示天数 |
|
|
|
|
// clearInterval(this.timer) |
|
|
|
|
this.end = Math.floor(total / 86400) + '天' |
|
|
|
|
} else if (total > 0) { // 一天之内,显示时分秒 |
|
|
|
|
let hours = Math.floor(total / (60 * 60)) |
|
|
|
|
let minutes = Math.floor(total % (60 * 60) / 60) |
|
|
|
|
let seconds = Math.floor(total % (60 * 60) % 60) |
|
|
|
|
time = `${this.core.formateTime(hours)}:${this.core.formateTime(minutes)}:${this.core.formateTime(seconds)}` |
|
|
|
|
if (total > 0) this.end = time |
|
|
|
|
} else if (this.status === 5) { // 竞赛结束,清除定时器 |
|
|
|
|
clearInterval(this.timer) |
|
|
|
|
} |
|
|
|
|
// }, 1000) |
|
|
|
|
}, |
|
|
|
|
isLink (stage) { |
|
|
|
|
console.log("🚀 ~ file: index.vue:904 ~ isLink ~ stage:", stage) |
|
|
|
|
return stage.method === 2 && /[a-zA-Z\d]+\.[a-zA-Z]+/.test(stage.offlineAddress) |
|
|
|
|
// 该阶段是否符合线下能进入比赛的条件 |
|
|
|
|
offlineCanEntry (stage) { |
|
|
|
|
return stage.method === 2 && stage.competitionStageContentSetting && !!(stage.competitionStageContentSetting.systemLink || stage.competitionStageContentSetting.whetherToUploadFiles) |
|
|
|
|
}, |
|
|
|
|
// 获取竞赛信息 |
|
|
|
|
getInfo () { |
|
|
|
@ -1066,7 +1131,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 定时调获取排名接口 |
|
|
|
|
intervalRank () { |
|
|
|
|
this.rankTimer = setInterval(this.getRank, 1000) |
|
|
|
|
// this.rankTimer = setInterval(this.getRank, 1000) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 删除指导老师 |
|
|
|
@ -1348,6 +1413,56 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 附件上传前 |
|
|
|
|
beforeUpload (file) { |
|
|
|
|
const oversize = file.size / 1024 / 1024 < 1000 |
|
|
|
|
if (!oversize) util.warningMsg('请上传小于1GB的附件!') |
|
|
|
|
if (oversize) { |
|
|
|
|
return true |
|
|
|
|
} else { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
uploadError (err, file, fileList) { |
|
|
|
|
this.$message({ |
|
|
|
|
message: "上传出错,请重试!", |
|
|
|
|
type: "error", |
|
|
|
|
center: true |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
beforeRemove (file, fileList) { |
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
|
}, |
|
|
|
|
handleExceed (files, fileList) { |
|
|
|
|
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
|
|
|
|
}, |
|
|
|
|
handleRemove (file, fileList) { }, |
|
|
|
|
uploadSuccess (res) { |
|
|
|
|
this.filesResult = res.filesResult |
|
|
|
|
}, |
|
|
|
|
// 提交阶段内容 |
|
|
|
|
stageSubmit () { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
this.submiting = true |
|
|
|
|
// 有上传记录,则删除上次的文件 |
|
|
|
|
this.curStage.competitionStageFile && this.$post(this.api.cCompetitionStageFileDel, [this.curStage.competitionStageFile.id]).then(res => { }).catch(res => { }) |
|
|
|
|
this.$post(this.api.cCompetitionStageFileSave, { |
|
|
|
|
competitionId: this.id, |
|
|
|
|
fileFormat: this.filesResult.fileType, |
|
|
|
|
fileName: this.filesResult.originalFileName, |
|
|
|
|
filePath: this.filesResult.fileUrl, |
|
|
|
|
fileSize: this.filesResult.fileSize, |
|
|
|
|
ossFileName: this.filesResult.ossFileName, |
|
|
|
|
stageId: this.curStage.stageId, |
|
|
|
|
teamId: this.form.competitionRegistration.teamId |
|
|
|
|
}).then(res => { |
|
|
|
|
util.successMsg('提交成功!') |
|
|
|
|
this.stageVisible = false |
|
|
|
|
this.submiting = false |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 选择要进入的阶段 |
|
|
|
|
chooseStage (e) { |
|
|
|
|
this.curStage = e |
|
|
|
@ -1376,9 +1491,15 @@ export default { |
|
|
|
|
if (util.local.get(Setting.tokenKey)) { |
|
|
|
|
const { competitionType } = form.completeCompetitionSetup |
|
|
|
|
if (status == 4) { // 进入比赛 |
|
|
|
|
// 线下 |
|
|
|
|
// 线下(规则见handleStatus方法) |
|
|
|
|
if (this.curStage.method == 2) { |
|
|
|
|
window.open(this.curStage.offlineAddress) |
|
|
|
|
// 直接打开系统链接 |
|
|
|
|
if (!this.curStage.competitionStageContentSetting.whetherToUploadFiles) { |
|
|
|
|
window.open(this.curStage.competitionStageContentSetting.systemLink) |
|
|
|
|
} else { // 显示上传文件弹框 |
|
|
|
|
this.stageVisible = true |
|
|
|
|
console.log("🚀 ~ file: index.vue:1499 ~ signup ~ this.curStage:", this.curStage) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// 参加过比赛不让参加 |
|
|
|
|
if (this.curStage && this.curStage.count) return util.errorMsg('您已经参加过该阶段竞赛!') |
|
|
|
@ -1435,7 +1556,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 线下比赛方式点击进入跳转<比赛地点> |
|
|
|
|
toOffline () { |
|
|
|
|
window.open(this.curStage.offlineAddress) |
|
|
|
|
window.open(this.curStage.competitionStageContentSetting.systemLink) |
|
|
|
|
}, |
|
|
|
|
// 进入python系统 |
|
|
|
|
toPython () { |
|
|
|
|