|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<template> |
|
|
|
<!-- 大赛详情 --> |
|
|
|
<!-- 大赛详情 --> |
|
|
|
<div style="padding: 24px" @click="test"> |
|
|
|
<div style="padding: 24px"> |
|
|
|
<div class="page-content"> |
|
|
|
<div class="page-content"> |
|
|
|
<el-form label-width="170px" label-suffix=":" size="small"> |
|
|
|
<el-form label-width="170px" label-suffix=":" size="small"> |
|
|
|
<el-form-item label="竞赛封面(选填)"> |
|
|
|
<el-form-item label="竞赛封面(选填)"> |
|
|
@ -17,7 +17,7 @@ |
|
|
|
:headers="headers" |
|
|
|
:headers="headers" |
|
|
|
name="file" |
|
|
|
name="file" |
|
|
|
> |
|
|
|
> |
|
|
|
<img v-if="coverUrl" :src="coverUrl" class="avatar"> |
|
|
|
<img v-if="form.coverUrl" :src="form.coverUrl" class="avatar"> |
|
|
|
<div class="uploader-default" v-else> |
|
|
|
<div class="uploader-default" v-else> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<p>上传封面</p> |
|
|
|
<p>上传封面</p> |
|
|
@ -41,7 +41,7 @@ |
|
|
|
:headers="headers" |
|
|
|
:headers="headers" |
|
|
|
name="file" |
|
|
|
name="file" |
|
|
|
> |
|
|
|
> |
|
|
|
<img v-if="carouselUrl" :src="carouselUrl" class="avatar-lg"> |
|
|
|
<img v-if="form.carouselUrl" :src="form.carouselUrl" class="avatar-lg"> |
|
|
|
<div class="uploader-default" v-else> |
|
|
|
<div class="uploader-default" v-else> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<p>上传封面</p> |
|
|
|
<p>上传封面</p> |
|
|
@ -53,14 +53,14 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="竞赛名称"> |
|
|
|
<el-form-item label="竞赛名称"> |
|
|
|
<div class="d-inline-block"> |
|
|
|
<div class="d-inline-block"> |
|
|
|
<el-input placeholder="请输入竞赛名称" v-model="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 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 form.sponsorList" :key="index"> |
|
|
|
<el-input placeholder="主办方名称" v-model="sponsorList[index]"></el-input> |
|
|
|
<el-input placeholder="主办方名称" v-model="form.sponsorList[index]"></el-input> |
|
|
|
<i v-if="sponsorList.length > 1" class="remove" @click="delSponsor(index)"></i> |
|
|
|
<i v-if="form.sponsorList.length > 1" class="remove" @click="delSponsor(index)"></i> |
|
|
|
<button v-if="index == 0" class="add-btn" @click="addSponsor"> |
|
|
|
<button v-if="index == 0" class="add-btn" @click="addSponsor"> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<span>添加</span> |
|
|
|
<span>添加</span> |
|
|
@ -70,32 +70,32 @@ |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="承办方(选填)"> |
|
|
|
<el-form-item label="承办方(选填)"> |
|
|
|
<div class="inline-input"> |
|
|
|
<div class="inline-input"> |
|
|
|
<div class="input-wrap" v-for="(item,index) in undertakerList" :key="index"> |
|
|
|
<div class="input-wrap" v-for="(item,index) in form.undertakerList" :key="index"> |
|
|
|
<el-input placeholder="承办方名称" v-model="undertakerList[index]"></el-input> |
|
|
|
<el-input placeholder="承办方名称" v-model="form.undertakerList[index]"></el-input> |
|
|
|
<i v-if="undertakerList.length > 1" class="remove" @click="delOrganizer(index)"></i> |
|
|
|
<i v-if="form.undertakerList.length > 1" class="remove" @click="delOrganizer(index)"></i> |
|
|
|
<button v-if="index == 0" class="add-btn" @click="addOrganizer"> |
|
|
|
<button v-if="index == 0" class="add-btn" @click="addOrganizer"> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<span>添加</span> |
|
|
|
<span>添加</span> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<button v-if="!undertakerList.length" class="add-btn" @click="addOrganizer"> |
|
|
|
<button v-if="!form.undertakerList.length" class="add-btn" @click="addOrganizer"> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
<span>添加</span> |
|
|
|
<span>添加</span> |
|
|
|
</button> |
|
|
|
</button> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="报名时间"> |
|
|
|
<el-form-item label="报名时间"> |
|
|
|
<el-date-picker v-model="signupTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> |
|
|
|
<el-date-picker v-model="form.signupTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="竞赛时间"> |
|
|
|
<el-form-item label="竞赛时间"> |
|
|
|
<el-date-picker v-model="playTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> |
|
|
|
<el-date-picker v-model="form.playTime" value-format="yyyy-MM-dd HH:mm:ss" type="datetimerange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="竞赛详情"> |
|
|
|
<el-form-item label="竞赛详情"> |
|
|
|
<quill :border="true" v-model="description" :height="400" /> |
|
|
|
<quill :border="true" v-model="form.description" :height="400" /> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-form-item> |
|
|
|
<el-button v-throttle @click="save(1)">保存</el-button> |
|
|
|
<el-button v-throttle @click="save(1)">保存</el-button> |
|
|
|
<el-button type="primary" v-if="publishStatus == 1" v-throttle @click="save(0)">发布</el-button> |
|
|
|
<el-button type="primary" v-if="form.publishStatus == 1" v-throttle @click="save(0)">发布</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -117,33 +117,46 @@ export default { |
|
|
|
token: util.local.get(Setting.tokenKey) |
|
|
|
token: util.local.get(Setting.tokenKey) |
|
|
|
}, |
|
|
|
}, |
|
|
|
id: this.$route.query.id, |
|
|
|
id: this.$route.query.id, |
|
|
|
coverUrl: "", |
|
|
|
form: { |
|
|
|
carouselUrl: "", |
|
|
|
coverUrl: '', |
|
|
|
publishStatus: 0, |
|
|
|
carouselUrl: '', |
|
|
|
uploadList: [], |
|
|
|
publishStatus: 0, |
|
|
|
uploadDataList: [], |
|
|
|
uploadList: [], |
|
|
|
name: "", |
|
|
|
uploadDataList: [], |
|
|
|
sponsor: "", |
|
|
|
name: '', |
|
|
|
sponsorList: [""], |
|
|
|
sponsor: '', |
|
|
|
undertaker: "", |
|
|
|
sponsorList: [''], |
|
|
|
undertakerList: [], |
|
|
|
undertaker: '', |
|
|
|
signUpStartTime: "", |
|
|
|
undertakerList: [], |
|
|
|
signUpEndTime: "", |
|
|
|
signUpStartTime: '', |
|
|
|
signupTime: "", |
|
|
|
signUpEndTime: '', |
|
|
|
playTime: "", |
|
|
|
signupTime: '', |
|
|
|
playStartTime: "", |
|
|
|
playTime: '', |
|
|
|
playEndTime: "", |
|
|
|
playStartTime: '', |
|
|
|
description: "", |
|
|
|
playEndTime: '', |
|
|
|
touchTime:0, |
|
|
|
description: '' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
updateTime: 0 |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
created() { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
components: { |
|
|
|
components: { |
|
|
|
quill |
|
|
|
quill |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
computed: { |
|
|
|
|
|
|
|
wait() { |
|
|
|
|
|
|
|
return this.$store.state.match.wait |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
signupTime: function(val) { |
|
|
|
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
|
|
|
|
|
|
|
form: { |
|
|
|
|
|
|
|
handler(){ |
|
|
|
|
|
|
|
this.updateTime++ |
|
|
|
|
|
|
|
if(this.updateTime > 1) this.$store.commit('match/setWait', 0) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
deep:true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
'form.signupTime': function(val) { |
|
|
|
if (val) { |
|
|
|
if (val) { |
|
|
|
this.signUpStartTime = val[0]; |
|
|
|
this.signUpStartTime = val[0]; |
|
|
|
this.signUpEndTime = val[1]; |
|
|
|
this.signUpEndTime = val[1]; |
|
|
@ -152,7 +165,7 @@ export default { |
|
|
|
this.signUpEndTime = ""; |
|
|
|
this.signUpEndTime = ""; |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
playTime: function(val) { |
|
|
|
'form.playTime': function(val) { |
|
|
|
if (val) { |
|
|
|
if (val) { |
|
|
|
this.playStartTime = val[0]; |
|
|
|
this.playStartTime = val[0]; |
|
|
|
this.playEndTime = val[1]; |
|
|
|
this.playEndTime = val[1]; |
|
|
@ -168,10 +181,6 @@ export default { |
|
|
|
EventBus.$on("tabClickWait0", () => this.waitSave()); |
|
|
|
EventBus.$on("tabClickWait0", () => this.waitSave()); |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
test() { |
|
|
|
|
|
|
|
this.$store.commit("match/setWait", 0); |
|
|
|
|
|
|
|
// console.log(this.$store.state.match.waitIndex) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
...mapActions("match", [ |
|
|
|
...mapActions("match", [ |
|
|
|
"setMatchId" |
|
|
|
"setMatchId" |
|
|
|
]), |
|
|
|
]), |
|
|
@ -192,107 +201,87 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
save(status, judge=true) { |
|
|
|
save(status, back = 1) { |
|
|
|
this.touchTime = 0 |
|
|
|
const form = this.form |
|
|
|
this.sponsor = this.sponsorList.filter(d => d).join(); |
|
|
|
const sponsor = form.sponsorList.filter(d => d).join(); |
|
|
|
this.undertaker = this.undertakerList.filter(d => d).join(); |
|
|
|
if (!form.name) return util.warningMsg("请填写竞赛名称"); |
|
|
|
if (!this.name) return util.warningMsg("请填写竞赛名称"); |
|
|
|
|
|
|
|
if (status == 0) { |
|
|
|
if (status == 0) { |
|
|
|
if (!this.sponsor) return util.warningMsg("请填写主办方"); |
|
|
|
if (!sponsor) return util.warningMsg("请填写主办方"); |
|
|
|
if (!this.signUpStartTime) return util.warningMsg("请选择报名时间"); |
|
|
|
if (!form.signUpStartTime) return util.warningMsg("请选择报名时间"); |
|
|
|
} |
|
|
|
} |
|
|
|
let now = new Date().getTime(); |
|
|
|
let now = new Date().getTime(); |
|
|
|
let signUpStartTime = new Date(this.signUpStartTime).getTime(); |
|
|
|
let signUpStartTime = new Date(form.signUpStartTime).getTime(); |
|
|
|
let signUpEndTime = new Date(this.signUpEndTime).getTime(); |
|
|
|
let signUpEndTime = new Date(form.signUpEndTime).getTime(); |
|
|
|
let playStartTime = new Date(this.playStartTime).getTime(); |
|
|
|
let playStartTime = new Date(form.playStartTime).getTime(); |
|
|
|
// if(signUpStartTime && now > signUpStartTime) return this.$$message.warning('报名时间不能早于当前时间') |
|
|
|
// if(signUpStartTime && now > signUpStartTime) return this.$$message.warning('报名时间不能早于当前时间') |
|
|
|
if (!this.playStartTime && status == 0) return util.warningMsg("请选择竞赛时间"); |
|
|
|
if (!form.playStartTime && status == 0) return util.warningMsg("请选择竞赛时间"); |
|
|
|
if (playStartTime && playStartTime < signUpEndTime) return util.warningMsg("竞赛时间不能早于报名结束时间"); |
|
|
|
if (playStartTime && playStartTime < signUpEndTime) return util.warningMsg("竞赛时间不能早于报名结束时间"); |
|
|
|
if (!this.description && status == 0) return util.warningMsg("请填写竞赛详情"); |
|
|
|
if (!form.description && status == 0) return util.warningMsg("请填写竞赛详情"); |
|
|
|
let data = { |
|
|
|
let data = { |
|
|
|
id: this.id, |
|
|
|
id: this.id, |
|
|
|
coverUrl: this.coverUrl, |
|
|
|
coverUrl: form.coverUrl, |
|
|
|
carouselUrl: this.carouselUrl, |
|
|
|
carouselUrl: form.carouselUrl, |
|
|
|
description: this.description, |
|
|
|
description: form.description, |
|
|
|
founderId: 1, |
|
|
|
founderId: 1, |
|
|
|
name: this.name, |
|
|
|
name: form.name, |
|
|
|
playEndTime: this.playEndTime, |
|
|
|
playEndTime: form.playEndTime, |
|
|
|
playStartTime: this.playStartTime, |
|
|
|
playStartTime: form.playStartTime, |
|
|
|
publishStatus: status ? this.publishStatus : 0, |
|
|
|
publishStatus: status ? form.publishStatus : 0, |
|
|
|
signUpEndTime: this.signUpEndTime, |
|
|
|
signUpEndTime: form.signUpEndTime, |
|
|
|
signUpStartTime: this.signUpStartTime, |
|
|
|
signUpStartTime: form.signUpStartTime, |
|
|
|
sponsor: this.sponsor, |
|
|
|
sponsor, |
|
|
|
undertaker: this.undertaker |
|
|
|
undertaker: form.undertakerList.filter(d => d).join() |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
this.$store.commit("match/setWait", 999); |
|
|
|
if (this.id) { |
|
|
|
if (this.id) { |
|
|
|
this.$put(this.api.editContest, data).then(res => { |
|
|
|
this.$put(this.api.editContest, data).then(res => { |
|
|
|
util.successMsg("修改成功"); |
|
|
|
util.successMsg("修改成功") |
|
|
|
if(judge) { |
|
|
|
back && this.$router.back() |
|
|
|
this.$router.back(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
}).catch(err => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.$post(this.api.addContest, data).then(res => { |
|
|
|
this.$post(this.api.addContest, data).then(res => { |
|
|
|
util.successMsg("创建成功"); |
|
|
|
util.successMsg("创建成功") |
|
|
|
if(judge) { |
|
|
|
back && this.$router.back() |
|
|
|
this.$router.back(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
}).catch(err => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
getData() { |
|
|
|
getData() { |
|
|
|
this.$get(this.api.getContest + "/" + this.id).then(res => { |
|
|
|
this.$get(this.api.getContest + "/" + this.id).then(res => { |
|
|
|
let data = res.contest; |
|
|
|
const data = res.contest |
|
|
|
this.coverUrl = data.coverUrl; |
|
|
|
data.signupTime = [data.signUpStartTime, data.signUpEndTime] |
|
|
|
this.carouselUrl = data.carouselUrl; |
|
|
|
data.playTime = [data.playStartTime, data.playEndTime] |
|
|
|
this.description = data.description; |
|
|
|
data.sponsorList = data.sponsor.split(",") |
|
|
|
this.name = data.name; |
|
|
|
data.undertakerList = data.undertaker.split(",") |
|
|
|
this.playEndTime = data.playEndTime; |
|
|
|
this.form = data |
|
|
|
this.playStartTime = data.playStartTime; |
|
|
|
}).catch(err => {}) |
|
|
|
this.publishStatus = data.publishStatus; |
|
|
|
|
|
|
|
this.signUpEndTime = data.signUpEndTime; |
|
|
|
|
|
|
|
this.signUpStartTime = data.signUpStartTime; |
|
|
|
|
|
|
|
this.sponsor = data.sponsor; |
|
|
|
|
|
|
|
this.undertaker = data.undertaker; |
|
|
|
|
|
|
|
this.signupTime = [data.signUpStartTime, data.signUpEndTime]; |
|
|
|
|
|
|
|
this.playTime = [data.playStartTime, data.playEndTime]; |
|
|
|
|
|
|
|
this.sponsorList = data.sponsor.split(","); |
|
|
|
|
|
|
|
this.undertakerList = data.undertaker.split(","); |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
commitId() { |
|
|
|
commitId() { |
|
|
|
this.setMatchId(this.id); |
|
|
|
this.setMatchId(this.id); |
|
|
|
// this.$store.commit("setMatchId", { matchId: this.id }); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
handleExceed(files, fileList) { |
|
|
|
handleExceed(files, fileList) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
|
|
|
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
|
|
|
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSuccess(res, file, fileList) { |
|
|
|
uploadSuccess(res, file, fileList) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
|
|
|
if (this.coverUrl) { |
|
|
|
if (this.coverUrl) { |
|
|
|
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
let fileName = this.form.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
this.coverUrl = res.data.filesResult.fileUrl; |
|
|
|
this.form.coverUrl = res.data.filesResult.fileUrl; |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadLgSuccess(res, file, fileList) { |
|
|
|
uploadLgSuccess(res, file, fileList) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
if (this.form.carouselUrl) { |
|
|
|
if (this.carouselUrl) { |
|
|
|
let fileName = this.form.carouselUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
let fileName = this.carouselUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
this.carouselUrl = res.data.filesResult.fileUrl; |
|
|
|
this.form.carouselUrl = res.data.filesResult.fileUrl; |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadError(err, file, fileList) { |
|
|
|
uploadError(err, file, fileList) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
|
|
|
this.$message({ |
|
|
|
this.$message({ |
|
|
|
message: "上传出错,请重试!", |
|
|
|
message: "上传出错,请重试!", |
|
|
|
type: "error", |
|
|
|
type: "error", |
|
|
@ -300,27 +289,23 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
beforeRemove(file, fileList) { |
|
|
|
beforeRemove(file, fileList) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleRemove(file, fileList) { |
|
|
|
handleRemove(file, fileList) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
let fileName = this.form.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
this.coverUrl = ""; |
|
|
|
this.form.coverUrl = ""; |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleLgRemove(file, fileList) { |
|
|
|
handleLgRemove(file, fileList) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
let fileName = this.form.carouselUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
let fileName = this.carouselUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
this.carouselUrl = ""; |
|
|
|
this.form.carouselUrl = ""; |
|
|
|
}).catch(res => { |
|
|
|
}).catch(res => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSure() { |
|
|
|
uploadSure() { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
|
|
|
this.BatchUpload = false; |
|
|
|
this.BatchUpload = false; |
|
|
|
this.pageNo = 1; |
|
|
|
this.pageNo = 1; |
|
|
|
this.keyword = ""; |
|
|
|
this.keyword = ""; |
|
|
@ -335,80 +320,18 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
addSponsor() { |
|
|
|
addSponsor() { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.form.sponsorList.push(""); |
|
|
|
this.sponsorList.push(""); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
delSponsor(index) { |
|
|
|
delSponsor(index) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.form.sponsorList.splice(index, 1); |
|
|
|
this.sponsorList.splice(index, 1); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
addOrganizer() { |
|
|
|
addOrganizer() { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.form.undertakerList.push(""); |
|
|
|
this.undertakerList.push(""); |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
delOrganizer(index) { |
|
|
|
delOrganizer(index) { |
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.form.undertakerList.splice(index, 1); |
|
|
|
this.undertakerList.splice(index, 1); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
beforeDestroy() { |
|
|
|
|
|
|
|
if (this.touchTime>0){ |
|
|
|
|
|
|
|
this.$confirm('暂未保存,是否保存本次编辑?', '提示', { |
|
|
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
|
|
this.sponsor = this.sponsorList.filter(d => d).join(); |
|
|
|
|
|
|
|
this.undertaker = this.undertakerList.filter(d => d).join(); |
|
|
|
|
|
|
|
if (!this.name) return util.warningMsg("请填写竞赛名称"); |
|
|
|
|
|
|
|
if (status == 0) { |
|
|
|
|
|
|
|
if (!this.sponsor) return util.warningMsg("请填写主办方"); |
|
|
|
|
|
|
|
if (!this.signUpStartTime) return util.warningMsg("请选择报名时间"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let now = new Date().getTime(); |
|
|
|
|
|
|
|
let signUpStartTime = new Date(this.signUpStartTime).getTime(); |
|
|
|
|
|
|
|
let signUpEndTime = new Date(this.signUpEndTime).getTime(); |
|
|
|
|
|
|
|
let playStartTime = new Date(this.playStartTime).getTime(); |
|
|
|
|
|
|
|
// if(signUpStartTime && now > signUpStartTime) return this.$$message.warning('报名时间不能早于当前时间') |
|
|
|
|
|
|
|
if (!this.playStartTime && status == 0) return util.warningMsg("请选择竞赛时间"); |
|
|
|
|
|
|
|
if (playStartTime && playStartTime < signUpEndTime) return util.warningMsg("竞赛时间不能早于报名结束时间"); |
|
|
|
|
|
|
|
if (!this.description && status == 0) return util.warningMsg("请填写竞赛详情"); |
|
|
|
|
|
|
|
let data = { |
|
|
|
|
|
|
|
id: this.id, |
|
|
|
|
|
|
|
coverUrl: this.coverUrl, |
|
|
|
|
|
|
|
carouselUrl: this.carouselUrl, |
|
|
|
|
|
|
|
description: this.description, |
|
|
|
|
|
|
|
founderId: 1, |
|
|
|
|
|
|
|
name: this.name, |
|
|
|
|
|
|
|
playEndTime: this.playEndTime, |
|
|
|
|
|
|
|
playStartTime: this.playStartTime, |
|
|
|
|
|
|
|
publishStatus: status ? this.publishStatus : 0, |
|
|
|
|
|
|
|
signUpEndTime: this.signUpEndTime, |
|
|
|
|
|
|
|
signUpStartTime: this.signUpStartTime, |
|
|
|
|
|
|
|
sponsor: this.sponsor, |
|
|
|
|
|
|
|
undertaker: this.undertaker |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
if (this.id) { |
|
|
|
|
|
|
|
this.$put(this.api.editContest, data).then(res => { |
|
|
|
|
|
|
|
util.successMsg("修改成功"); |
|
|
|
|
|
|
|
this.$router.back(); |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.$post(this.api.addContest, data).then(res => { |
|
|
|
|
|
|
|
util.successMsg("创建成功"); |
|
|
|
|
|
|
|
this.$router.back(); |
|
|
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
|
|
this.$message({ |
|
|
|
|
|
|
|
type: 'info', |
|
|
|
|
|
|
|
message: '已取消保存' |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|