fix: 修复添加赛事
This commit is contained in:
parent
be5032602d
commit
ca48b1ab53
@ -1,11 +1,7 @@
|
||||
<template>
|
||||
<a-form
|
||||
:label-col="labelCol"
|
||||
:wrapper-col="wrapperCol"
|
||||
:form="form"
|
||||
>
|
||||
<a-form :label-col="labelCol" :wrapper-col="wrapperCol" :form="form">
|
||||
<a-form-item label="名称">
|
||||
<a-input v-decorator="decorator.competitionName" placeholder="赛事名称"/>
|
||||
<a-input v-decorator="decorator.competitionName" placeholder="赛事名称" />
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="负责人">
|
||||
<a-input v-decorator="decorator.userId" placeholder="主办方"/>
|
||||
@ -19,7 +15,7 @@
|
||||
placeholder="请选择负责人"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="时间">
|
||||
<a-form-item label="开始时间">
|
||||
<a-date-picker
|
||||
v-decorator="decorator.registrationStartTime"
|
||||
:disabled-date="disableDate"
|
||||
@ -28,7 +24,7 @@
|
||||
placeholder="选择开始报名时间"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="时间">
|
||||
<a-form-item label="截止时间">
|
||||
<a-date-picker
|
||||
v-decorator="decorator.registrationEndTime"
|
||||
:disabled-date="disableDate"
|
||||
@ -38,7 +34,7 @@
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="描述">
|
||||
<a-textarea v-decorator="decorator.announcementLink" placeholder="描述"/>
|
||||
<a-textarea v-decorator="decorator.announcementLink" placeholder="描述" />
|
||||
</a-form-item>
|
||||
<!-- 状态 -->
|
||||
<a-form-item label="状态">
|
||||
@ -52,40 +48,42 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from 'dayjs';
|
||||
import EditMixin from './edit-mixin';
|
||||
import { raceLevels,competitionStatus } from '@/utils/const';
|
||||
import dayjs from "dayjs";
|
||||
import EditMixin from "./edit-mixin";
|
||||
import { raceLevels, competitionStatus } from "@/utils/const";
|
||||
|
||||
export default {
|
||||
name: 'EditRace',
|
||||
name: "EditRace",
|
||||
mixins: [EditMixin],
|
||||
data() {
|
||||
return {
|
||||
competitionStatus,
|
||||
raceLevels,
|
||||
decorator,
|
||||
users:[],
|
||||
users: [],
|
||||
};
|
||||
},
|
||||
mounted(){
|
||||
this.$api.AllUser().then(response => {
|
||||
const users = response.data.filter(item=>{
|
||||
mounted() {
|
||||
this.$api
|
||||
.AllUser()
|
||||
.then((response) => {
|
||||
const users = response.data.filter((item) => {
|
||||
// 仅返回教师用户
|
||||
return item.userPrivileges==1
|
||||
return item.userPrivileges == 1;
|
||||
});
|
||||
const selectOptions = users
|
||||
.map(user => ({
|
||||
const selectOptions = users.map((user) => ({
|
||||
label: user.userName,
|
||||
value: user.userId
|
||||
value: user.userId,
|
||||
}));
|
||||
this.users = selectOptions;
|
||||
}).catch(error => {
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
disableDate(cur) {
|
||||
const yesterday = dayjs().startOf('day');
|
||||
const yesterday = dayjs().startOf("day");
|
||||
return cur.isSameOrBefore(yesterday);
|
||||
},
|
||||
initData() {
|
||||
@ -104,47 +102,84 @@ export default {
|
||||
|
||||
// 定义装饰器
|
||||
const decorator = {
|
||||
competitionName: ['competitionName', {
|
||||
rules: [{
|
||||
competitionName: [
|
||||
"competitionName",
|
||||
{
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入赛事名称!',
|
||||
}],
|
||||
}],
|
||||
userId: ['userId', {
|
||||
rules: [{
|
||||
message: "请输入赛事名称!",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
userId: [
|
||||
"userId",
|
||||
{
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入负责人!',
|
||||
}],
|
||||
}],
|
||||
registrationStartTime: ['registrationStartTime', {
|
||||
rules: [{
|
||||
message: "请输入负责人!",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
registrationStartTime: [
|
||||
"registrationStartTime",
|
||||
{
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '选择开始时间!',
|
||||
}],
|
||||
}],
|
||||
registrationEndTime: ['registrationEndTime', {
|
||||
rules: [{
|
||||
message: "选择开始时间!",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
registrationEndTime: [
|
||||
"registrationEndTime",
|
||||
{
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '选择结束时间!',
|
||||
}],
|
||||
}],
|
||||
location: ['location', {
|
||||
rules: [{
|
||||
message: "选择结束时间!",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
location: [
|
||||
"location",
|
||||
{
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请填写地点!',
|
||||
}],
|
||||
}],
|
||||
competitionStatus: ['competitionStatus', {
|
||||
message: "请填写地点!",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
competitionStatus: [
|
||||
"competitionStatus",
|
||||
{
|
||||
initialValue: 0,
|
||||
}],
|
||||
level: ['level', {
|
||||
},
|
||||
],
|
||||
level: [
|
||||
"level",
|
||||
{
|
||||
initialValue: 1,
|
||||
}],
|
||||
type: ['type', {
|
||||
initialValue: 'A',
|
||||
}],
|
||||
announcementLink: ['announcementLink', {
|
||||
initialValue: '',
|
||||
}],
|
||||
},
|
||||
],
|
||||
type: [
|
||||
"type",
|
||||
{
|
||||
initialValue: "A",
|
||||
},
|
||||
],
|
||||
announcementLink: [
|
||||
"announcementLink",
|
||||
{
|
||||
initialValue: "",
|
||||
},
|
||||
],
|
||||
};
|
||||
</script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user