!26 报名时间判断 和管理页面报名和提交时间设置

Merge pull request !26 from Sky_ID/lwh
This commit is contained in:
Sky_ID 2022-06-24 10:09:30 +00:00 committed by Gitee
commit ac230ac578
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 51 additions and 7 deletions

View File

@ -66,6 +66,12 @@ export default {
userAvatar: "", //
rankIf: true, //
isLogin: false, //
applyTime:[],
submitTime:[],
};
},
@ -84,7 +90,17 @@ export default {
pageUtils.openPage(this.$router,"/" + this.$route.params.compId +"/guide");
break;
case "apply":
pageUtils.openPage(this.$router,"/" + this.$route.params.compId +"/apply");
//
var startTime = parseInt(this.$moment(this.applyTime[0]).format("X"))
var endTime = parseInt(this.$moment(this.applyTime[1]).format("X"))
var nowTime = parseInt(this.$moment().format("X"))
if (startTime <= nowTime && nowTime <= endTime){
pageUtils.openPage(this.$router,"/" + this.$route.params.compId +"/apply");
}else {
Message.warning("未在报名时间段")
this.getPath()
}
break;
case "submit":
pageUtils.openPage(this.$router,"/" + this.$route.params.compId +"/submit");
@ -152,6 +168,13 @@ export default {
//banner
this.banner = res.data.compBanner;
this.applyTime[0] = res.data.applyStartTime
this.applyTime[1] = res.data.applyEndTime
this.submitTime[0] = res.data.submitStartTime
this.submitTime[1] = res.data.submitEndTime
}else {
// 线404
Message.warning("该竞赛还未上线");

View File

@ -44,9 +44,9 @@
<el-switch v-model="compInfo.chart"></el-switch>
</el-form-item>
<el-form-item label="报名时间">
<el-form-item label="报名时间" v-if="isReady">
<el-date-picker
v-model="compInfo.applyTime"
v-model="applyTime"
type="datetimerange"
start-placeholder="开始日期"
end-placeholder="结束日期"
@ -54,9 +54,9 @@
</el-date-picker>
</el-form-item>
<el-form-item label="比赛时间">
<el-form-item label="比赛时间" v-if="isReady">
<el-date-picker
v-model="compInfo.submitTime"
v-model="submitTime"
type="datetimerange"
start-placeholder="开始日期"
end-placeholder="结束日期"
@ -371,6 +371,9 @@ export default {
],
},
isReady: false,
applyTime:[],
submitTime:[],
compInfo:{
compId: "",
compName: "",
@ -378,8 +381,10 @@ export default {
online: false,
rank: "",
chart: "",
applyTime:'',
submitTime:''
applyStartTime:'',
applyEndTime:'',
submitStartTime:'',
submitEndTime:'',
},
homeInfo:{
compId: "",
@ -459,6 +464,16 @@ export default {
saveData(type){
var compInfo = this.compInfo;
if (this.applyTime != null) {
compInfo.applyStartTime = this.applyTime[0]
compInfo.applyEndTime = this.applyTime[1]
}
if (this.submitTime != null) {
compInfo.submitStartTime = this.submitTime[0]
compInfo.submitEndTime = this.submitTime[1]
}
var chatInfo = this.chatInfo;
var guideInfo = this.guideInfo;
var submitCust = this.submitCust;
@ -472,6 +487,7 @@ export default {
contactInfo,
homeInfo,
};
console.log(compInfo)
this.$api.updateData(type,updateDataVo).then((res) =>{
if (res.status == 0) {
Message.success("保存成功");
@ -492,11 +508,16 @@ export default {
if (res.status == 0) {
//
this.compInfo = res.compInfo;
this.applyTime[0] = res.compInfo.applyStartTime
this.applyTime[1] = res.compInfo.applyEndTime
this.submitTime[0] = res.compInfo.submitStartTime
this.submitTime[1] = res.compInfo.submitEndTime
this.chatInfo = res.chatInfo;
this.contactInfo = res.contactInfo;
this.homeInfo = res.homeInfo;
this.submitCust = res.submitCust;
this.guideInfo = res.guideInfo;
this.isReady = true;
}else if (res.status == 10){
Message.error("系统错误");
}else {