|
@@ -1,6 +1,7 @@
|
|
|
-import { Modal } from "antd"
|
|
|
+import { DatePicker, Form, Input, Modal, Radio, Select, Space, TimePicker } from "antd"
|
|
|
+import { RangePickerProps } from "antd/lib/date-picker"
|
|
|
import React from "react"
|
|
|
-
|
|
|
+import moment from "moment"
|
|
|
|
|
|
interface Props {
|
|
|
visible?: boolean
|
|
@@ -13,15 +14,101 @@ interface Props {
|
|
|
* @param param0
|
|
|
* @returns
|
|
|
*/
|
|
|
-const MsgPushModal: React.FC<Props> = ({ }) => {
|
|
|
+const MsgPushModal: React.FC<Props> = ({ visible, onClose, onChange }) => {
|
|
|
+
|
|
|
+ /*************************/
|
|
|
+ const [form] = Form.useForm()
|
|
|
+ const sendWay = Form.useWatch('sendWay', form)
|
|
|
+ const startDate = Form.useWatch('startDate', form);
|
|
|
+ const endDate = Form.useWatch('endDate', form);
|
|
|
+ /*************************/
|
|
|
+
|
|
|
+ const handleOk = async () => {
|
|
|
+ let validate = await form.validateFields()
|
|
|
+ }
|
|
|
|
|
|
+ const disabledDate: RangePickerProps['disabledDate'] = (current) => {
|
|
|
+ return current && current < moment().startOf('days');
|
|
|
+ };
|
|
|
|
|
|
+ const disabledStartDate: RangePickerProps['disabledDate'] = (current) => {
|
|
|
+ if (endDate) {
|
|
|
+ return current && (current < moment().startOf('days') || current > moment(endDate).endOf('days'));
|
|
|
+ }
|
|
|
+ return current && current < moment().startOf('days');
|
|
|
+ };
|
|
|
+
|
|
|
+ const disabledEndDate: RangePickerProps['disabledDate'] = (current) => {
|
|
|
+ if (startDate) {
|
|
|
+ return current && current < moment(startDate).startOf('days');
|
|
|
+ }
|
|
|
+ return current && current < moment().startOf('days');
|
|
|
+ };
|
|
|
|
|
|
return <Modal
|
|
|
title='新建游戏内消息推送'
|
|
|
-
|
|
|
+ visible={visible}
|
|
|
+ onCancel={onClose}
|
|
|
+ onOk={handleOk}
|
|
|
>
|
|
|
-
|
|
|
+ <Form
|
|
|
+ name="basicMsgPush"
|
|
|
+ form={form}
|
|
|
+ labelCol={{ span: 4 }}
|
|
|
+ wrapperCol={{ span: 20 }}
|
|
|
+ autoComplete="off"
|
|
|
+ initialValues={{ sendWay: 0 }}
|
|
|
+ colon={false}
|
|
|
+ labelAlign="left"
|
|
|
+ >
|
|
|
+ <Form.Item
|
|
|
+ label={<strong>任务标题</strong>}
|
|
|
+ name="name"
|
|
|
+ rules={[{ required: true, message: '请输入任务标题' }]}
|
|
|
+ >
|
|
|
+ <Input placeholder="请输入任务标题" />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label={<strong>发送类型</strong>}
|
|
|
+ name="sendWay"
|
|
|
+ rules={[{ required: true, message: '请选择发送类型' }]}
|
|
|
+ >
|
|
|
+ <Radio.Group
|
|
|
+ options={[{ label: '立即发送', value: 0 }, { label: '定时发送', value: 1 }, { label: '每日循环', value: 2 }]}
|
|
|
+ optionType="button"
|
|
|
+ buttonStyle="solid"
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ {sendWay === 1 ? <Form.Item
|
|
|
+ label={<strong>发送时间</strong>}
|
|
|
+ name="sendTime"
|
|
|
+ rules={[{ required: true, message: '请选择发送时间' }]}
|
|
|
+ >
|
|
|
+ <DatePicker disabledDate={disabledDate} showTime />
|
|
|
+ </Form.Item> : sendWay === 2 ? <>
|
|
|
+ <Form.Item
|
|
|
+ label={<strong>发送日期</strong>}
|
|
|
+ required
|
|
|
+ >
|
|
|
+ <Space>
|
|
|
+ <Form.Item name='startDate' rules={[{ required: true, message: '请选择开始日期' }]} noStyle>
|
|
|
+ <DatePicker disabledDate={disabledStartDate} placeholder={'开始时间'} />
|
|
|
+ </Form.Item>
|
|
|
+ <span>-</span>
|
|
|
+ <Form.Item name='endDate' noStyle>
|
|
|
+ <DatePicker disabledDate={disabledEndDate} placeholder={'结束日期'} />
|
|
|
+ </Form.Item>
|
|
|
+ </Space>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item
|
|
|
+ label={<strong>发送时间</strong>}
|
|
|
+ name="sendTime"
|
|
|
+ rules={[{ required: true, message: '请选择发送时间' }]}
|
|
|
+ >
|
|
|
+ <TimePicker />
|
|
|
+ </Form.Item>
|
|
|
+ </> : null}
|
|
|
+ </Form>
|
|
|
</Modal>
|
|
|
}
|
|
|
|