赛事修复

dev_202303
yujialong 2 years ago
parent f42ce357be
commit 479bd27cd5
  1. 6
      src/const/match.js
  2. 2
      src/setting.js
  3. 129
      src/views/match/add/index.vue
  4. 12
      src/views/match/add/set.vue
  5. 56
      src/views/match/add/step1.vue
  6. 76
      src/views/match/add/step2.vue
  7. 55
      src/views/match/add/step3.vue
  8. 1
      src/views/system/staff.vue

@ -34,15 +34,15 @@
teamCalculationMethods: [ teamCalculationMethods: [
{ {
id: 0, id: 0,
name: '最高分' name: '最高分'
}, },
{ {
id: 1, id: 1,
name: '平均分' name: '平均分'
}, },
{ {
id: 2, id: 2,
name: '总分' name: '求和'
} }
], ],
} }

@ -11,7 +11,7 @@ if (isDev) {
jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统 jumpPath = 'http://192.168.31.125:8087/' // 本地调试-需要启动本地判分点系统
host = 'http://121.37.12.51/' host = 'http://121.37.12.51/'
// host = 'https://huorantech.cn/' // host = 'https://huorantech.cn/'
host = 'http://192.168.31.51:9000/'// 榕 // host = 'http://192.168.31.51:9000/'// 榕
host = 'http://192.168.31.116:9000/'// 赓 host = 'http://192.168.31.116:9000/'// 赓
} else if (isPro) { } else if (isPro) {
jumpPath = 'https://www.huorantech.cn/judgmentPoint/' jumpPath = 'https://www.huorantech.cn/judgmentPoint/'

@ -8,7 +8,7 @@
<el-card v-if="step !== 4" shadow="hover" class="m-b-20" style="position: relative;margin-top: 20px"> <el-card v-if="step !== 4" shadow="hover" class="m-b-20" style="position: relative;margin-top: 20px">
<template v-if="step === 1"> <template v-if="step === 1">
<div class="p-title">大赛发布类型</div> <div class="p-title">大赛发布类型</div>
<el-form label-width="100px" label-suffix=":" size="small" :disabled="!editing && id"> <el-form label-width="100px" label-suffix=":" size="small" :disabled="!editing && id != ''">
<el-form-item label="请选择类型"> <el-form-item label="请选择类型">
<el-radio v-model="releaseType" :label="0">仅发布信息</el-radio> <el-radio v-model="releaseType" :label="0">仅发布信息</el-radio>
<el-radio v-model="releaseType" :label="1">设置完整比赛</el-radio> <el-radio v-model="releaseType" :label="1">设置完整比赛</el-radio>
@ -16,14 +16,26 @@
</el-form> </el-form>
<el-button v-if="!editing && id" class="edit" type="primary" @click="editing = 1">编辑</el-button> <el-button v-if="!editing && id" class="edit" type="primary" @click="editing = 1">编辑</el-button>
</template> </template>
<el-steps v-if="editing || !id" :space="200" :active="step - 1" finish-status="success"> <ul v-if="editing || !id" class="steps">
<el-step title="大赛信息填写"></el-step> <li :class="{active: step === 1,done: step > 1}">
<span class="circle">1</span>
<p class="text">大赛信息填写</p>
</li>
<template v-if="releaseType"> <template v-if="releaseType">
<el-step title="赛程与规则设置"></el-step> <li :class="{active: step === 2,done: step > 2}">
<el-step title="比赛内容设置"></el-step> <span class="circle circle2">2</span>
<p class="text">赛程与规则设置</p>
</li>
<li :class="{active: step === 3,done: step > 3}">
<span class="circle circle3">3</span>
<p class="text">比赛内容设置</p>
</li>
</template> </template>
<el-step title="发布"></el-step> <li :class="{done: step > 3}">
</el-steps> <span class="circle circle4">{{ releaseType ? 4 : 2 }}</span>
<p class="text">发布</p>
</li>
</ul>
</el-card> </el-card>
<div class="page"> <div class="page">
<div class="page-content"> <div class="page-content">
@ -35,7 +47,7 @@
<div v-if="step !== 4 && showBtns" class="btns"> <div v-if="step !== 4 && showBtns" class="btns">
<!-- 处于编辑状态(列表点编辑按钮进来默认是查看状态不可编辑点了编辑按钮才可编辑)或者新增才显示这几个按钮 --> <!-- 处于编辑状态(列表点编辑按钮进来默认是查看状态不可编辑点了编辑按钮才可编辑)或者新增才显示这几个按钮 -->
<template v-if="editing || !id"> <template v-if="editing || !id">
<el-button v-if="!id" @click="save(0)">保存{{ releaseType ? '草稿' : '' }}</el-button> <el-button v-if="!publishStatus" @click="save(0)">保存{{ releaseType ? '草稿' : '' }}</el-button>
<el-button v-if="step === 2 || step === 3" type="primary" @click="prev" v-auth="'/match:管理:大赛详情:发布'">上一步</el-button> <el-button v-if="step === 2 || step === 3" type="primary" @click="prev" v-auth="'/match:管理:大赛详情:发布'">上一步</el-button>
<el-button v-if="!releaseType || (releaseType && step === 3)" type="primary" @click="save(1)" v-auth="'/match:管理:大赛详情:发布'">发布</el-button> <el-button v-if="!releaseType || (releaseType && step === 3)" type="primary" @click="save(1)" v-auth="'/match:管理:大赛详情:发布'">发布</el-button>
<el-button v-else type="primary" @click="save(id ? 1 : 0, 2)" v-auth="'/match:管理:大赛详情:保存并下一步'">保存并下一步</el-button> <el-button v-else type="primary" @click="save(id ? 1 : 0, 2)" v-auth="'/match:管理:大赛详情:保存并下一步'">保存并下一步</el-button>
@ -55,11 +67,13 @@ import step1 from './step1'
import step2 from './step2' import step2 from './step2'
import step3 from './step3' import step3 from './step3'
import step4 from './step4' import step4 from './step4'
import { Loading } from 'element-ui'
export default { export default {
name: "add", name: "add",
data() { data() {
return { return {
id: this.$route.query.id, id: this.$route.query.id || '',
publishStatus: 0,
competitionId: '', competitionId: '',
step: 1, step: 1,
submiting: false, submiting: false,
@ -67,7 +81,8 @@ export default {
setupId: '', setupId: '',
releaseType: 0, releaseType: 0,
editing: 0, editing: 0,
showBtns: true showBtns: true,
loadIns: null
}; };
}, },
components: { components: {
@ -81,6 +96,14 @@ export default {
}, },
methods: { methods: {
// loading
showLoad() {
this.loadIns = Loading.service()
},
// loading
hideLoad() {
this.loadIns.close()
},
// //
save(status, next = 0) { save(status, next = 0) {
this.$refs['step' + this.step].save(status, next, this.releaseType) this.$refs['step' + this.step].save(status, next, this.releaseType)
@ -105,20 +128,20 @@ export default {
window.open(this.$router.resolve('/matchPreview').href) window.open(this.$router.resolve('/matchPreview').href)
}, },
back() { back() {
const updateTime = this.updateTime // const updateTime = this.updateTime
const { id } = this.form // const { id } = this.form
// // //
if ((id && updateTime > 1) || (!id && updateTime)) { // if ((id && updateTime > 1) || (!id && updateTime)) {
this.$confirm(`编辑的内容未保存,是否保存?`, '提示', { // this.$confirm(``, '', {
type: 'warning' // type: 'warning'
}).then(() => { // }).then(() => {
this.save(0) // this.save(0)
}).catch(() => { // }).catch(() => {
this.backPage() // this.backPage()
}) // })
} else { // } else {
this.backPage() this.backPage()
} // }
}, },
backPage(){ backPage(){
this.$router.back() this.$router.back()
@ -136,6 +159,66 @@ export default {
.el-steps { .el-steps {
justify-content: center; justify-content: center;
} }
.steps {
display: flex;
justify-content: center;
li {
position: relative;
margin-right: 100px;
text-align: center;
}
.circle {
display: inline-flex;
justify-content: center;
align-items: center;
width: 35px;
margin: 0 auto 10px;
line-height: 35px;
font-size: 18px;
color: #333;
background: #f9f9f9;
border: 5px solid #e1e1e1;
border-radius: 50%;
&:after {
content: '';
position: absolute;
left: 64px;
width: 146px;
height: 3px;
background: #e1e1e1;
}
}
.active {
.circle {
color: #fff;
border-color: #e0a1ff;
background: #d379ff;
}
.text {
color: #d379ff;
}
}
.done {
.circle {
color: #fff;
background: #9c86ff;
border-color: #bbacff;
&:after {
background: #bbacff;
}
}
.text {
color: #9178ff;
}
}
.circle2:after {
left: 71px;
width: 147px;
}
.circle4:after {
display: none;
}
}
.btns { .btns {
text-align: center; text-align: center;
} }

@ -19,6 +19,7 @@
<p class="m-b-20">比赛时间</p> <p class="m-b-20">比赛时间</p>
<div class="date-inputs"> <div class="date-inputs">
起止时间 起止时间
<div style="display: inline-flex;align-items: center;">
<el-date-picker <el-date-picker
v-model="form.time" v-model="form.time"
type="datetimerange" type="datetimerange"
@ -29,6 +30,14 @@
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@change="timeChange"> @change="timeChange">
</el-date-picker> </el-date-picker>
<el-alert
style="width: auto;padding: 4px 16px;margin-left: 10px;"
:title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'"
type="error"
:closable="false"
effect="dark">
</el-alert>
</div>
</div> </div>
</div> </div>
</el-card> </el-card>
@ -178,7 +187,6 @@ export default {
}, },
// //
timeChange(val) { timeChange(val) {
console.log("🚀 ~ file: set.vue:180 ~ timeChange ~ val", val)
if (val.length) { if (val.length) {
const startTime = new Date(val[0]) const startTime = new Date(val[0])
const endTime = new Date(val[1]) const endTime = new Date(val[1])
@ -206,7 +214,7 @@ export default {
save() { save() {
const { form } = this const { form } = this
if (!form.time.length) return util.warningMsg('请选择比赛时间') if (!form.time.length) return util.warningMsg('请选择比赛时间')
// if (this.timeInvalid) return util.warningMsg('') if (this.timeInvalid) return util.warningMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
if (!form.cid) return util.warningMsg('请选择课程') if (!form.cid) return util.warningMsg('请选择课程')
if (!form.projectId) return util.warningMsg('请选择项目') if (!form.projectId) return util.warningMsg('请选择项目')
const { systemId, projectName } = this.projects.find(e => e.projectId == form.projectId) const { systemId, projectName } = this.projects.find(e => e.projectId == form.projectId)

@ -3,7 +3,7 @@
<div class="page"> <div 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" :disabled="!editing && form.id"> <el-form label-width="170px" label-suffix=":" size="small" :disabled="!editing && form.id !== ''">
<el-form-item label="竞赛封面(选填)"> <el-form-item label="竞赛封面(选填)">
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
@ -51,17 +51,17 @@
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="竞赛名称"> <el-form-item class="req" label="竞赛名称">
<div class="d-inline-block"> <div class="d-inline-block">
<el-input placeholder="请输入竞赛名称" v-model="form.name" clearable></el-input> <el-input placeholder="请输入竞赛名称" v-model="form.name" clearable></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="主办方"> <el-form-item class="req" label="主办方">
<div class="inline-input"> <div class="inline-input">
<div class="input-wrap" v-for="(item,index) in sponsorList" :key="index"> <div class="input-wrap" v-for="(item,index) in sponsorList" :key="index">
<el-input placeholder="主办方名称" v-model="sponsorList[index]"></el-input> <el-input placeholder="主办方名称" v-model="sponsorList[index]"></el-input>
<i v-if="sponsorList.length > 1" class="remove" @click="delSponsor(index)"></i> <i v-if="sponsorList.length > 1" class="remove" @click="delSponsor(index)"></i>
<button v-if="index == 0" class="add-btn" :disabled="!editing && form.id" @click="addSponsor"> <button v-if="index == 0" class="add-btn" :disabled="!editing && form.id !== ''" @click="addSponsor">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<span>添加</span> <span>添加</span>
</button> </button>
@ -73,7 +73,7 @@
<div class="input-wrap" v-for="(item,index) in undertakerList" :key="index"> <div class="input-wrap" v-for="(item,index) in undertakerList" :key="index">
<el-input placeholder="承办方名称" v-model="undertakerList[index]"></el-input> <el-input placeholder="承办方名称" v-model="undertakerList[index]"></el-input>
<i v-if="undertakerList.length > 1" class="remove" @click="delOrganizer(index)"></i> <i v-if="undertakerList.length > 1" class="remove" @click="delOrganizer(index)"></i>
<button v-if="index == 0" class="add-btn" :disabled="!editing && form.id" @click="addOrganizer"> <button v-if="index == 0" class="add-btn" :disabled="!editing && form.id !== ''" @click="addOrganizer">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
<span>添加</span> <span>添加</span>
</button> </button>
@ -84,17 +84,17 @@
<span>添加</span> <span>添加</span>
</button> </button>
</el-form-item> </el-form-item>
<el-form-item label="报名时间"> <el-form-item class="req" label="报名时间">
<el-date-picker v-model="signupTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" <el-date-picker v-model="signupTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
:picker-options="pickerOptions"></el-date-picker> :picker-options="pickerOptions"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="竞赛时间"> <el-form-item class="req" label="竞赛时间">
<el-date-picker v-model="playTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" <el-date-picker v-model="playTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
:picker-options="pickerOptions"></el-date-picker> :picker-options="pickerOptions"></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="比赛范围"> <el-form-item class="req" label="比赛范围">
<div v-if="form.id"> <div v-if="form.id">
<el-radio v-model="form.competitionScope" :label="0" disabled>本校内</el-radio> <el-radio v-model="form.competitionScope" :label="0" disabled>本校内</el-radio>
</div> </div>
@ -107,29 +107,29 @@
<span style="margin-left: 20px">{{ rangeName }}</span> <span style="margin-left: 20px">{{ rangeName }}</span>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="竞赛类型"> <el-form-item class="req" label="竞赛类型">
<el-radio v-model="form.completeCompetitionSetup.competitionType" :label="0">个人赛</el-radio> <el-radio v-model="form.completeCompetitionSetup.competitionType" :label="0">个人赛</el-radio>
<el-radio v-model="form.completeCompetitionSetup.competitionType" :label="1">团队赛</el-radio> <el-radio v-model="form.completeCompetitionSetup.competitionType" :label="1">团队赛</el-radio>
</el-form-item> </el-form-item>
<el-form-item v-if="!form.completeCompetitionSetup.competitionType" label="报名人数上限"> <el-form-item class="req" v-if="!form.completeCompetitionSetup.competitionType" label="报名人数上限">
<div class="input-center"> <div class="input-center">
<el-input placeholder="请输入人数" v-model="form.completeCompetitionSetup.quantityLimit" type="number"></el-input> <el-input placeholder="请输入人数" v-model="form.completeCompetitionSetup.quantityLimit" type="number"></el-input>
</div> </div>
</el-form-item> </el-form-item>
<template v-if="form.completeCompetitionSetup.competitionType"> <template v-if="form.completeCompetitionSetup.competitionType">
<el-form-item label="报名团队数上限"> <el-form-item class="req" label="报名团队数上限">
<div class="input-center"> <div class="input-center">
<el-input placeholder="请输入团队数" v-model="form.completeCompetitionSetup.quantityLimit" type="number"></el-input> <el-input placeholder="请输入团队数" v-model="form.completeCompetitionSetup.quantityLimit" type="number"></el-input>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="团队人数"> <el-form-item class="req" label="团队人数">
<div class="input-center" style="width: 250px;"> <div class="input-center" style="width: 250px;">
<el-input v-model="form.completeCompetitionSetup.minTeamSize" type="number"></el-input> <el-input v-model="form.completeCompetitionSetup.minTeamSize" type="number"></el-input>
<el-input style="margin-left: 5px;" v-model="form.completeCompetitionSetup.maxTeamSize" type="number"></el-input> / <el-input style="margin-left: 5px;" v-model="form.completeCompetitionSetup.maxTeamSize" type="number"></el-input> /
</div> </div>
</el-form-item> </el-form-item>
</template> </template>
<el-form-item label="报名邀请码"> <el-form-item class="req" label="报名邀请码">
<div class="input-center" style="width: 550px;"> <div class="input-center" style="width: 550px;">
<el-radio v-model="form.completeCompetitionSetup.isNeedCode" :label="0">不需要</el-radio> <el-radio v-model="form.completeCompetitionSetup.isNeedCode" :label="0">不需要</el-radio>
<el-radio v-model="form.completeCompetitionSetup.isNeedCode" :label="1">需要</el-radio> <el-radio v-model="form.completeCompetitionSetup.isNeedCode" :label="1">需要</el-radio>
@ -137,7 +137,7 @@
<el-button v-if="form.completeCompetitionSetup.isNeedCode === 1" @click="randomInv">随机</el-button> <el-button v-if="form.completeCompetitionSetup.isNeedCode === 1" @click="randomInv">随机</el-button>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="竞赛详情"> <el-form-item class="req" label="竞赛详情">
<quill :border="true" v-model="form.description" :height="400" /> <quill :border="true" v-model="form.description" :height="400" />
</el-form-item> </el-form-item>
<el-form-item label="附件"> <el-form-item label="附件">
@ -201,6 +201,7 @@
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import quill from "@/components/quill"; import quill from "@/components/quill";
import { Loading } from 'element-ui'
export default { export default {
props: ['editing'], props: ['editing'],
data() { data() {
@ -210,7 +211,7 @@ export default {
token: sessionStorage.getItem('token') token: sessionStorage.getItem('token')
}, },
form: { form: {
id: this.$route.query.id, id: this.$route.query.id || '',
platformSource: 0, // (0:1) platformSource: 0, // (0:1)
ztOpen: 0, // (0 1 0) ztOpen: 0, // (0 1 0)
name: '', name: '',
@ -366,6 +367,7 @@ export default {
getData() { getData() {
const { id } = this.form const { id } = this.form
id && this.$post(`${this.api.getCompetition}?competitionId=${id}`).then(({ competition }) => { id && this.$post(`${this.api.getCompetition}?competitionId=${id}`).then(({ competition }) => {
this.$parent.publishStatus = competition.publishStatus
this.$parent.releaseType = competition.releaseType this.$parent.releaseType = competition.releaseType
this.$parent.setupId = competition.completeCompetitionSetup.setupId this.$parent.setupId = competition.completeCompetitionSetup.setupId
if (competition.signUpStartTime) this.signupTime = [competition.signUpStartTime, competition.signUpEndTime] if (competition.signUpStartTime) this.signupTime = [competition.signUpStartTime, competition.signUpEndTime]
@ -598,25 +600,32 @@ export default {
if (competitionType) { if (competitionType) {
if (minTeamSize === '') return util.warningMsg('请填写团队人数下限') if (minTeamSize === '') return util.warningMsg('请填写团队人数下限')
if (maxTeamSize === '') return util.warningMsg('请填写团队人数上限') if (maxTeamSize === '') return util.warningMsg('请填写团队人数上限')
if (minTeamSize >= maxTeamSize) return util.warningMsg('团队人数上限不得小于下限') if (minTeamSize > maxTeamSize) return util.warningMsg('团队人数上限不得小于下限')
} }
if (isNeedCode && (!invitationCode || invitationCode.length !== 4)) return util.warningMsg('请填写四位数邀请码') if (isNeedCode && (!invitationCode || invitationCode.length !== 4)) return util.warningMsg('请填写四位数邀请码')
if (!form.description) return util.warningMsg("请填写竞赛详情"); if (!form.description) return util.warningMsg("请填写竞赛详情");
} }
this.$parent.showLoad()
form.publishStatus = status form.publishStatus = status
form.ztOpen = status ? 0 : 1 // form.ztOpen = status ? 0 : 1 //
form.releaseType = releaseType form.releaseType = releaseType
if (form.id) { if (form.id) {
this.$post(this.api.editCompetition, form).then(res => { this.$post(this.api.editCompetition, form).then(res => {
this.$parent.hideLoad()
util.successMsg("修改成功"); util.successMsg("修改成功");
this.$emit('next', next) this.$emit('next', next)
}).catch(err => {}); }).catch(err => {
this.$parent.hideLoad()
});
} else { } else {
this.$post(this.api.addCompetition, form).then(({ competitionId, setupId }) => { this.$post(this.api.addCompetition, form).then(({ competitionId, setupId }) => {
this.$parent.hideLoad()
util.successMsg("创建成功"); util.successMsg("创建成功");
this.$emit('next', next, setupId, competitionId) this.$emit('next', next, setupId, competitionId)
}).catch(err => {}); }).catch(err => {
this.$parent.hideLoad()
});
} }
}, },
// //
@ -811,4 +820,15 @@ $upload-lg-height: 150px;
.el-steps { .el-steps {
justify-content: center; justify-content: center;
} }
/deep/.req {
.el-form-item__label {
&:before {
content: '*';
margin-right: 5px;
font-size: 18px;
vertical-align: middle;
color: #f00;
}
}
}
</style> </style>

@ -18,7 +18,7 @@
<el-form-item prop="stageNum" label="阶段数量"> <el-form-item prop="stageNum" label="阶段数量">
<div class="input-center"> <div class="input-center">
<el-select v-model="form.stageNum" @change="stageChange"> <el-select v-model="form.stageNum" @change="stageChange">
<el-option v-for="i in 3" :key="i" :label="i" :value="i"></el-option> <el-option v-for="i in 10" :key="i" :label="i" :value="i"></el-option>
</el-select> </el-select>
</div> </div>
<div v-if="step1.completeCompetitionSetup.competitionType" class="tips"> <div v-if="step1.completeCompetitionSetup.competitionType" class="tips">
@ -37,7 +37,7 @@
<el-form-item prop="stageNum" label="阶段设置"> <el-form-item prop="stageNum" label="阶段设置">
<div v-for="(item, i) in form.competitionStageList" :key="i" class="step-set"> <div v-for="(item, i) in form.competitionStageList" :key="i" class="step-set">
<div class="line"> <div class="line">
阶段 <el-input v-model="item.stageName" clearable placeholder="请输入阶段名称,如“初赛”" style="width: 200px"></el-input> {{ serials[i] }}阶段 <el-input v-model="item.stageName" clearable placeholder="请输入阶段名称,如“初赛”" style="width: 200px"></el-input>
</div> </div>
<div class="line"> <div class="line">
<span class="req">*</span> <span class="req">*</span>
@ -86,13 +86,13 @@
<div v-if="!form.rule" class="line"> <div v-if="!form.rule" class="line">
<span class="req">*</span> <span class="req">*</span>
占总成绩权重 占总成绩权重
<el-input v-model.number="item.pointWeight" type="number" style="width: 150px;"></el-input> % <el-input v-model.number="item.pointWeight" type="number" :disabled="form.resultCalculationMethod != 0" style="width: 150px;"></el-input> %
</div> </div>
<div class="line"> <div class="line">
<span class="req">*</span> <span class="req">*</span>
成绩公布时间 成绩公布时间
阶段比赛结束后 阶段比赛结束后
<el-input v-model.number="item.resultAnnouncementTime" style="width: 120px"></el-input> <el-input v-model.number="item.resultAnnouncementTime" type="number" style="width: 120px"></el-input>
小时公布阶段比赛成绩 小时公布阶段比赛成绩
</div> </div>
<div class="line"> <div class="line">
@ -124,7 +124,7 @@
</el-form-item> </el-form-item>
<el-form-item prop="resultAnnouncementTime" label="成绩公布时间"> <el-form-item prop="resultAnnouncementTime" label="成绩公布时间">
阶段比赛结束后 阶段比赛结束后
<el-input v-model.number="form.competitionStageList[0].resultAnnouncementTime" style="width: 120px"></el-input> <el-input v-model.number="form.competitionStageList[0].resultAnnouncementTime" type="number" style="width: 120px"></el-input>
小时公布阶段比赛成绩 小时公布阶段比赛成绩
</el-form-item> </el-form-item>
<el-form-item prop="resultsDetails" label="是否公布成绩详情"> <el-form-item prop="resultsDetails" label="是否公布成绩详情">
@ -143,12 +143,14 @@
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import quill from "@/components/quill"; import quill from "@/components/quill";
import Const from '@/const/match'
export default { export default {
props: ['setupId'], props: ['setupId'],
data() { data() {
return { return {
id: this.$route.query.id, id: this.$route.query.id,
step1: this.$parent.$refs.step1.form, step1: this.$parent.$refs.step1.form,
serials: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十'],
form: { form: {
resultCalculationMethod: 0, resultCalculationMethod: 0,
rule: 0, rule: 0,
@ -223,48 +225,9 @@ export default {
], ],
}, },
ruleForm: {}, ruleForm: {},
rules: [ rules: Const.rules,
{ methods: Const.methods,
id: 0, teamCalculationMethods: Const.teamCalculationMethods,
name: '积分赛'
},
{
id: 1,
name: '淘汰赛'
},
{
id: 2,
name: '单项赛'
}
],
methods: [
{
id: 0,
name: '实操'
},
{
id: 1,
name: '理论'
},
{
id: 2,
name: '线下'
}
],
teamCalculationMethods: [
{
id: 0,
name: '最高分'
},
{
id: 1,
name: '平均分'
},
{
id: 2,
name: '总分'
}
],
operators: ['>', '>=', '=', '<', '<='] operators: ['>', '>=', '=', '<', '<=']
}; };
}, },
@ -278,6 +241,8 @@ export default {
}, },
}, },
mounted() { mounted() {
const { minTeamSize, maxTeamSize, competitionType } = this.step1.completeCompetitionSetup
competitionType && minTeamSize !== '' && maxTeamSize !== '' && minTeamSize == maxTeamSize && this.teamCalculationMethods.pop() //
this.ruleForm = JSON.parse(JSON.stringify(this.form.competitionStageList[0])) this.ruleForm = JSON.parse(JSON.stringify(this.form.competitionStageList[0]))
this.id && this.getData() this.id && this.getData()
}, },
@ -295,7 +260,7 @@ export default {
const num = limit.replace(/\D+/, '') const num = limit.replace(/\D+/, '')
if (num) e.score = num if (num) e.score = num
} }
if (e.teamNumLimit) e.teamNumLimitOpt = e.teamNumLimit ? 1 : 0 e.teamNumLimitOpt = e.teamNumLimit ? 1 : 0
e.teamCalculationMethod = +e.teamCalculationMethod e.teamCalculationMethod = +e.teamCalculationMethod
}) })
this.form = rule this.form = rule
@ -330,7 +295,7 @@ export default {
// //
if (!rule) { if (!rule) {
// //
if (e.pointWeight === '') { if (form.resultCalculationMethod == 0 && e.pointWeight === '') {
invalid = 1 invalid = 1
util.errorMsg('请输入权重') util.errorMsg('请输入权重')
break break
@ -357,18 +322,25 @@ export default {
} }
} }
if (invalid) return if (invalid) return
if (!rule && pointWeight > 0 && pointWeight !== 100) return util.errorMsg('权重须等于100,请重新输入') if (form.resultCalculationMethod == 0 && !rule && pointWeight > 0 && pointWeight !== 100) return util.errorMsg('权重须等于100,请重新输入')
this.$parent.showLoad()
if (form.ruleId) { if (form.ruleId) {
this.$post(this.api.editCompetitionRule, form).then(res => { this.$post(this.api.editCompetitionRule, form).then(res => {
this.$parent.hideLoad()
util.successMsg("修改成功"); util.successMsg("修改成功");
this.$emit('next', next) this.$emit('next', next)
}).catch(err => {}) }).catch(err => {
this.$parent.hideLoad()
})
} else { } else {
form.setupId = this.setupId form.setupId = this.setupId
this.$post(this.api.addCompetitionRule, form).then(res => { this.$post(this.api.addCompetitionRule, form).then(res => {
this.$parent.hideLoad()
util.successMsg("创建成功"); util.successMsg("创建成功");
this.$emit('next', next) this.$emit('next', next)
}).catch(err => {}) }).catch(err => {
this.$parent.hideLoad()
})
} }
}, },
} }

@ -9,19 +9,27 @@
<span>{{ item.stageName }}{{ nums[i] }}阶段 | {{ methods.find(e => e.id === item.method).name }} </span> <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> <el-button v-if="item.method !== 2" type="primary" @click="toSet(i)">设置</el-button>
</div> </div>
<el-form-item prop="startTime" label="比赛时间"> <el-form-item class="req" prop="time" label="比赛时间">
<span v-if="item.method !== 2 && item.startTime">{{ item.startTime + ' ' + item.endTime }}</span> <span v-if="item.method !== 2 && item.startTime">{{ item.startTime + ' ' + item.endTime }}</span>
<el-date-picker <div style="display: flex;align-items: center;" v-if="item.method === 2">
v-if="item.method === 2" <el-date-picker
v-model="item.time" v-model="item.time"
type="datetimerange" type="datetimerange"
range-separator="~" range-separator="~"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss"
@change="timeChange"> @change="timeChange">
</el-date-picker> </el-date-picker>
<el-alert
style="width: auto;padding: 0px 16px;margin-left: 10px;"
:title="'(请设置在 ' + step1.playStartTime + ' ~ ' + step1.playEndTime + '间)'"
type="error"
:closable="false"
effect="dark">
</el-alert>
</div>
</el-form-item> </el-form-item>
<template v-if="item.method === 2"> <template v-if="item.method === 2">
<el-form-item label="比赛地点"> <el-form-item label="比赛地点">
@ -35,10 +43,10 @@
</el-form-item> </el-form-item>
</template> </template>
<template v-else> <template v-else>
<el-form-item prop="cid" label="课程系统"> <el-form-item class="req" prop="cid" label="课程系统">
{{ item.sysName }} {{ item.sysName }}
</el-form-item> </el-form-item>
<el-form-item prop="assessmentId" label="已选择考核"> <el-form-item class="req" prop="assessmentId" label="已选择考核">
{{ item.projectName }} {{ item.projectName }}
</el-form-item> </el-form-item>
<el-form-item prop="resultAnnouncementTime" label="比赛地点"> <el-form-item prop="resultAnnouncementTime" label="比赛地点">
@ -179,7 +187,7 @@ export default {
}, },
// //
publish() { publish() {
this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => {}).catch(err => {}) this.competitionId && this.$post(`${this.api.publishCompetition}?competitionId=${this.competitionId}&publishStatus=1`).then(res => {}).catch(err => {})
}, },
// //
save(status, next = 0) { save(status, next = 0) {
@ -203,14 +211,18 @@ export default {
} }
if (this.timeInvalid) return util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。') if (this.timeInvalid) return util.errorMsg('设置的阶段比赛时间必须要在第一步设置的竞赛时间范围内,请重新设置。')
if (invalid) return if (invalid) return
this.$parent.showLoad()
this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], { this.$post(this.api[form[0].contentId ? 'editCompetitionContent' : 'addCompetitionContent'], {
competitionContents: form competitionContents: form
}).then(res => { }).then(res => {
// //
!form[0].contentId && status && this.publish(status) !form[0].contentId && status && this.publish(status)
this.$parent.hideLoad()
util.successMsg((status ? '发布' : '保存') + '成功') util.successMsg((status ? '发布' : '保存') + '成功')
this.$emit('next', next) this.$emit('next', next)
}).catch(err => {}) }).catch(err => {
this.$parent.hideLoad()
})
}, },
} }
}; };
@ -232,4 +244,15 @@ export default {
.line { .line {
margin-bottom: 10px; margin-bottom: 10px;
} }
/deep/.req {
.el-form-item__label {
&:before {
content: '*';
margin-right: 5px;
font-size: 18px;
vertical-align: middle;
color: #f00;
}
}
}
</style> </style>

@ -235,7 +235,6 @@ export default {
} }
} }
const phonePass = (rule, value, callback) => { const phonePass = (rule, value, callback) => {
console.log("🚀 ~ file: staff.vue:238 ~ phonePass ~ value", value)
if (value) { if (value) {
const pattern = /^1[3456789]\d{9}$/ const pattern = /^1[3456789]\d{9}$/
if(pattern.test(value)){ if(pattern.test(value)){

Loading…
Cancel
Save