|
|
|
@ -1,132 +1,73 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<div class="page"> |
|
|
|
|
<div v-show="!setVisible" class="page"> |
|
|
|
|
<div class="page-content"> |
|
|
|
|
<div class="p-title">大赛信息</div> |
|
|
|
|
<div class="p-title">比赛内容设置</div> |
|
|
|
|
<el-form label-width="170px" label-suffix=":" size="small"> |
|
|
|
|
<el-form-item label="竞赛类型"> |
|
|
|
|
团队赛(2-4人/队) <span class="tips">(如需修改,请返回上一步。)</span> |
|
|
|
|
<div v-for="(item, i) in form" :key="i" class="step"> |
|
|
|
|
<div class="title"> |
|
|
|
|
<span>{{ item.stageName }}(第{{ nums[i] }}阶段) | {{ methods.find(e => e.id === item.method).name }} </span> |
|
|
|
|
<el-button v-if="item.method !== 2" type="primary" @click="toSet(i)">设置</el-button> |
|
|
|
|
</div> |
|
|
|
|
<el-form-item prop="startTime" label="比赛时间"> |
|
|
|
|
<span v-if="item.method !== 2 && item.startTime">{{ item.startTime + ' 至 ' + item.endTime }}</span> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-if="item.method === 2" |
|
|
|
|
v-model="item.time" |
|
|
|
|
type="datetimerange" |
|
|
|
|
range-separator="~" |
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
end-placeholder="结束日期"> |
|
|
|
|
</el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="rule" label="赛制"> |
|
|
|
|
<el-radio v-for="(rule, i) in rules" :key="i" v-model="form.rule" :label="rule.id">{{ rule.name }}</el-radio> |
|
|
|
|
<p class="tips">积分赛——包含多个竞赛阶段,每个阶段的成绩都包含在最终总成绩里,最后一轮结束后总成绩排名靠前的参赛者得到获奖资格。</p> |
|
|
|
|
<p class="tips">淘汰赛——包含多个竞赛阶段,每个阶段结束后之后只有部分参赛者能晋级下一阶段,晋级最后一轮且在最后一轮排名靠前的参赛者得到获奖资格。</p> |
|
|
|
|
<p class="tips">单项赛——仅包含一个竞赛阶段,单项的成绩排名即为最终排名,排名靠前的参赛者得到获奖资格。</p> |
|
|
|
|
<p class="tips">注:系统默认排名规则,优先按分数排名(分数高则排名靠前),分数相同则按用时排名(用时短则排名靠前)。</p> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="stageNum" label="阶段数量"> |
|
|
|
|
<div class="input-center"> |
|
|
|
|
<el-select v-model="form.stageNum" clearable> |
|
|
|
|
<el-option v-for="i in 3" :key="i" :label="i" :value="i"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</div> |
|
|
|
|
<div class="tips"> |
|
|
|
|
(团队赛是否限制队内每个成员只能参加一个阶段赛项? |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="0">是</el-radio> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="1">否</el-radio> |
|
|
|
|
) |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="stageNum" label="总成绩计算方式"> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="0">各阶段成绩加权求和</el-radio> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="1">各阶段成绩直接求和</el-radio> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="2">各阶段成绩取平均值</el-radio> |
|
|
|
|
<p class="tips">(若选择加权求和,则需要设置每个阶段成绩所占权重,且权重总和须为100%)</p> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="stageNum" label="阶段设置"> |
|
|
|
|
<div class="step-set"> |
|
|
|
|
<div class="line"> |
|
|
|
|
第一阶段 <el-input v-model="form.stageName" clearable placeholder="请输入阶段名称,如“初赛”" style="width: 200px"></el-input> |
|
|
|
|
</div> |
|
|
|
|
<template v-if="item.method === 2"> |
|
|
|
|
<el-form-item label="比赛地点"> |
|
|
|
|
<el-input v-model="item.offlineAddress" style="width: 80%"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="比赛内容"> |
|
|
|
|
<el-input v-model="item.contentDescription" type="textarea" style="width: 80%"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="评分规则"> |
|
|
|
|
<el-input v-model="item.scoreRule" type="textarea" style="width: 80%"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<template v-else> |
|
|
|
|
<el-form-item prop="cid" label="课程系统"> |
|
|
|
|
{{ item.sysName }} |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="assessmentId" label="已选择考核"> |
|
|
|
|
{{ item.projectName }} |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="resultAnnouncementTime" label="比赛地点"> |
|
|
|
|
<div class="line"> |
|
|
|
|
<span class="req">*</span> |
|
|
|
|
比赛方式: |
|
|
|
|
<el-radio v-for="(item, i) in methods" :key="i" v-model="form.method" :label="item.id">{{ item.name }}</el-radio> |
|
|
|
|
<el-checkbox v-model="item.onlineButton">线上</el-checkbox> |
|
|
|
|
<el-input v-model="item.onlineAddress" clearable placeholder="请输入比赛网址" :disabled="!item.onlineButton" style="width: 400px;margin-left: 10px"></el-input> |
|
|
|
|
</div> |
|
|
|
|
<div class="line"> |
|
|
|
|
<span class="req">*</span> |
|
|
|
|
团队参赛人数限制: |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="0">不限制</el-radio> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="1">自定义</el-radio> |
|
|
|
|
<el-input v-model="form.name" style="width: 150px;"></el-input> 人 |
|
|
|
|
<span class="tips">(可限制本阶段单个团队的出战人数)</span> |
|
|
|
|
<el-checkbox v-model="item.offlineButton">线下</el-checkbox> |
|
|
|
|
<el-input v-model="item.offlineAddress" clearable placeholder="请输入地址" :disabled="!item.offlineButton" style="width: 400px;margin-left: 10px"></el-input> |
|
|
|
|
</div> |
|
|
|
|
<div class="line"> |
|
|
|
|
<span class="req">*</span> |
|
|
|
|
团队成绩计算方式: |
|
|
|
|
<el-radio v-for="(item, i) in teamCalculationMethods" :key="i" v-model="form.teamCalculationMethod" :label="item.id">{{ item.name }}</el-radio> |
|
|
|
|
<span class="tips">(可设置本阶段的团队取分规则)</span> |
|
|
|
|
</div> |
|
|
|
|
<div class="line" style="display: flex;"> |
|
|
|
|
<p> |
|
|
|
|
<span class="req">*</span>晋级规则: |
|
|
|
|
</p> |
|
|
|
|
<div> |
|
|
|
|
<div class="line"> |
|
|
|
|
本阶段成绩排名前 |
|
|
|
|
<el-input v-model="form.stageName" style="width: 100px"></el-input> |
|
|
|
|
队,可晋级下一阶段比赛 |
|
|
|
|
</div> |
|
|
|
|
<div class="line"> |
|
|
|
|
本阶段成绩排名前 |
|
|
|
|
<el-input v-model="form.stageName" style="width: 100px"></el-input> |
|
|
|
|
%,可晋级下一阶段比赛 |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
本阶段成绩 |
|
|
|
|
<el-select v-model="form.stageNum" clearable style="width: 80px;margin-right: 10px"> |
|
|
|
|
<el-option v-for="i in operators" :key="i" :label="i" :value="i"></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
<el-input v-model="form.stageName" style="width: 100px"></el-input> |
|
|
|
|
分,可晋级下一阶段比赛 |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="line"> |
|
|
|
|
<span class="req">*</span> |
|
|
|
|
占总成绩权重: |
|
|
|
|
<el-input v-model="form.name" style="width: 150px;"></el-input> % |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="rule" label="成绩公布时间"> |
|
|
|
|
(阶段)比赛结束后 |
|
|
|
|
<el-input v-model="form.stageName" style="width: 120px"></el-input> |
|
|
|
|
小时,公布(阶段)比赛成绩。 |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="rule" label="是否公布成绩详情"> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="0">是</el-radio> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="1">否</el-radio> |
|
|
|
|
<p class="tips">若选择“是”,则公布成绩详情,竞赛结束后参赛者可查看自己的比赛成绩得分详情;</p> |
|
|
|
|
<p class="tips">若选择“否”,则不公布成绩详情,参赛者只能知晓自己的分数及排名,不能查看得分详情。</p> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
</div> |
|
|
|
|
</el-form> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<set v-if="setVisible" :form.sync="form[curStep]" @hideSet="hideSet" /> |
|
|
|
|
</div> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import util from "@/libs/util"; |
|
|
|
|
import quill from "@/components/quill"; |
|
|
|
|
import set from './set' |
|
|
|
|
export default { |
|
|
|
|
props: ['setupId'], |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
form: {}, |
|
|
|
|
rules: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '积分赛' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '淘汰赛' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '单项赛' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
step1: this.$parent.$refs.step1.form, |
|
|
|
|
step2: this.$parent.$refs.step2.form, |
|
|
|
|
nums: ['一', '二', '三'], |
|
|
|
|
methods: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
@ -141,393 +82,114 @@ export default { |
|
|
|
|
name: '线下' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
teamCalculationMethods: [ |
|
|
|
|
{ |
|
|
|
|
id: 0, |
|
|
|
|
name: '最高分' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 1, |
|
|
|
|
name: '平均分' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
id: 2, |
|
|
|
|
name: '总分' |
|
|
|
|
} |
|
|
|
|
], |
|
|
|
|
operators: ['>', '>=', '=', '<', '<='] |
|
|
|
|
originForm: { |
|
|
|
|
cid: '', |
|
|
|
|
contentDescription: '', |
|
|
|
|
endTime: '', |
|
|
|
|
scoreRule: '', |
|
|
|
|
stageId: '', |
|
|
|
|
startTime: '', |
|
|
|
|
systemId: '', |
|
|
|
|
offlineAddress: '', |
|
|
|
|
offlineButton: 0, |
|
|
|
|
onlineAddress: '', |
|
|
|
|
onlineButton: 0, |
|
|
|
|
time: [] |
|
|
|
|
}, |
|
|
|
|
form: [], |
|
|
|
|
setVisible: false, |
|
|
|
|
curStep: 0 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
|
quill |
|
|
|
|
set |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
|
|
|
|
form: { |
|
|
|
|
handler(){ |
|
|
|
|
this.updateTime++ |
|
|
|
|
}, |
|
|
|
|
deep:true |
|
|
|
|
}, |
|
|
|
|
signupTime: function(val) { |
|
|
|
|
const { form } = this |
|
|
|
|
if (val) { |
|
|
|
|
form.signUpStartTime = val[0]; |
|
|
|
|
form.signUpEndTime = val[1]; |
|
|
|
|
} else { |
|
|
|
|
form.signUpStartTime = '' |
|
|
|
|
form.signUpEndTime = '' |
|
|
|
|
} |
|
|
|
|
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
|
|
|
|
form: { |
|
|
|
|
handler(){ |
|
|
|
|
this.updateTime++ |
|
|
|
|
}, |
|
|
|
|
playTime: function(val) { |
|
|
|
|
const { form } = this |
|
|
|
|
if (val) { |
|
|
|
|
form.playStartTime = val[0] |
|
|
|
|
form.playEndTime = val[1] |
|
|
|
|
} else { |
|
|
|
|
form.playStartTime = '' |
|
|
|
|
form.playEndTime = '' |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
deep:true |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
// this.getData() |
|
|
|
|
// this.getSchool() |
|
|
|
|
this.handleForm() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getData() { |
|
|
|
|
const { id } = this.form |
|
|
|
|
id && this.$post(`${this.api.getContest}?contestId=${id}`).then(({ contest }) => { |
|
|
|
|
this.signupTime = [contest.signUpStartTime, contest.signUpEndTime] |
|
|
|
|
this.playTime = [contest.playStartTime, contest.playEndTime] |
|
|
|
|
this.sponsorList = contest.sponsor.split(",") |
|
|
|
|
this.undertakerList = contest.undertaker.split(",") |
|
|
|
|
// 附件 |
|
|
|
|
const fileList = contest.contestAnnexList |
|
|
|
|
if (fileList) { |
|
|
|
|
const files = [] |
|
|
|
|
fileList.map(e => { |
|
|
|
|
files.push({ |
|
|
|
|
name: e.fileName, |
|
|
|
|
url: e.filePath |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.fileList = files |
|
|
|
|
} else { |
|
|
|
|
contest.contestAnnexList = [] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 选择范围 |
|
|
|
|
const ranges = contest.contestRangeList |
|
|
|
|
if (ranges) { |
|
|
|
|
const range = [] |
|
|
|
|
ranges.map(e => { |
|
|
|
|
const item = [+e.provinceId] |
|
|
|
|
e.cityId && item.push(+e.cityId) |
|
|
|
|
e.schoolId && item.push(+e.schoolId) |
|
|
|
|
range.push(item) |
|
|
|
|
}) |
|
|
|
|
this.range = range |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 选择范围name |
|
|
|
|
const rangeName = contest.contestRangeRespList |
|
|
|
|
if (rangeName) { |
|
|
|
|
const range = [] |
|
|
|
|
rangeName.map(e => { |
|
|
|
|
range.push(e.type ? (e.cityName || e.provinceName) : e.schoolName) |
|
|
|
|
}) |
|
|
|
|
this.rangeName = range.join(',') |
|
|
|
|
} |
|
|
|
|
this.form = contest |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
// 选择范围 |
|
|
|
|
showRange() { |
|
|
|
|
this.rangeVisible = true |
|
|
|
|
}, |
|
|
|
|
// 范围勾选回调 |
|
|
|
|
rangeChange(val, e) { |
|
|
|
|
const checked = this.$refs.range.getCheckedNodes() |
|
|
|
|
const name = [] |
|
|
|
|
const { rangeChecked } = this |
|
|
|
|
checked.map(e => { |
|
|
|
|
rangeChecked.find(n => n.value === e.value && n.label == e.label) || name.push(e.data) // 未勾选的,则push |
|
|
|
|
}) |
|
|
|
|
this.rangeChecked.push(...name) |
|
|
|
|
}, |
|
|
|
|
// 范围展开收缩回调 |
|
|
|
|
rangeViChange(e) { |
|
|
|
|
// 展开的时候清空搜索结果 |
|
|
|
|
if (e) { |
|
|
|
|
this.rangeList = [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取学校列表 |
|
|
|
|
getSchool() { |
|
|
|
|
this.$get(this.api.querySchoolData).then(({ list }) => { |
|
|
|
|
const result = [] |
|
|
|
|
list.map(e => { |
|
|
|
|
e.value = e.schoolId |
|
|
|
|
e.label = e.schoolName |
|
|
|
|
e.leaf = true |
|
|
|
|
result.push(e) |
|
|
|
|
}) |
|
|
|
|
this.schools = result |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 范围模糊查询前置钩子 |
|
|
|
|
beforeFilter() { |
|
|
|
|
return false |
|
|
|
|
}, |
|
|
|
|
// 范围筛选 |
|
|
|
|
rangeSearch(el) { |
|
|
|
|
const val = el.target.value.trim() |
|
|
|
|
const checked = this.rangeChecked |
|
|
|
|
if (!val) { |
|
|
|
|
this.rangeList = [] |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
clearTimeout(this.rangeTimer) |
|
|
|
|
this.rangeTimer = setTimeout(() => { |
|
|
|
|
let result = this.schools.filter(e => { |
|
|
|
|
if (e.label.includes(val)) { |
|
|
|
|
e.disabled = !!checked.find(n => n.schoolId == e.schoolId) |
|
|
|
|
return e |
|
|
|
|
} |
|
|
|
|
}) // 用学校列表做比对 |
|
|
|
|
this.rangeList = result |
|
|
|
|
}, 100) |
|
|
|
|
}, |
|
|
|
|
closeRange(i) { |
|
|
|
|
this.rangeChecked.splice(i, 1) |
|
|
|
|
}, |
|
|
|
|
// 范围确定 |
|
|
|
|
rangeSubmit() { |
|
|
|
|
// 处理提交需要的id |
|
|
|
|
const data = [] |
|
|
|
|
const checked = this.rangeChecked |
|
|
|
|
checked.map(e => { |
|
|
|
|
data.push({ |
|
|
|
|
provinceId: e.provinceId || '', |
|
|
|
|
cityId: e.cityId || '', |
|
|
|
|
schoolId: e.schoolId || '', |
|
|
|
|
type: e.schoolId ? 0 : 1 |
|
|
|
|
// 处理form |
|
|
|
|
handleForm() { |
|
|
|
|
// 根据赛事id查询赛事规则 |
|
|
|
|
this.$post(`${this.api.queryCompetitionStageBySetupId}?setupId=${this.setupId}`).then(res => { |
|
|
|
|
res.competitionStages.map(e => { |
|
|
|
|
const form = JSON.parse(JSON.stringify(this.originForm)) |
|
|
|
|
form.stageId = e.stageId |
|
|
|
|
form.method = e.method |
|
|
|
|
form.stageName = e.stageName |
|
|
|
|
this.form.push(form) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
this.form.contestRangeList = data |
|
|
|
|
|
|
|
|
|
// 处理显示的name |
|
|
|
|
const name = [] |
|
|
|
|
checked.map(e => { |
|
|
|
|
name.push(e.label) |
|
|
|
|
}) |
|
|
|
|
this.rangeName = name.join('、') |
|
|
|
|
|
|
|
|
|
this.rangeVisible = false |
|
|
|
|
}, |
|
|
|
|
handleExceed(files, fileList) { |
|
|
|
|
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
|
|
|
|
}, |
|
|
|
|
handleExceedAnnex(files, fileList) { |
|
|
|
|
util.warningMsg(`当前限制选择 5 个文件,如需更换,请删除一个文件再重新选择!`); |
|
|
|
|
}, |
|
|
|
|
uploadSuccess(res) { |
|
|
|
|
const { coverUrl } = this.form |
|
|
|
|
coverUrl && this.$del(`${this.api.fileDeletion}?keys=${coverUrl}`).then(res => {}).catch(res => {}) |
|
|
|
|
this.form.coverUrl = res.data.filesResult.fileUrl |
|
|
|
|
}, |
|
|
|
|
uploadLgSuccess(res) { |
|
|
|
|
const { carouselUrl } = this.form |
|
|
|
|
carouselUrl && this.$del(`${this.api.fileDeletion}?keys=${carouselUrl}`).then(res => {}).catch(res => {}) |
|
|
|
|
this.form.carouselUrl = res.data.filesResult.fileUrl |
|
|
|
|
}, |
|
|
|
|
// 附件上传成功 |
|
|
|
|
uploadAnnexSuccess(res) { |
|
|
|
|
const file = res.data.filesResult |
|
|
|
|
const { id } = this.form |
|
|
|
|
const data = { |
|
|
|
|
contestId: id || '', |
|
|
|
|
fileName: this.fileName, |
|
|
|
|
filePath: file.fileUrl || file.fileId |
|
|
|
|
} |
|
|
|
|
this.form.contestAnnexList.push(data) |
|
|
|
|
// 编辑的时候需要调新增附件接口 |
|
|
|
|
id && this.$post(this.api.saveAnnex, data).then(res => {}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
// 附件上传前 |
|
|
|
|
beforeUpload(file) { |
|
|
|
|
const isLt2M = file.size / 1024 / 1024 < 10 |
|
|
|
|
if (!isLt2M) util.warningMsg('请上传小于10MB的附件!') |
|
|
|
|
if (isLt2M) { |
|
|
|
|
this.fileName = file.name |
|
|
|
|
return true |
|
|
|
|
} else { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
uploadError(err, file, fileList) { |
|
|
|
|
this.$message({ |
|
|
|
|
message: "上传出错,请重试!", |
|
|
|
|
type: "error", |
|
|
|
|
center: true |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
beforeRemove(file, fileList) { |
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
|
}, |
|
|
|
|
handleRemove(file, fileList) { |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${this.form.coverUrl}`).then(res => { |
|
|
|
|
this.form.coverUrl = '' |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
handleLgRemove(file, fileList) { |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${this.form.carouselUrl}`).then(res => { |
|
|
|
|
this.form.carouselUrl = '' |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
// 显示设置页面 |
|
|
|
|
toSet(i) { |
|
|
|
|
this.curStep = i |
|
|
|
|
this.setVisible = true |
|
|
|
|
}, |
|
|
|
|
handleAnnexRemove(file, fileList) { |
|
|
|
|
const { url, name } = file |
|
|
|
|
url && this.$del(`${this.api.fileDeletion}?keys=${url}`).then(res => {}).catch(res => {}) |
|
|
|
|
const id = this.form.contestAnnexList.find(e => e.fileName === name).id |
|
|
|
|
id && this.$post(`${this.api.deleteAnnex}?id=${id}`).then(res => {}).catch(res => {}) |
|
|
|
|
// 隐藏设置 |
|
|
|
|
hideSet(form) { |
|
|
|
|
if (form) this.form[this.curStep] = form |
|
|
|
|
this.setVisible = false |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
save(status, frame) { |
|
|
|
|
if (this.submiting) return false; |
|
|
|
|
const { form } = this |
|
|
|
|
form.sponsor = this.sponsorList.filter(d => d).join(); |
|
|
|
|
form.undertaker = this.undertakerList.filter(d => d).join(); |
|
|
|
|
if (form.competitionScope == 2 && !form.contestRangeList.length) return util.warningMsg('请选择区域、院校') |
|
|
|
|
if (!form.name) return util.warningMsg("请填写竞赛名称"); |
|
|
|
|
if (status == 1) { |
|
|
|
|
if (!form.sponsor) return util.warningMsg("请填写主办方"); |
|
|
|
|
if (!form.signUpStartTime) return util.warningMsg("请选择报名时间"); |
|
|
|
|
save(status, next = 0) { |
|
|
|
|
const { form } = this |
|
|
|
|
let invalid = 0 |
|
|
|
|
for (const e of form) { |
|
|
|
|
if (!e.time.length) { |
|
|
|
|
invalid = 1 |
|
|
|
|
util.errorMsg('请选择比赛时间') |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
let now = new Date().getTime(); |
|
|
|
|
let signUpStartTime = new Date(form.signUpStartTime).getTime(); |
|
|
|
|
let signUpEndTime = new Date(form.signUpEndTime).getTime(); |
|
|
|
|
let playStartTime = new Date(form.playStartTime).getTime(); |
|
|
|
|
// if (signUpStartTime && now > signUpStartTime) return util.warningMsg("报名时间不能早于当前时间"); |
|
|
|
|
if (!form.playStartTime && status == 1) return util.warningMsg("请选择竞赛时间"); |
|
|
|
|
if (playStartTime && playStartTime < signUpEndTime) return util.warningMsg("竞赛时间不能早于报名结束时间"); |
|
|
|
|
if (!form.description && status == 1) return util.warningMsg("请填写竞赛详情"); |
|
|
|
|
|
|
|
|
|
this.submiting = true |
|
|
|
|
form.publishStatus = status |
|
|
|
|
form.ztOpen = status ? 0 : 1 // 保存则禁用,发布则启用 |
|
|
|
|
if (this.form.id) { |
|
|
|
|
this.$post(this.api.editContest, form).then(res => { |
|
|
|
|
this.updateTime = 1 |
|
|
|
|
this.submiting = false; |
|
|
|
|
util.successMsg("修改成功"); |
|
|
|
|
frame || this.$router.push(`/match?page=${this.$store.state.matchPage}`) // frame为1则表示是父页面调的,不作返回操作 |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
this.submiting = false; |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.addContest, form).then(res => { |
|
|
|
|
this.submiting = false; |
|
|
|
|
util.successMsg("创建成功"); |
|
|
|
|
frame || this.$router.push(`/match?page=${this.$store.state.matchPage}`) // frame为1则表示是父页面调的,不作返回操作 |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
this.submiting = false; |
|
|
|
|
}); |
|
|
|
|
e.startTime = e.time[0] |
|
|
|
|
e.endTime = e.time[1] |
|
|
|
|
if (e.method !== 2 && !e.cid) { |
|
|
|
|
invalid = 1 |
|
|
|
|
util.errorMsg('请选择课程') |
|
|
|
|
break |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 预览 |
|
|
|
|
preview() { |
|
|
|
|
util.local.set('match', this.form) |
|
|
|
|
window.open(this.$router.resolve('/matchPreview').href) |
|
|
|
|
}, |
|
|
|
|
back() { |
|
|
|
|
const updateTime = this.updateTime |
|
|
|
|
const { id } = this.form |
|
|
|
|
// 更改了信息才需要提示 |
|
|
|
|
if ((id && updateTime > 1) || (!id && updateTime)) { |
|
|
|
|
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { |
|
|
|
|
type: 'warning' |
|
|
|
|
}).then(() => { |
|
|
|
|
this.save(0) |
|
|
|
|
}).catch(() => { |
|
|
|
|
this.backPage() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
if (invalid) return |
|
|
|
|
if (form[0].contentId) { |
|
|
|
|
this.$post(this.api.editCompetitionContent, form).then(res => { |
|
|
|
|
util.successMsg("修改成功"); |
|
|
|
|
this.$emit('next', next) |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
} else { |
|
|
|
|
this.backPage() |
|
|
|
|
this.$post(this.api.addCompetitionContent, { |
|
|
|
|
competitionContents: form |
|
|
|
|
}).then(res => { |
|
|
|
|
util.successMsg("创建成功"); |
|
|
|
|
this.$emit('next', next) |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
backPage(){ |
|
|
|
|
this.$router.back() |
|
|
|
|
}, |
|
|
|
|
addSponsor() { |
|
|
|
|
this.sponsorList.push(""); |
|
|
|
|
}, |
|
|
|
|
delSponsor(index) { |
|
|
|
|
this.sponsorList.splice(index, 1); |
|
|
|
|
}, |
|
|
|
|
addOrganizer() { |
|
|
|
|
this.undertakerList.push(""); |
|
|
|
|
}, |
|
|
|
|
delOrganizer(index) { |
|
|
|
|
this.undertakerList.splice(index, 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
/deep/ .d-inline-block { |
|
|
|
|
width: 216px; |
|
|
|
|
.el-select, .el-input { |
|
|
|
|
width: 100%; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.inline-input { |
|
|
|
|
.input-wrap { |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
|
|
|
|
|
.el-input { |
|
|
|
|
display: inline-block; |
|
|
|
|
width: 216px; |
|
|
|
|
margin-right: 8px; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.remove { |
|
|
|
|
width: 16px; |
|
|
|
|
height: 16px; |
|
|
|
|
background: url("../../../assets/img/close.png") 0 0/cover no-repeat; |
|
|
|
|
cursor: pointer; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.add-btn { |
|
|
|
|
margin-left: 32px; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.input-center { |
|
|
|
|
display: flex; |
|
|
|
|
align-items: center; |
|
|
|
|
width: 216px; |
|
|
|
|
white-space: nowrap; |
|
|
|
|
.el-input { |
|
|
|
|
margin-right: 5px; |
|
|
|
|
.step { |
|
|
|
|
padding-bottom: 10px; |
|
|
|
|
background-color: #f9f9f9; |
|
|
|
|
.title { |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: space-between; |
|
|
|
|
align-items: center; |
|
|
|
|
padding: 10px 15px; |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
background-color: #ededed; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.step-set { |
|
|
|
|
padding: 15px; |
|
|
|
|
background-color: #fbfbfb; |
|
|
|
|
} |
|
|
|
|
.tips { |
|
|
|
|
font-size: 13px; |
|
|
|
|
color: #959595; |
|
|
|
|
} |
|
|
|
|
.req { |
|
|
|
|
color: #f00; |
|
|
|
|
} |
|
|
|
|
.line { |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
} |
|
|
|
|