|
|
@ -132,7 +132,8 @@ export default { |
|
|
|
playTime: "", |
|
|
|
playTime: "", |
|
|
|
playStartTime: "", |
|
|
|
playStartTime: "", |
|
|
|
playEndTime: "", |
|
|
|
playEndTime: "", |
|
|
|
description: "" |
|
|
|
description: "", |
|
|
|
|
|
|
|
touchTime:0, |
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
components: { |
|
|
|
components: { |
|
|
@ -140,6 +141,7 @@ export default { |
|
|
|
}, |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
watch: { |
|
|
|
signupTime: function(val) { |
|
|
|
signupTime: function(val) { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
if (val) { |
|
|
|
if (val) { |
|
|
|
this.signUpStartTime = val[0]; |
|
|
|
this.signUpStartTime = val[0]; |
|
|
|
this.signUpEndTime = val[1]; |
|
|
|
this.signUpEndTime = val[1]; |
|
|
@ -149,6 +151,7 @@ export default { |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
playTime: function(val) { |
|
|
|
playTime: function(val) { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
if (val) { |
|
|
|
if (val) { |
|
|
|
this.playStartTime = val[0]; |
|
|
|
this.playStartTime = val[0]; |
|
|
|
this.playEndTime = val[1]; |
|
|
|
this.playEndTime = val[1]; |
|
|
@ -167,9 +170,9 @@ export default { |
|
|
|
"setMatchId" |
|
|
|
"setMatchId" |
|
|
|
]), |
|
|
|
]), |
|
|
|
save(status) { |
|
|
|
save(status) { |
|
|
|
|
|
|
|
this.touchTime = 0 |
|
|
|
this.sponsor = this.sponsorList.filter(d => d).join(); |
|
|
|
this.sponsor = this.sponsorList.filter(d => d).join(); |
|
|
|
this.undertaker = this.undertakerList.filter(d => d).join(); |
|
|
|
this.undertaker = this.undertakerList.filter(d => d).join(); |
|
|
|
|
|
|
|
|
|
|
|
if (!this.name) return util.warningMsg("请填写竞赛名称"); |
|
|
|
if (!this.name) return util.warningMsg("请填写竞赛名称"); |
|
|
|
if (status == 0) { |
|
|
|
if (status == 0) { |
|
|
|
if (!this.sponsor) return util.warningMsg("请填写主办方"); |
|
|
|
if (!this.sponsor) return util.warningMsg("请填写主办方"); |
|
|
@ -183,7 +186,6 @@ export default { |
|
|
|
if (!this.playStartTime && status == 0) return util.warningMsg("请选择竞赛时间"); |
|
|
|
if (!this.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 (!this.description && status == 0) return util.warningMsg("请填写竞赛详情"); |
|
|
|
|
|
|
|
|
|
|
|
let data = { |
|
|
|
let data = { |
|
|
|
id: this.id, |
|
|
|
id: this.id, |
|
|
|
coverUrl: this.coverUrl, |
|
|
|
coverUrl: this.coverUrl, |
|
|
@ -203,21 +205,18 @@ export default { |
|
|
|
this.$put(this.api.editContest, data).then(res => { |
|
|
|
this.$put(this.api.editContest, data).then(res => { |
|
|
|
util.successMsg("修改成功"); |
|
|
|
util.successMsg("修改成功"); |
|
|
|
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("创建成功"); |
|
|
|
this.$router.back(); |
|
|
|
this.$router.back(); |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
.catch(err => { |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
getData() { |
|
|
|
getData() { |
|
|
|
this.$get(this.api.getContest + "/" + this.id) |
|
|
|
this.$get(this.api.getContest + "/" + this.id).then(res => { |
|
|
|
.then(res => { |
|
|
|
|
|
|
|
let data = res.contest; |
|
|
|
let data = res.contest; |
|
|
|
this.coverUrl = data.coverUrl; |
|
|
|
this.coverUrl = data.coverUrl; |
|
|
|
this.carouselUrl = data.carouselUrl; |
|
|
|
this.carouselUrl = data.carouselUrl; |
|
|
@ -230,24 +229,24 @@ export default { |
|
|
|
this.signUpStartTime = data.signUpStartTime; |
|
|
|
this.signUpStartTime = data.signUpStartTime; |
|
|
|
this.sponsor = data.sponsor; |
|
|
|
this.sponsor = data.sponsor; |
|
|
|
this.undertaker = data.undertaker; |
|
|
|
this.undertaker = data.undertaker; |
|
|
|
|
|
|
|
|
|
|
|
this.signupTime = [data.signUpStartTime, data.signUpEndTime]; |
|
|
|
this.signupTime = [data.signUpStartTime, data.signUpEndTime]; |
|
|
|
this.playTime = [data.playStartTime, data.playEndTime]; |
|
|
|
this.playTime = [data.playStartTime, data.playEndTime]; |
|
|
|
this.sponsorList = data.sponsor.split(","); |
|
|
|
this.sponsorList = data.sponsor.split(","); |
|
|
|
this.undertakerList = data.undertaker.split(","); |
|
|
|
this.undertakerList = data.undertaker.split(","); |
|
|
|
}) |
|
|
|
}).catch(err => { |
|
|
|
.catch(err => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
commitId() { |
|
|
|
commitId() { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.setMatchId(this.id); |
|
|
|
this.setMatchId(this.id); |
|
|
|
// this.$store.commit("setMatchId", { matchId: 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.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 => { |
|
|
@ -257,6 +256,7 @@ export default { |
|
|
|
this.coverUrl = res.data.filesResult.fileUrl; |
|
|
|
this.coverUrl = res.data.filesResult.fileUrl; |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadLgSuccess(res, file, fileList) { |
|
|
|
uploadLgSuccess(res, file, fileList) { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
if (this.carouselUrl) { |
|
|
|
if (this.carouselUrl) { |
|
|
|
let fileName = this.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 => { |
|
|
@ -266,6 +266,7 @@ export default { |
|
|
|
this.carouselUrl = res.data.filesResult.fileUrl; |
|
|
|
this.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", |
|
|
@ -273,9 +274,11 @@ 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.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.coverUrl = ""; |
|
|
@ -283,6 +286,7 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
handleLgRemove(file, fileList) { |
|
|
|
handleLgRemove(file, fileList) { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
let fileName = this.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.carouselUrl = ""; |
|
|
@ -290,6 +294,7 @@ export default { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
uploadSure() { |
|
|
|
uploadSure() { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.BatchUpload = false; |
|
|
|
this.BatchUpload = false; |
|
|
|
this.pageNo = 1; |
|
|
|
this.pageNo = 1; |
|
|
|
this.keyword = ""; |
|
|
|
this.keyword = ""; |
|
|
@ -298,27 +303,86 @@ export default { |
|
|
|
goback() { |
|
|
|
goback() { |
|
|
|
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", { |
|
|
|
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", { |
|
|
|
type: "warning" |
|
|
|
type: "warning" |
|
|
|
}) |
|
|
|
}).then(() => { |
|
|
|
.then(() => { |
|
|
|
|
|
|
|
this.$router.push("/match"); |
|
|
|
this.$router.push("/match"); |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
.catch(() => { |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
addSponsor() { |
|
|
|
addSponsor() { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.sponsorList.push(""); |
|
|
|
this.sponsorList.push(""); |
|
|
|
}, |
|
|
|
}, |
|
|
|
delSponsor(index) { |
|
|
|
delSponsor(index) { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.sponsorList.splice(index, 1); |
|
|
|
this.sponsorList.splice(index, 1); |
|
|
|
}, |
|
|
|
}, |
|
|
|
addOrganizer() { |
|
|
|
addOrganizer() { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.undertakerList.push(""); |
|
|
|
this.undertakerList.push(""); |
|
|
|
}, |
|
|
|
}, |
|
|
|
delOrganizer(index) { |
|
|
|
delOrganizer(index) { |
|
|
|
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
this.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> |
|
|
|
|
|
|
|
|
|
|
|