|
|
|
@ -132,7 +132,8 @@ export default { |
|
|
|
|
playTime: "", |
|
|
|
|
playStartTime: "", |
|
|
|
|
playEndTime: "", |
|
|
|
|
description: "" |
|
|
|
|
description: "", |
|
|
|
|
touchTime:0, |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
components: { |
|
|
|
@ -140,6 +141,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
signupTime: function(val) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
if (val) { |
|
|
|
|
this.signUpStartTime = val[0]; |
|
|
|
|
this.signUpEndTime = val[1]; |
|
|
|
@ -149,6 +151,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
playTime: function(val) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
if (val) { |
|
|
|
|
this.playStartTime = val[0]; |
|
|
|
|
this.playEndTime = val[1]; |
|
|
|
@ -167,9 +170,9 @@ export default { |
|
|
|
|
"setMatchId" |
|
|
|
|
]), |
|
|
|
|
save(status) { |
|
|
|
|
this.touchTime = 0 |
|
|
|
|
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("请填写主办方"); |
|
|
|
@ -183,7 +186,6 @@ export default { |
|
|
|
|
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, |
|
|
|
@ -203,51 +205,48 @@ export default { |
|
|
|
|
this.$put(this.api.editContest, data).then(res => { |
|
|
|
|
util.successMsg("修改成功"); |
|
|
|
|
this.$router.back(); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}); |
|
|
|
|
}).catch(err => { |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.$post(this.api.addContest, data).then(res => { |
|
|
|
|
util.successMsg("创建成功"); |
|
|
|
|
this.$router.back(); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}); |
|
|
|
|
}).catch(err => { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
getData() { |
|
|
|
|
this.$get(this.api.getContest + "/" + this.id) |
|
|
|
|
.then(res => { |
|
|
|
|
let data = res.contest; |
|
|
|
|
this.coverUrl = data.coverUrl; |
|
|
|
|
this.carouselUrl = data.carouselUrl; |
|
|
|
|
this.description = data.description; |
|
|
|
|
this.name = data.name; |
|
|
|
|
this.playEndTime = data.playEndTime; |
|
|
|
|
this.playStartTime = data.playStartTime; |
|
|
|
|
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 => { |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
this.$get(this.api.getContest + "/" + this.id).then(res => { |
|
|
|
|
let data = res.contest; |
|
|
|
|
this.coverUrl = data.coverUrl; |
|
|
|
|
this.carouselUrl = data.carouselUrl; |
|
|
|
|
this.description = data.description; |
|
|
|
|
this.name = data.name; |
|
|
|
|
this.playEndTime = data.playEndTime; |
|
|
|
|
this.playStartTime = data.playStartTime; |
|
|
|
|
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() { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
this.setMatchId(this.id); |
|
|
|
|
// this.$store.commit("setMatchId", { matchId: this.id }); |
|
|
|
|
}, |
|
|
|
|
handleExceed(files, fileList) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
util.warningMsg(`当前限制选择 1 个文件,如需更换,请删除上一个文件再重新选择!`); |
|
|
|
|
}, |
|
|
|
|
uploadSuccess(res, file, fileList) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
if (this.coverUrl) { |
|
|
|
|
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
@ -257,6 +256,7 @@ export default { |
|
|
|
|
this.coverUrl = res.data.filesResult.fileUrl; |
|
|
|
|
}, |
|
|
|
|
uploadLgSuccess(res, file, fileList) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
if (this.carouselUrl) { |
|
|
|
|
let fileName = this.carouselUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
@ -266,6 +266,7 @@ export default { |
|
|
|
|
this.carouselUrl = res.data.filesResult.fileUrl; |
|
|
|
|
}, |
|
|
|
|
uploadError(err, file, fileList) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
this.$message({ |
|
|
|
|
message: "上传出错,请重试!", |
|
|
|
|
type: "error", |
|
|
|
@ -273,9 +274,11 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
beforeRemove(file, fileList) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
return this.$confirm(`确定移除 ${file.name}?`); |
|
|
|
|
}, |
|
|
|
|
handleRemove(file, fileList) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
let fileName = this.coverUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
|
this.coverUrl = ""; |
|
|
|
@ -283,6 +286,7 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleLgRemove(file, fileList) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
let fileName = this.carouselUrl.replace("https://liuwanr.oss-cn-shenzhen.aliyuncs.com/", ""); |
|
|
|
|
this.$del(`${this.api.fileDeletion}?keys=${fileName}`).then(res => { |
|
|
|
|
this.carouselUrl = ""; |
|
|
|
@ -290,6 +294,7 @@ export default { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
uploadSure() { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
this.BatchUpload = false; |
|
|
|
|
this.pageNo = 1; |
|
|
|
|
this.keyword = ""; |
|
|
|
@ -298,27 +303,86 @@ export default { |
|
|
|
|
goback() { |
|
|
|
|
this.$confirm("确定返回?未更新的信息将不会保存。", "提示", { |
|
|
|
|
type: "warning" |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.$router.push("/match"); |
|
|
|
|
}) |
|
|
|
|
.catch(() => { |
|
|
|
|
}); |
|
|
|
|
}).then(() => { |
|
|
|
|
this.$router.push("/match"); |
|
|
|
|
}).catch(() => { |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
addSponsor() { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
this.sponsorList.push(""); |
|
|
|
|
}, |
|
|
|
|
delSponsor(index) { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
this.sponsorList.splice(index, 1); |
|
|
|
|
}, |
|
|
|
|
addOrganizer() { |
|
|
|
|
this.touchTime = this.touchTime+1 |
|
|
|
|
this.undertakerList.push(""); |
|
|
|
|
}, |
|
|
|
|
delOrganizer(index) { |
|
|
|
|
this.touchTime = this.touchTime+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> |
|
|
|
|
|
|
|
|
|