|
|
|
@ -1,39 +1,71 @@
|
|
|
|
|
import React from 'react'
|
|
|
|
|
import { Modal ,Form} from 'antd';
|
|
|
|
|
import { Modal , Form, Input, Radio,DatePicker, TimePicker,Select} from 'antd';
|
|
|
|
|
|
|
|
|
|
const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
|
|
|
|
|
// eslint-disable-next-line
|
|
|
|
|
|
|
|
|
|
class extends React.Component {
|
|
|
|
|
render() {
|
|
|
|
|
const { visible, onCancel, onCreate, form } = this.props;
|
|
|
|
|
const { getFieldDecorator } = form;
|
|
|
|
|
const { Option } = Select;
|
|
|
|
|
const formItemLayout = {
|
|
|
|
|
labelCol: { span: 4 },
|
|
|
|
|
wrapperCol: { span: 19},
|
|
|
|
|
};
|
|
|
|
|
return (
|
|
|
|
|
<Modal
|
|
|
|
|
visible={visible}
|
|
|
|
|
title="Create a new collection"
|
|
|
|
|
okText="Create"
|
|
|
|
|
onCancel={onCancel}
|
|
|
|
|
onOk={onCreate}
|
|
|
|
|
title="创建签到"
|
|
|
|
|
closable={false}
|
|
|
|
|
footer={null}
|
|
|
|
|
width={600}
|
|
|
|
|
>
|
|
|
|
|
<Form layout="vertical">
|
|
|
|
|
<Form.Item label="Title">
|
|
|
|
|
<Form {...formItemLayout}>
|
|
|
|
|
|
|
|
|
|
<Form.Item label="签到名称:">
|
|
|
|
|
{getFieldDecorator('title', {
|
|
|
|
|
rules: [{ required: true, message: 'Please input the title of collection!' }],
|
|
|
|
|
})(<Input />)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item label="Description">
|
|
|
|
|
{getFieldDecorator('description')(<Input type="textarea" />)}
|
|
|
|
|
|
|
|
|
|
<Form.Item label="签到班级:">
|
|
|
|
|
{getFieldDecorator('select-multiple', {
|
|
|
|
|
rules: [
|
|
|
|
|
{ required: true, message: 'Please select your favourite colors!', type: 'array' },
|
|
|
|
|
],
|
|
|
|
|
})(
|
|
|
|
|
<Select mode="multiple" placeholder="Please select favourite colors">
|
|
|
|
|
<Option value="red">Red</Option>
|
|
|
|
|
<Option value="green">Green</Option>
|
|
|
|
|
<Option value="blue">Blue</Option>
|
|
|
|
|
</Select>,
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
<Form.Item className="collection-create-form_last-form-item">
|
|
|
|
|
|
|
|
|
|
<Form.Item label="签到方式:" className="collection-create-form_last-form-item">
|
|
|
|
|
{getFieldDecorator('modifier', {
|
|
|
|
|
initialValue: 'public',
|
|
|
|
|
})(
|
|
|
|
|
<Radio.Group>
|
|
|
|
|
<Radio value="public">Public</Radio>
|
|
|
|
|
<Radio value="private">Private</Radio>
|
|
|
|
|
<Radio value="private">Private</Radio>
|
|
|
|
|
</Radio.Group>,
|
|
|
|
|
)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
<Form.Item label="签到日期:">
|
|
|
|
|
{getFieldDecorator('date-picker', config)(<DatePicker />)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
<Form.Item label="开始时间:">
|
|
|
|
|
{getFieldDecorator('time-picker', config)(<TimePicker />)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
<Form.Item label="结束时间:">
|
|
|
|
|
{getFieldDecorator('time-picker', config)(<TimePicker />)}
|
|
|
|
|
</Form.Item>
|
|
|
|
|
|
|
|
|
|
</Form>
|
|
|
|
|
</Modal>
|
|
|
|
|
);
|
|
|
|
@ -41,74 +73,19 @@ const CollectionCreateForm = Form.create({ name: 'form_in_modal' })(
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
class CollectionsPage extends React.Component {
|
|
|
|
|
state = {
|
|
|
|
|
visible: false,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
showModal = () => {
|
|
|
|
|
this.setState({ visible: true });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleCancel = () => {
|
|
|
|
|
this.setState({ visible: false });
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleCreate = () => {
|
|
|
|
|
const { form } = this.formRef.props;
|
|
|
|
|
form.validateFields((err, values) => {
|
|
|
|
|
if (err) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log('Received values of form: ', values);
|
|
|
|
|
form.resetFields();
|
|
|
|
|
this.setState({ visible: false });
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
saveFormRef = formRef => {
|
|
|
|
|
this.formRef = formRef;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class Createsignmodel extends React.Component {
|
|
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
<CollectionCreateForm
|
|
|
|
|
wrappedComponentRef={this.saveFormRef}
|
|
|
|
|
visible={this.state.visible}
|
|
|
|
|
onCancel={this.handleCancel}
|
|
|
|
|
onCreate={this.handleCreate}
|
|
|
|
|
visible={this.props.visible}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default class Createsignmodel extends React.Component {
|
|
|
|
|
constructor(props) {
|
|
|
|
|
super(props)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
console.log(this.props)
|
|
|
|
|
return(
|
|
|
|
|
<React.Fragment>
|
|
|
|
|
{this.props.visible?<Modal
|
|
|
|
|
title="创建签到"
|
|
|
|
|
visible={this.props.visible}
|
|
|
|
|
closable={false}
|
|
|
|
|
footer={null}
|
|
|
|
|
>
|
|
|
|
|
<p>Some contents...</p>
|
|
|
|
|
<p>Some contents...</p>
|
|
|
|
|
<p>Some contents...</p>
|
|
|
|
|
</Modal>:""}
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
export default Createsignmodel;
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|