|
|
|
@ -3,10 +3,12 @@ |
|
|
|
|
<div class="page"> |
|
|
|
|
<div class="page-content"> |
|
|
|
|
<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-upload |
|
|
|
|
class="avatar-uploader" |
|
|
|
|
<el-upload class="avatar-uploader" |
|
|
|
|
accept=".jpg,.png,.jpeg,.gif" |
|
|
|
|
:on-remove="handleRemove" |
|
|
|
|
:on-error="uploadError" |
|
|
|
@ -16,52 +18,71 @@ |
|
|
|
|
:on-exceed="handleExceed" |
|
|
|
|
:action="this.api.fileupload" |
|
|
|
|
:headers="headers" |
|
|
|
|
name="file" |
|
|
|
|
> |
|
|
|
|
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar"> |
|
|
|
|
<div class="uploader-default" v-else> |
|
|
|
|
name="file"> |
|
|
|
|
<img v-if="form.coverUrl" |
|
|
|
|
:src="form.coverUrl" |
|
|
|
|
class="avatar"> |
|
|
|
|
<div class="uploader-default" |
|
|
|
|
v-else> |
|
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
|
<p>上传封面</p> |
|
|
|
|
</div> |
|
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
|
<div slot="tip" |
|
|
|
|
class="el-upload__tip"> |
|
|
|
|
<p>展示宽度为220,高度140,JPG/PNG/GIF,3MB以内</p> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="竞赛封面长图(选填)"> |
|
|
|
|
<el-upload |
|
|
|
|
class="avatar-uploader avatar-uploader-lg" |
|
|
|
|
<el-upload class="avatar-uploader avatar-uploader-lg" |
|
|
|
|
accept=".jpg,.png,.jpeg,.gif" |
|
|
|
|
:on-remove="handleLgRemove" |
|
|
|
|
:on-error="uploadError" |
|
|
|
|
:on-success="uploadLgSuccess" |
|
|
|
|
:before-remove="beforeRemove" |
|
|
|
|
:limit="1" :on-exceed="handleExceed" |
|
|
|
|
:limit="1" |
|
|
|
|
:on-exceed="handleExceed" |
|
|
|
|
:action="this.api.fileupload" |
|
|
|
|
:headers="headers" |
|
|
|
|
name="file" |
|
|
|
|
> |
|
|
|
|
<img v-if="form.carouselUrl" :src="form.carouselUrl" class="avatar-lg"> |
|
|
|
|
<div class="uploader-default" v-else> |
|
|
|
|
name="file"> |
|
|
|
|
<img v-if="form.carouselUrl" |
|
|
|
|
:src="form.carouselUrl" |
|
|
|
|
class="avatar-lg"> |
|
|
|
|
<div class="uploader-default" |
|
|
|
|
v-else> |
|
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
|
<p>上传封面</p> |
|
|
|
|
</div> |
|
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
|
<div slot="tip" |
|
|
|
|
class="el-upload__tip"> |
|
|
|
|
<p>展示宽度为1920,高度300,JPG/PNG/GIF,3MB以内</p> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="req" label="竞赛名称"> |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="竞赛名称"> |
|
|
|
|
<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> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="req" label="主办方"> |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="主办方"> |
|
|
|
|
<div class="inline-input"> |
|
|
|
|
<div class="input-wrap" v-for="(item,index) in sponsorList" :key="index"> |
|
|
|
|
<el-input placeholder="主办方名称" v-model="sponsorList[index]"></el-input> |
|
|
|
|
<i v-if="sponsorList.length > 1" class="remove" @click="delSponsor(index)"></i> |
|
|
|
|
<button v-if="index == 0" class="add-btn" type="button" :disabled="!editing && form.id !== ''" @click="addSponsor"> |
|
|
|
|
<div class="input-wrap" |
|
|
|
|
v-for="(item,index) in sponsorList" |
|
|
|
|
:key="index"> |
|
|
|
|
<el-input placeholder="主办方名称" |
|
|
|
|
v-model="sponsorList[index]"></el-input> |
|
|
|
|
<i v-if="sponsorList.length > 1" |
|
|
|
|
class="remove" |
|
|
|
|
@click="delSponsor(index)"></i> |
|
|
|
|
<button v-if="index == 0" |
|
|
|
|
class="add-btn" |
|
|
|
|
type="button" |
|
|
|
|
:disabled="!editing && form.id !== ''" |
|
|
|
|
@click="addSponsor"> |
|
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
|
<span>添加</span> |
|
|
|
|
</button> |
|
|
|
@ -70,79 +91,136 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="承办方(选填)"> |
|
|
|
|
<div class="inline-input"> |
|
|
|
|
<div class="input-wrap" v-for="(item,index) in undertakerList" :key="index"> |
|
|
|
|
<el-input placeholder="承办方名称" v-model="undertakerList[index]"></el-input> |
|
|
|
|
<i v-if="undertakerList.length > 1" class="remove" @click="delOrganizer(index)"></i> |
|
|
|
|
<button v-if="index == 0" class="add-btn" type="button" :disabled="!editing && form.id !== ''" @click="addOrganizer"> |
|
|
|
|
<div class="input-wrap" |
|
|
|
|
v-for="(item,index) in undertakerList" |
|
|
|
|
:key="index"> |
|
|
|
|
<el-input placeholder="承办方名称" |
|
|
|
|
v-model="undertakerList[index]"></el-input> |
|
|
|
|
<i v-if="undertakerList.length > 1" |
|
|
|
|
class="remove" |
|
|
|
|
@click="delOrganizer(index)"></i> |
|
|
|
|
<button v-if="index == 0" |
|
|
|
|
class="add-btn" |
|
|
|
|
type="button" |
|
|
|
|
:disabled="!editing && form.id !== ''" |
|
|
|
|
@click="addOrganizer"> |
|
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
|
<span>添加</span> |
|
|
|
|
</button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<button v-if="!undertakerList.length" class="add-btn" type="button" @click="addOrganizer"> |
|
|
|
|
<button v-if="!undertakerList.length" |
|
|
|
|
class="add-btn" |
|
|
|
|
type="button" |
|
|
|
|
@click="addOrganizer"> |
|
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
|
<span>添加</span> |
|
|
|
|
</button> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="req" label="报名时间"> |
|
|
|
|
<el-date-picker v-model="signupTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" |
|
|
|
|
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="报名时间"> |
|
|
|
|
<el-date-picker v-model="signupTime" |
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
|
type="datetimerange" |
|
|
|
|
range-separator="-" |
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
end-placeholder="结束日期" |
|
|
|
|
:picker-options="pickerOptions"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="req" label="竞赛时间"> |
|
|
|
|
<el-date-picker v-model="playTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" |
|
|
|
|
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="竞赛时间"> |
|
|
|
|
<el-date-picker v-model="playTime" |
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" |
|
|
|
|
type="datetimerange" |
|
|
|
|
range-separator="-" |
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
end-placeholder="结束日期" |
|
|
|
|
:picker-options="pickerOptions"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="req" label="比赛范围"> |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="比赛范围"> |
|
|
|
|
<div> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="0">本校内</el-radio> |
|
|
|
|
<el-radio v-model="form.competitionScope" |
|
|
|
|
:label="0">本校内</el-radio> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="1">全平台</el-radio> |
|
|
|
|
<el-radio v-model="form.competitionScope" |
|
|
|
|
:label="1">全平台</el-radio> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<el-radio v-model="form.competitionScope" :label="2">指定区域、院校</el-radio> |
|
|
|
|
<el-button v-if="form.competitionScope === 2" type="primary" size="mini" @click="showRange">选择院校</el-button> |
|
|
|
|
<el-radio v-model="form.competitionScope" |
|
|
|
|
:label="2">指定区域、院校</el-radio> |
|
|
|
|
<el-button v-if="form.competitionScope === 2" |
|
|
|
|
type="primary" |
|
|
|
|
size="mini" |
|
|
|
|
@click="showRange">选择院校</el-button> |
|
|
|
|
<span style="margin-left: 20px">{{ rangeName }}</span> |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<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="1">团队赛</el-radio> |
|
|
|
|
<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="1">团队赛</el-radio> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="req" v-if="!form.completeCompetitionSetup.competitionType" label="报名人数上限"> |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
v-if="!form.completeCompetitionSetup.competitionType" |
|
|
|
|
label="报名人数上限"> |
|
|
|
|
<div class="input-center"> |
|
|
|
|
<el-input placeholder="请输入人数" v-model.number="form.completeCompetitionSetup.quantityLimit" type="number"></el-input> 人 |
|
|
|
|
<el-input placeholder="请输入人数" |
|
|
|
|
v-model.number="form.completeCompetitionSetup.quantityLimit" |
|
|
|
|
type="number"></el-input> 人 |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<template v-if="form.completeCompetitionSetup.competitionType"> |
|
|
|
|
<el-form-item class="req" label="报名团队数上限"> |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="报名团队数上限"> |
|
|
|
|
<div class="input-center"> |
|
|
|
|
<el-input placeholder="请输入团队数" v-model.number="form.completeCompetitionSetup.quantityLimit" type="number"></el-input> 队 |
|
|
|
|
<el-input placeholder="请输入团队数" |
|
|
|
|
v-model.number="form.completeCompetitionSetup.quantityLimit" |
|
|
|
|
type="number"></el-input> 队 |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="req" label="团队人数"> |
|
|
|
|
<div class="input-center" style="width: 250px;"> |
|
|
|
|
<el-input v-model.number="form.completeCompetitionSetup.minTeamSize" type="number"></el-input> 至 |
|
|
|
|
<el-input style="margin-left: 5px;" v-model.number="form.completeCompetitionSetup.maxTeamSize" type="number"></el-input> 人/队 |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="团队人数"> |
|
|
|
|
<div class="input-center" |
|
|
|
|
style="width: 250px;"> |
|
|
|
|
<el-input v-model.number="form.completeCompetitionSetup.minTeamSize" |
|
|
|
|
type="number"></el-input> 至 |
|
|
|
|
<el-input style="margin-left: 5px;" |
|
|
|
|
v-model.number="form.completeCompetitionSetup.maxTeamSize" |
|
|
|
|
type="number"></el-input> 人/队 |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<el-form-item class="req" label="报名邀请码"> |
|
|
|
|
<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="1">需要</el-radio> |
|
|
|
|
<el-input style="width: 250px" placeholder="请输入4位邀请码或点击随机生成" v-model="form.completeCompetitionSetup.invitationCode" :disabled="form.completeCompetitionSetup.isNeedCode === 0"></el-input> |
|
|
|
|
<el-button v-if="form.completeCompetitionSetup.isNeedCode === 1" @click="randomInv">随机</el-button> |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="报名邀请码"> |
|
|
|
|
<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="1">需要</el-radio> |
|
|
|
|
<el-input style="width: 250px" |
|
|
|
|
placeholder="请输入4位邀请码或点击随机生成" |
|
|
|
|
v-model="form.completeCompetitionSetup.invitationCode" |
|
|
|
|
:disabled="form.completeCompetitionSetup.isNeedCode === 0"></el-input> |
|
|
|
|
<el-button v-if="form.completeCompetitionSetup.isNeedCode === 1" |
|
|
|
|
@click="randomInv">随机</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item class="req" label="竞赛详情"> |
|
|
|
|
<quill v-if="quillShow" ref="quill" :border="true" v-model="form.description" :height="400" :readonly="!editing && form.id !== ''" /> |
|
|
|
|
<el-form-item class="req" |
|
|
|
|
label="竞赛详情"> |
|
|
|
|
<quill v-if="quillShow" |
|
|
|
|
ref="quill" |
|
|
|
|
:border="true" |
|
|
|
|
v-model="form.description" |
|
|
|
|
:height="400" |
|
|
|
|
:readonly="!editing && form.id !== ''" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="附件"> |
|
|
|
|
<el-upload |
|
|
|
|
:on-remove="handleAnnexRemove" |
|
|
|
|
<el-upload :on-remove="handleAnnexRemove" |
|
|
|
|
:on-error="uploadError" |
|
|
|
|
:before-upload="beforeUpload" |
|
|
|
|
:on-success="uploadAnnexSuccess" |
|
|
|
@ -151,10 +229,11 @@ |
|
|
|
|
:action="this.api.fileupload" |
|
|
|
|
:headers="headers" |
|
|
|
|
:file-list="fileList" |
|
|
|
|
name="file" |
|
|
|
|
> |
|
|
|
|
<el-button size="small" type="primary">点击上传</el-button> |
|
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
|
name="file"> |
|
|
|
|
<el-button size="small" |
|
|
|
|
type="primary">点击上传</el-button> |
|
|
|
|
<div slot="tip" |
|
|
|
|
class="el-upload__tip"> |
|
|
|
|
<p>支持扩展名:.rar .zip .doc .docx .pdf .jpg...</p> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
@ -163,10 +242,13 @@ |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<el-dialog title="请勾选院校" :visible.sync="rangeVisible" width="580px" custom-class="range-dia" :close-on-click-modal="false"> |
|
|
|
|
<el-dialog title="请勾选院校" |
|
|
|
|
:visible.sync="rangeVisible" |
|
|
|
|
width="580px" |
|
|
|
|
custom-class="range-dia" |
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
<div class="range-wrap"> |
|
|
|
|
<el-cascader |
|
|
|
|
ref="range" |
|
|
|
|
<el-cascader ref="range" |
|
|
|
|
class="range-cas" |
|
|
|
|
key="range" |
|
|
|
|
v-model="range" |
|
|
|
@ -179,8 +261,7 @@ |
|
|
|
|
@change="rangeChange" |
|
|
|
|
@visible-change="rangeViChange" |
|
|
|
|
@input.native="rangeSearch"></el-cascader> |
|
|
|
|
<el-tag |
|
|
|
|
v-for="(tag, i) in rangeChecked" |
|
|
|
|
<el-tag v-for="(tag, i) in rangeChecked" |
|
|
|
|
:key="tag.value" |
|
|
|
|
class="range-check" |
|
|
|
|
closable |
|
|
|
@ -190,9 +271,13 @@ |
|
|
|
|
</el-tag> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button size="small" @click="rangeVisible = false">取 消</el-button> |
|
|
|
|
<el-button size="small" type="primary" @click="rangeSubmit">确 定</el-button> |
|
|
|
|
<span slot="footer" |
|
|
|
|
class="dialog-footer"> |
|
|
|
|
<el-button size="small" |
|
|
|
|
@click="rangeVisible = false">取 消</el-button> |
|
|
|
|
<el-button size="small" |
|
|
|
|
type="primary" |
|
|
|
|
@click="rangeSubmit">确 定</el-button> |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
</div> |
|
|
|
@ -204,7 +289,7 @@ import quill from "@/components/quill"; |
|
|
|
|
import Setting from "@/setting"; |
|
|
|
|
export default { |
|
|
|
|
props: ['editing'], |
|
|
|
|
data() { |
|
|
|
|
data () { |
|
|
|
|
const that = this |
|
|
|
|
return { |
|
|
|
|
headers: { |
|
|
|
@ -285,7 +370,7 @@ export default { |
|
|
|
|
data.push(e) |
|
|
|
|
}) |
|
|
|
|
resolve(data) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
} else if (level === 1) { |
|
|
|
|
// 城市 |
|
|
|
|
that.$get(that.api.queryCity, { |
|
|
|
@ -300,7 +385,7 @@ export default { |
|
|
|
|
data.push(e) |
|
|
|
|
}) |
|
|
|
|
resolve(data) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
} else if (level === 2) { |
|
|
|
|
// 学校 |
|
|
|
|
that.$get(that.api.getSchoolsByProvince, { |
|
|
|
@ -317,7 +402,7 @@ export default { |
|
|
|
|
data.push(e) |
|
|
|
|
}) |
|
|
|
|
resolve(data) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
} else { |
|
|
|
|
resolve([]) |
|
|
|
|
} |
|
|
|
@ -332,7 +417,7 @@ export default { |
|
|
|
|
quill |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
editing: function(val) { |
|
|
|
|
editing: function (val) { |
|
|
|
|
this.quillShow = false |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.quillShow = true |
|
|
|
@ -340,12 +425,12 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
|
|
|
|
form: { |
|
|
|
|
handler(){ |
|
|
|
|
handler () { |
|
|
|
|
this.updateTime++ |
|
|
|
|
}, |
|
|
|
|
deep:true |
|
|
|
|
deep: true |
|
|
|
|
}, |
|
|
|
|
signupTime: function(val) { |
|
|
|
|
signupTime: function (val) { |
|
|
|
|
const { form } = this |
|
|
|
|
if (val) { |
|
|
|
|
form.signUpStartTime = val[0]; |
|
|
|
@ -355,7 +440,7 @@ export default { |
|
|
|
|
form.signUpEndTime = '' |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
playTime: function(val) { |
|
|
|
|
playTime: function (val) { |
|
|
|
|
const { form } = this |
|
|
|
|
if (val) { |
|
|
|
|
form.playStartTime = val[0] |
|
|
|
@ -366,12 +451,12 @@ export default { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
mounted () { |
|
|
|
|
this.getData() |
|
|
|
|
this.getSchool() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
getData() { |
|
|
|
|
getData () { |
|
|
|
|
const { id } = this.form |
|
|
|
|
id && this.$post(`${this.api.getCompetition}?competitionId=${id}`).then(({ competition }) => { |
|
|
|
|
this.$parent.publishStatus = competition.publishStatus |
|
|
|
@ -423,14 +508,14 @@ export default { |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
this.updateTime = 0 |
|
|
|
|
}) |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 选择范围 |
|
|
|
|
showRange() { |
|
|
|
|
showRange () { |
|
|
|
|
this.rangeVisible = true |
|
|
|
|
}, |
|
|
|
|
// 范围勾选回调 |
|
|
|
|
rangeChange(val, e) { |
|
|
|
|
rangeChange (val, e) { |
|
|
|
|
const checked = this.$refs.range.getCheckedNodes() |
|
|
|
|
const name = [] |
|
|
|
|
const { rangeChecked } = this |
|
|
|
@ -440,14 +525,14 @@ export default { |
|
|
|
|
this.rangeChecked.push(...name) |
|
|
|
|
}, |
|
|
|
|
// 范围展开收缩回调 |
|
|
|
|
rangeViChange(e) { |
|
|
|
|
rangeViChange (e) { |
|
|
|
|
// 展开的时候清空搜索结果 |
|
|
|
|
if (e) { |
|
|
|
|
this.rangeList = [] |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取学校列表 |
|
|
|
|
getSchool() { |
|
|
|
|
getSchool () { |
|
|
|
|
this.$get(this.api.querySchoolData).then(({ list }) => { |
|
|
|
|
const result = [] |
|
|
|
|
list.map(e => { |
|
|
|
@ -457,14 +542,14 @@ export default { |
|
|
|
|
result.push(e) |
|
|
|
|
}) |
|
|
|
|
this.schools = result |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 范围模糊查询前置钩子 |
|
|
|
|
beforeFilter() { |
|
|
|
|
beforeFilter () { |
|
|
|
|
return false |
|
|
|
|
}, |
|
|
|
|
// 范围筛选 |
|
|
|
|
rangeSearch(el) { |
|
|
|
|
rangeSearch (el) { |
|
|
|
|
const val = el.target.value.trim() |
|
|
|
|
const checked = this.rangeChecked |
|
|
|
|
if (!val) { |
|
|
|
@ -482,11 +567,11 @@ export default { |
|
|
|
|
this.rangeList = result |
|
|
|
|
}, 100) |
|
|
|
|
}, |
|
|
|
|
closeRange(i) { |
|
|
|
|
closeRange (i) { |
|
|
|
|
this.rangeChecked.splice(i, 1) |
|
|
|
|
}, |
|
|
|
|
// 范围确定 |
|
|
|
|
rangeSubmit() { |
|
|
|
|
rangeSubmit () { |
|
|
|
|
// 处理提交需要的id |
|
|
|
|
const data = [] |
|
|
|
|
const checked = this.rangeChecked |
|
|
|
@ -509,24 +594,24 @@ export default { |
|
|
|
|
|
|
|
|
|
this.rangeVisible = false |
|
|
|
|
}, |
|
|
|
|
handleExceed(files, fileList) { |
|
|
|
|
handleExceed (files, fileList) { |
|
|
|
|
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
|
|
|
|
}, |
|
|
|
|
handleExceedAnnex(files, fileList) { |
|
|
|
|
handleExceedAnnex (files, fileList) { |
|
|
|
|
util.warningMsg(`当前限制选择 5 个文件,如需更换,请删除一个文件再重新选择!`); |
|
|
|
|
}, |
|
|
|
|
uploadSuccess(res) { |
|
|
|
|
uploadSuccess (res) { |
|
|
|
|
const { coverUrl } = this.form |
|
|
|
|
coverUrl && this.$del(`${this.api.fileDeletion}?keys=${coverUrl}`).then(res => {}).catch(res => {}) |
|
|
|
|
coverUrl && this.$del(`${this.api.fileDeletion}?keys=${coverUrl}`).then(res => { }).catch(res => { }) |
|
|
|
|
this.form.coverUrl = res.data.filesResult.fileUrl |
|
|
|
|
}, |
|
|
|
|
uploadLgSuccess(res) { |
|
|
|
|
uploadLgSuccess (res) { |
|
|
|
|
const { carouselUrl } = this.form |
|
|
|
|
carouselUrl && this.$del(`${this.api.fileDeletion}?keys=${carouselUrl}`).then(res => {}).catch(res => {}) |
|
|
|
|
carouselUrl && this.$del(`${this.api.fileDeletion}?keys=${carouselUrl}`).then(res => { }).catch(res => { }) |
|
|
|
|
this.form.carouselUrl = res.data.filesResult.fileUrl |
|
|
|
|
}, |
|
|
|
|
// 附件上传成功 |
|
|
|
|
uploadAnnexSuccess(res) { |
|
|
|
|
uploadAnnexSuccess (res) { |
|
|
|
|
const file = res.data.filesResult |
|
|
|
|
const { id } = this.form |
|
|
|
|
const data = { |
|
|
|
@ -536,10 +621,10 @@ export default { |
|
|
|
|
} |
|
|
|
|
this.form.competitionAnnexList.push(data) |
|
|
|
|
// 编辑的时候需要调新增附件接口 |
|
|
|
|
id && this.$post(this.api.saveComAnnex, data).then(res => {}).catch(res => {}) |
|
|
|
|
id && this.$post(this.api.saveComAnnex, data).then(res => { }).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 附件上传前 |
|
|
|
|
beforeUpload(file) { |
|
|
|
|
beforeUpload (file) { |
|
|
|
|
const isLt2M = file.size / 1024 / 1024 < 10 |
|
|
|
|
if (!isLt2M) util.warningMsg('请上传小于10MB的附件!') |
|
|
|
|
if (isLt2M) { |
|
|
|
@ -549,34 +634,34 @@ export default { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
uploadError(err, file, fileList) { |
|
|
|
|
uploadError (err, file, fileList) { |
|
|
|
|
this.$message({ |
|
|
|
|
message: "上传出错,请重试!", |
|
|
|
|
type: "error", |
|
|
|
|
center: true |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
beforeRemove(file, fileList) { |
|
|
|
|
beforeRemove (file, fileList) { |
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
|
}, |
|
|
|
|
handleRemove(file, fileList) { |
|
|
|
|
handleRemove (file, fileList) { |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${this.form.coverUrl}`).then(res => { |
|
|
|
|
this.form.coverUrl = '' |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
handleLgRemove(file, fileList) { |
|
|
|
|
handleLgRemove (file, fileList) { |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${this.form.carouselUrl}`).then(res => { |
|
|
|
|
this.form.carouselUrl = '' |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
handleAnnexRemove(file, fileList) { |
|
|
|
|
handleAnnexRemove (file, fileList) { |
|
|
|
|
const { url, name } = file |
|
|
|
|
url && this.$del(`${this.api.fileDeletion}?keys=${url}`).then(res => {}).catch(res => {}) |
|
|
|
|
url && this.$del(`${this.api.fileDeletion}?keys=${url}`).then(res => { }).catch(res => { }) |
|
|
|
|
const id = this.form.competitionAnnexList.find(e => e.fileName === name).id |
|
|
|
|
id && this.$post(`${this.api.delComAnnex}?id=${id}`).then(res => {}).catch(res => {}) |
|
|
|
|
id && this.$post(`${this.api.delComAnnex}?id=${id}`).then(res => { }).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 随机邀请码 |
|
|
|
|
randomInv() { |
|
|
|
|
randomInv () { |
|
|
|
|
let result = '' |
|
|
|
|
for (let i = 0; i < 4; i++) { |
|
|
|
|
result += Math.floor(Math.random() * 10); |
|
|
|
@ -589,14 +674,14 @@ export default { |
|
|
|
|
* next 0:返回,1:不做任何操作,2:下一步 |
|
|
|
|
* releaseType 发布类型(0发布信息,1完整比赛) |
|
|
|
|
* */ |
|
|
|
|
save(status, next = 0, releaseType = 0,cb) { |
|
|
|
|
save (status, next = 0, releaseType = 0, cb) { |
|
|
|
|
const { form } = this |
|
|
|
|
form.sponsor = this.sponsorList.filter(d => d).join(); |
|
|
|
|
form.undertaker = this.undertakerList.filter(d => d).join(); |
|
|
|
|
if (!form.name) return util.warningMsg("请填写竞赛名称"); |
|
|
|
|
// 下一步需要校验 |
|
|
|
|
if (next === 2) { |
|
|
|
|
if (form.competitionScope == 2 && !form.competitionRangeList.length) return util.warningMsg('请选择区域、院校') |
|
|
|
|
if (form.competitionScope == 2 && (!form.competitionRangeList || !form.competitionRangeList.length)) return util.warningMsg('请选择区域、院校') |
|
|
|
|
if (!form.sponsor) return util.warningMsg("请填写主办方"); |
|
|
|
|
if (!form.signUpStartTime) return util.warningMsg("请选择报名时间"); |
|
|
|
|
let now = new Date().getTime(); |
|
|
|
@ -621,6 +706,8 @@ export default { |
|
|
|
|
} |
|
|
|
|
if (isNeedCode && (!invitationCode || invitationCode.length !== 4)) return util.warningMsg('请填写四位数邀请码') |
|
|
|
|
if (!form.description) return util.warningMsg("请填写竞赛详情"); |
|
|
|
|
} else { |
|
|
|
|
if (form.competitionScope == 2 && (!form.competitionRangeList || !form.competitionRangeList.length)) form.competitionScope = 1 |
|
|
|
|
} |
|
|
|
|
this.$parent.showLoad() |
|
|
|
|
form.publishStatus = status |
|
|
|
@ -633,7 +720,7 @@ export default { |
|
|
|
|
this.updateTime = 0 |
|
|
|
|
this.$parent.hideLoad() |
|
|
|
|
util.successMsg("修改成功"); |
|
|
|
|
this.$emit('next', next,cb) |
|
|
|
|
this.$emit('next', next, cb) |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.$parent.hideLoad() |
|
|
|
|
}); |
|
|
|
@ -642,27 +729,27 @@ export default { |
|
|
|
|
this.updateTime = 0 |
|
|
|
|
this.$parent.hideLoad() |
|
|
|
|
util.successMsg("创建成功"); |
|
|
|
|
this.$emit('next', next, setupId, competitionId,cb) |
|
|
|
|
this.$emit('next', next, setupId, competitionId, cb) |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.$parent.hideLoad() |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 预览 |
|
|
|
|
preview() { |
|
|
|
|
preview () { |
|
|
|
|
util.local.set('match', this.form) |
|
|
|
|
window.open(this.$router.resolve('/matchPreview').href) |
|
|
|
|
}, |
|
|
|
|
addSponsor() { |
|
|
|
|
addSponsor () { |
|
|
|
|
this.sponsorList.push(""); |
|
|
|
|
}, |
|
|
|
|
delSponsor(index) { |
|
|
|
|
delSponsor (index) { |
|
|
|
|
this.sponsorList.splice(index, 1); |
|
|
|
|
}, |
|
|
|
|
addOrganizer() { |
|
|
|
|
addOrganizer () { |
|
|
|
|
this.undertakerList.push(""); |
|
|
|
|
}, |
|
|
|
|
delOrganizer(index) { |
|
|
|
|
delOrganizer (index) { |
|
|
|
|
this.undertakerList.splice(index, 1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -752,7 +839,8 @@ $upload-lg-height: 150px; |
|
|
|
|
/deep/ .d-inline-block { |
|
|
|
|
width: 216px; |
|
|
|
|
|
|
|
|
|
.el-select, .el-input { |
|
|
|
|
.el-select, |
|
|
|
|
.el-input { |
|
|
|
|
width: 100%; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -771,7 +859,7 @@ $upload-lg-height: 150px; |
|
|
|
|
.remove { |
|
|
|
|
width: 16px; |
|
|
|
|
height: 16px; |
|
|
|
|
background: url("../../../assets/img/close.png") 0 0/cover no-repeat; |
|
|
|
|
background: url('../../../assets/img/close.png') 0 0 / cover no-repeat; |
|
|
|
|
cursor: pointer; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|