大赛新增联调

dev_202303
yujialong 2 years ago
parent 13ceb7ea8a
commit 121b50bc31
  1. 1
      src/utils/api.js
  2. 19
      src/views/match/add/index.vue
  3. 169
      src/views/match/add/set.vue
  4. 12
      src/views/match/add/step1.vue
  5. 5
      src/views/match/add/step2.vue
  6. 598
      src/views/match/add/step3.vue

@ -317,6 +317,7 @@ export default {
addCompetitionRule: `competition/competition/rule/addCompetitionRule`, addCompetitionRule: `competition/competition/rule/addCompetitionRule`,
editCompetitionRule: `competition/competition/rule/editCompetitionRule`, editCompetitionRule: `competition/competition/rule/editCompetitionRule`,
getCompetitionRule: `competition/competition/rule/getCompetitionRule`, getCompetitionRule: `competition/competition/rule/getCompetitionRule`,
queryCompetitionStageBySetupId: `competition/competition/stage/queryCompetitionStageBySetupId`,
// 竞赛进展 // 竞赛进展
addCompetitionProgress: `competition/competition/progress/addCompetitionProgress`, addCompetitionProgress: `competition/competition/progress/addCompetitionProgress`,
deleteCompetitionProgress: `competition/competition/progress/deleteCompetitionProgress`, deleteCompetitionProgress: `competition/competition/progress/deleteCompetitionProgress`,

@ -25,7 +25,8 @@
<div class="page"> <div class="page">
<div class="page-content"> <div class="page-content">
<step1 v-show="step === 1" ref="step1" @next="next" /> <step1 v-show="step === 1" ref="step1" @next="next" />
<step2 v-show="step === 2" ref="step2" :setupId.sync="setupId" /> <step2 v-show="step === 2" ref="step2" :setupId.sync="setupId" @next="next" />
<step3 v-if="step === 3" ref="step3" :setupId.sync="setupId" />
<div class="btns"> <div class="btns">
<el-button v-if="!form.id" @click="save(0)">保存{{ releaseType ? '草稿' : '' }}</el-button> <el-button v-if="!form.id" @click="save(0)">保存{{ releaseType ? '草稿' : '' }}</el-button>
@ -44,6 +45,7 @@ import util from "@/libs/util";
import quill from "@/components/quill"; import quill from "@/components/quill";
import step1 from './step1' import step1 from './step1'
import step2 from './step2' import step2 from './step2'
import step3 from './step3'
export default { export default {
name: "add", name: "add",
data() { data() {
@ -59,7 +61,8 @@ export default {
components: { components: {
quill, quill,
step1, step1,
step2 step2,
step3
}, },
mounted() { mounted() {
@ -70,10 +73,14 @@ export default {
// if (this.submiting) return false // if (this.submiting) return false
this.$refs['step' + this.step].save(status, next, this.releaseType) this.$refs['step' + this.step].save(status, next, this.releaseType)
}, },
// //
next(id) { next(next, id) {
this.setupId = id if (!next) {
this.step++ this.$router.push(`/match?page=${this.$store.state.matchPage}`)
} else if (next === 2) {
if (id) this.setupId = id
this.step++
}
}, },
// //
preview() { preview() {

@ -0,0 +1,169 @@
<template>
<div>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between">
<el-page-header @back="back" content="设置大赛内容"></el-page-header>
<div>
<el-button type="primary" @click="save">保存</el-button>
</div>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<div>
<p class="m-b-20">比赛名称</p>
{{ form.stageName }}
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<div>
<p class="m-b-20">比赛时间</p>
<div class="date-inputs">
起止时间
<el-date-picker
v-model="form.time"
type="datetimerange"
range-separator="~"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss">
</el-date-picker>
</div>
</div>
</el-card>
<el-card shadow="hover" class="mgr20 m-b-20">
<div>
<p class="m-b-20">课程</p>
<div class="inline-input">
<el-select v-model="form.cid" @change="courseChange">
<el-option
v-for="item in curriculumList"
:key="item.cid"
:label="item.curriculumName"
:value="item.cid">
</el-option>
</el-select>
</div>
</div>
</el-card>
<el-card shadow="hover" class="m-b-20">
<div class="flex-between m-b-20">
<span>实训项目</span>
<div style="display: inline-flex;">
<div>
<el-input placeholder="请输入项目名称" prefix-icon="el-icon-search" v-model.trim="keyword" clearable></el-input>
</div>
<el-button style="margin-left: 5px" type="primary" round>自定义实验项目</el-button>
</div>
</div>
<!-- 实训项目表格 -->
<el-table :data="projects" class="table" stripe header-align="center">
<el-table-column width="60" label="选择" align="center">
<template slot-scope="scope">
<el-radio v-model="form.projectId" :label="scope.row.projectId">&nbsp;</el-radio>
</template>
</el-table-column>
<el-table-column prop="projectName" label="项目名称" align="center"></el-table-column>
<el-table-column prop="auth" label="项目权限" align="center">
<template slot-scope="scope">
{{ permissionsKeys[scope.row.permissions] }}
</template>
</el-table-column>
<!-- <el-table-column prop="createUser" label="创建人" align="center"></el-table-column> -->
<el-table-column prop="founder" label="创建人" align="center">
<template slot-scope="scope">
{{ scope.row.createUser }}
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center"></el-table-column>
<!-- <el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button type="text" @click="showProject(scope.row)">查看</el-button>
</template>
</el-table-column> -->
</el-table>
<!-- <div class="pagination">
<el-pagination
background
:page-size="pageSize"
@current-change="handleCurrentChange"
layout="total,prev, pager, next"
:total="total"
></el-pagination>
</div> -->
</el-card>
</div>
</template>
<script>
import util from "@/libs/util";
export default {
props: ['form'],
data() {
return {
curriculumList: [],
keyword: '',
projects: [],
permissionsKeys: ['练习', '考核', '竞赛'],
};
},
watch: {
// ,
form: {
handler(){
this.updateTime++
},
deep:true
},
},
mounted() {
this.getCourse()
},
methods: {
//
getCourse() {
const sid = this.$store.state.dataPer.find(e => e.permissionName === '课程管理')
this.$post(this.api.curriculumList, {
isShelves: 1,
pageNum: 1,
pageSize: 10000,
supplierId: sid ? sid.supplierId : ''
}).then(({ page }) => {
this.curriculumList = page.records
}).catch(err => {});
},
//
courseChange() {
const { sysId, sysName } = this.curriculumList.find(e => e.cid == this.form.cid)
this.form.sysName = sysName
this.$get(this.api.getInternalProjectBySystemId, {
permissions: 2,
systemId: sysId
}).then(res => {
this.projects = res
}).catch(err => {});
},
//
save() {
const { form } = this
if (!form.time.length) return util.warningMsg('请选择比赛时间')
if (!form.cid) return util.warningMsg('请选择课程')
if (!form.projectId) return util.warningMsg('请选择项目')
const { systemId, projectName } = this.projects.find(e => e.projectId == form.projectId)
form.systemId = systemId
form.projectName = projectName
form.startTime = form.time[0]
form.endTime = form.time[1]
this.$emit('hideSet', this.form)
},
//
back() {
this.$emit('hideSet')
}
}
};
</script>
<style scoped lang="scss">
</style>

@ -559,14 +559,6 @@ export default {
const id = this.form.competitionAnnexList.find(e => e.fileName === name).id const id = this.form.competitionAnnexList.find(e => e.fileName === name).id
id && this.$post(`${this.api.deleteAnnex}?id=${id}`).then(res => {}).catch(res => {}) id && this.$post(`${this.api.deleteAnnex}?id=${id}`).then(res => {}).catch(res => {})
}, },
//
done(next, id) {
!next ?
this.$router.push(`/match?page=${this.$store.state.matchPage}`) :
next === 2 ?
this.$emit('next', id) :
''
},
/** /**
* @description 提交 * @description 提交
* status 0草稿1发布 * status 0草稿1发布
@ -598,12 +590,12 @@ export default {
if (this.form.id) { if (this.form.id) {
this.$post(this.api.editCompetition, form).then(res => { this.$post(this.api.editCompetition, form).then(res => {
util.successMsg("修改成功"); util.successMsg("修改成功");
this.done(next) this.$emit('next', next)
}).catch(err => {}); }).catch(err => {});
} else { } else {
this.$post(this.api.addCompetition, form).then(({ setupId }) => { this.$post(this.api.addCompetition, form).then(({ setupId }) => {
util.successMsg("创建成功"); util.successMsg("创建成功");
this.done(next, setupId) this.$emit('next', next, setupId)
}).catch(err => {}); }).catch(err => {});
} }
}, },

@ -280,7 +280,7 @@ export default {
this.form.competitionStageList = list this.form.competitionStageList = list
}, },
// //
save(status, frame) { save(status, next = 0) {
const { form } = this const { form } = this
if (form.rule === 1) { if (form.rule === 1) {
form.competitionStageList.map(e => { form.competitionStageList.map(e => {
@ -294,10 +294,9 @@ export default {
}).catch(err => {}) }).catch(err => {})
} else { } else {
form.setupId = this.setupId form.setupId = this.setupId
debugger
this.$post(this.api.addCompetitionRule, form).then(res => { this.$post(this.api.addCompetitionRule, form).then(res => {
util.successMsg("创建成功"); util.successMsg("创建成功");
this.$emit('next', next)
}).catch(err => {}) }).catch(err => {})
} }
}, },

@ -1,132 +1,73 @@
<template> <template>
<div> <div>
<div class="page"> <div v-show="!setVisible" class="page">
<div class="page-content"> <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 label-width="170px" label-suffix=":" size="small">
<el-form-item label="竞赛类型"> <div v-for="(item, i) in form" :key="i" class="step">
团队赛2-4/ <span class="tips">如需修改请返回上一步</span> <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>
<el-form-item prop="rule" label="赛制"> <template v-if="item.method === 2">
<el-radio v-for="(rule, i) in rules" :key="i" v-model="form.rule" :label="rule.id">{{ rule.name }}</el-radio> <el-form-item label="比赛地点">
<p class="tips">积分赛包含多个竞赛阶段每个阶段的成绩都包含在最终总成绩里最后一轮结束后总成绩排名靠前的参赛者得到获奖资格</p> <el-input v-model="item.offlineAddress" style="width: 80%"></el-input>
<p class="tips">淘汰赛包含多个竞赛阶段每个阶段结束后之后只有部分参赛者能晋级下一阶段晋级最后一轮且在最后一轮排名靠前的参赛者得到获奖资格</p> </el-form-item>
<p class="tips">单项赛仅包含一个竞赛阶段单项的成绩排名即为最终排名排名靠前的参赛者得到获奖资格</p> <el-form-item label="比赛内容">
<p class="tips">系统默认排名规则优先按分数排名分数高则排名靠前分数相同则按用时排名用时短则排名靠前</p> <el-input v-model="item.contentDescription" type="textarea" style="width: 80%"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="stageNum" label="阶段数量"> <el-form-item label="评分规则">
<div class="input-center"> <el-input v-model="item.scoreRule" type="textarea" style="width: 80%"></el-input>
<el-select v-model="form.stageNum" clearable> </el-form-item>
<el-option v-for="i in 3" :key="i" :label="i" :value="i"></el-option> </template>
</el-select> <template v-else>
</div> <el-form-item prop="cid" label="课程系统">
<div class="tips"> {{ item.sysName }}
(团队赛是否限制队内每个成员只能参加一个阶段赛项 </el-form-item>
<el-radio v-model="form.competitionScope" :label="0"></el-radio> <el-form-item prop="assessmentId" label="已选择考核">
<el-radio v-model="form.competitionScope" :label="1"></el-radio> {{ item.projectName }}
) </el-form-item>
</div> <el-form-item prop="resultAnnouncementTime" label="比赛地点">
</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>
<div class="line"> <div class="line">
<span class="req">*</span> <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>
<el-radio v-for="(item, i) in methods" :key="i" v-model="form.method" :label="item.id">{{ item.name }}</el-radio>
</div> </div>
<div class="line"> <div class="line">
<span class="req">*</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>
<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>
</div> </div>
<div class="line"> </el-form-item>
<span class="req">*</span> </template>
团队成绩计算方式 </div>
<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> </el-form>
</div> </div>
</div> </div>
<set v-if="setVisible" :form.sync="form[curStep]" @hideSet="hideSet" />
</div> </div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import quill from "@/components/quill"; import set from './set'
export default { export default {
props: ['setupId'],
data() { data() {
return { return {
form: {}, step1: this.$parent.$refs.step1.form,
rules: [ step2: this.$parent.$refs.step2.form,
{ nums: ['一', '二', '三'],
id: 0,
name: '积分赛'
},
{
id: 1,
name: '淘汰赛'
},
{
id: 2,
name: '单项赛'
}
],
methods: [ methods: [
{ {
id: 0, id: 0,
@ -141,393 +82,114 @@ export default {
name: '线下' name: '线下'
} }
], ],
teamCalculationMethods: [ originForm: {
{ cid: '',
id: 0, contentDescription: '',
name: '最高分' endTime: '',
}, scoreRule: '',
{ stageId: '',
id: 1, startTime: '',
name: '平均分' systemId: '',
}, offlineAddress: '',
{ offlineButton: 0,
id: 2, onlineAddress: '',
name: '总分' onlineButton: 0,
} time: []
], },
operators: ['>', '>=', '=', '<', '<='] form: [],
setVisible: false,
curStep: 0
}; };
}, },
components: { components: {
quill set
}, },
watch: { watch: {
// , // ,
form: { form: {
handler(){ handler(){
this.updateTime++ 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 = ''
}
}, },
playTime: function(val) { deep:true
const { form } = this },
if (val) {
form.playStartTime = val[0]
form.playEndTime = val[1]
} else {
form.playStartTime = ''
form.playEndTime = ''
}
}
}, },
mounted() { mounted() {
// this.getData() this.handleForm()
// this.getSchool()
}, },
methods: { methods: {
getData() { // form
const { id } = this.form handleForm() {
id && this.$post(`${this.api.getContest}?contestId=${id}`).then(({ contest }) => { // id
this.signupTime = [contest.signUpStartTime, contest.signUpEndTime] this.$post(`${this.api.queryCompetitionStageBySetupId}?setupId=${this.setupId}`).then(res => {
this.playTime = [contest.playStartTime, contest.playEndTime] res.competitionStages.map(e => {
this.sponsorList = contest.sponsor.split(",") const form = JSON.parse(JSON.stringify(this.originForm))
this.undertakerList = contest.undertaker.split(",") form.stageId = e.stageId
// form.method = e.method
const fileList = contest.contestAnnexList form.stageName = e.stageName
if (fileList) { this.form.push(form)
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 => {}) }).catch(res => {})
}, },
// //
beforeFilter() { toSet(i) {
return false this.curStep = i
}, this.setVisible = true
//
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
})
})
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 个文件,如需更换,请删除一个文件再重新选择!`); hideSet(form) {
}, if (form) this.form[this.curStep] = form
uploadSuccess(res) { this.setVisible = false
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 => {})
},
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 => {})
}, },
// //
save(status, frame) { save(status, next = 0) {
if (this.submiting) return false; const { form } = this
const { form } = this let invalid = 0
form.sponsor = this.sponsorList.filter(d => d).join(); for (const e of form) {
form.undertaker = this.undertakerList.filter(d => d).join(); if (!e.time.length) {
if (form.competitionScope == 2 && !form.contestRangeList.length) return util.warningMsg('请选择区域、院校') invalid = 1
if (!form.name) return util.warningMsg("请填写竞赛名称"); util.errorMsg('请选择比赛时间')
if (status == 1) { break
if (!form.sponsor) return util.warningMsg("请填写主办方");
if (!form.signUpStartTime) return util.warningMsg("请选择报名时间");
} }
let now = new Date().getTime(); e.startTime = e.time[0]
let signUpStartTime = new Date(form.signUpStartTime).getTime(); e.endTime = e.time[1]
let signUpEndTime = new Date(form.signUpEndTime).getTime(); if (e.method !== 2 && !e.cid) {
let playStartTime = new Date(form.playStartTime).getTime(); invalid = 1
// if (signUpStartTime && now > signUpStartTime) return util.warningMsg(""); util.errorMsg('请选择课程')
if (!form.playStartTime && status == 1) return util.warningMsg("请选择竞赛时间"); break
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}`) // frame1
})
.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}`) // frame1
})
.catch(err => {
this.submiting = false;
});
} }
}, }
// if (invalid) return
preview() { if (form[0].contentId) {
util.local.set('match', this.form) this.$post(this.api.editCompetitionContent, form).then(res => {
window.open(this.$router.resolve('/matchPreview').href) util.successMsg("修改成功");
}, this.$emit('next', next)
back() { }).catch(err => {})
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()
})
} else { } 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> </script>
<style scoped lang="scss"> <style scoped lang="scss">
/deep/ .d-inline-block { .step {
width: 216px; padding-bottom: 10px;
.el-select, .el-input { background-color: #f9f9f9;
width: 100%; .title {
} display: flex;
} justify-content: space-between;
.inline-input { align-items: center;
.input-wrap { padding: 10px 15px;
display: flex; margin-bottom: 10px;
align-items: center; background-color: #ededed;
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-set {
padding: 15px;
background-color: #fbfbfb;
}
.tips {
font-size: 13px;
color: #959595;
}
.req {
color: #f00;
}
.line { .line {
margin-bottom: 10px; margin-bottom: 10px;
} }

Loading…
Cancel
Save