|
@@ -1,168 +1,284 @@
|
|
|
-import UploadImg from "@/components/UploadImg"
|
|
|
-import { QuestionCircleOutlined } from "@ant-design/icons"
|
|
|
-import { Col, DatePicker, Form, Input, InputNumber, Modal, Radio, Row, Select, Space, Tooltip } from "antd"
|
|
|
-import { RangePickerProps } from "antd/es/date-picker"
|
|
|
-import React from "react"
|
|
|
-import moment from "moment"
|
|
|
-import { MaterialSourceEnum, MaterialTypeEnum, RatioEnum, StatusEnum, TaskTypeEnum } from "@/const"
|
|
|
-import Interval from "@/components/Interval"
|
|
|
-import UploadImgs from "@/components/UploadImgs"
|
|
|
-
|
|
|
-interface Props {
|
|
|
- initialValues?: any
|
|
|
- visible?: boolean
|
|
|
- onChange?: () => void
|
|
|
- onClose?: () => void
|
|
|
-}
|
|
|
-/**
|
|
|
- * 发布修改任务
|
|
|
- * @returns
|
|
|
- */
|
|
|
-const TaskModal: React.FC<Props> = ({ initialValues, visible, onChange, onClose }) => {
|
|
|
-
|
|
|
- /*************************************/
|
|
|
- const [form] = Form.useForm<TASKAPI.AddTask>()
|
|
|
- const endTime = Form.useWatch('endTime', form)
|
|
|
- const startTime = Form.useWatch('startTime', form)
|
|
|
- /*************************************/
|
|
|
-
|
|
|
- const handleOk = async () => {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- const disabledStartDate: RangePickerProps['disabledDate'] = (current) => {
|
|
|
- // Can not select days before today and today
|
|
|
- if (endTime) {
|
|
|
- return current && (current < moment().startOf('day') || current > moment(endTime).endOf('day'));
|
|
|
- }
|
|
|
- return current && (current < moment().startOf('day') || current > moment().add(30, 'day').endOf('day'));
|
|
|
- };
|
|
|
-
|
|
|
- const disabledEndDate: RangePickerProps['disabledDate'] = (current) => {
|
|
|
- // Can not select days before today and today
|
|
|
- if (startTime) {
|
|
|
- return current && (current < moment(startTime).startOf('day') || current > moment().add(30, 'day').endOf('day'));
|
|
|
- }
|
|
|
- return current && (current < moment().startOf('day') || current > moment().add(30, 'day').endOf('day'));
|
|
|
- };
|
|
|
-
|
|
|
- return <Modal
|
|
|
- title={`发布任务`}
|
|
|
- open={visible}
|
|
|
- onCancel={onClose}
|
|
|
- onOk={handleOk}
|
|
|
- width={1000}
|
|
|
- >
|
|
|
- <Form
|
|
|
- initialValues={
|
|
|
- Object.keys(initialValues).length > 0 ?
|
|
|
- initialValues :
|
|
|
- {
|
|
|
- taskType: 'TASK_TYPE_GAME',
|
|
|
- materialType: 'MATERIAL_TYPE_VIDEO',
|
|
|
- status: 'STATUS_NORMAL',
|
|
|
- materialSource: 'MATERIAL_SOURCE_ORIGINAL',
|
|
|
- checkout: 2,
|
|
|
- materialExamples: ['https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/AAFE07F5819A488EB0A7B14E03FBBE7E.jpg', 'https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/2E6677DBEC314344B0416557531899D2.jpg', 'https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/AAFE07F5819A488EB0A7B14E03FBBE7E.jpg', 'https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/2E6677DBEC314344B0416557531899D2.jpg']
|
|
|
- }
|
|
|
- }
|
|
|
- name="taskModal"
|
|
|
- form={form}
|
|
|
- labelCol={{ span: 6 }}
|
|
|
- wrapperCol={{ span: 18 }}
|
|
|
- colon={false}
|
|
|
- labelAlign="left"
|
|
|
- >
|
|
|
- <Row gutter={20}>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item label={<strong>任务头像</strong>} name='avatar'>
|
|
|
- <UploadImg isUpload={true}/>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>任务名称</strong>} name='name' rules={[{ required: true, message: '请输入任务名称!' }]}>
|
|
|
- <Input placeholder="请输入任务名称" />
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>描述</strong>} name='remark'>
|
|
|
- <Input placeholder="请输入任务描述" />
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>补充说明</strong>} name='remarkMore'>
|
|
|
- <Input placeholder="请输入补充说明" />
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>
|
|
|
- <span style={{ color: '#ff4d4f' }}>*</span>有效时间
|
|
|
- <Tooltip title="开始日期必填">
|
|
|
- <QuestionCircleOutlined style={{ marginLeft: 2 }} />
|
|
|
- </Tooltip>
|
|
|
- </strong>}>
|
|
|
- <Space>
|
|
|
- <Form.Item name="startTime" noStyle rules={[{ required: true, message: '请设置开始日期!' }]}>
|
|
|
- <DatePicker placeholder="开始日期" disabledDate={disabledStartDate} />
|
|
|
- </Form.Item>
|
|
|
- <span>-</span>
|
|
|
- <Form.Item name="endTime" noStyle>
|
|
|
- <DatePicker placeholder="结束日期" disabledDate={disabledEndDate} />
|
|
|
- </Form.Item>
|
|
|
- </Space>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>紧急度</strong>} tooltip="任务紧急度决定任务的展示情况,默认将“置顶”任务展示页面最前,其次按照发布时间倒序排列展示(即最新发布的任务展示在页面最前端)" name='urgency' rules={[{ required: true, message: '请选择任务紧急度!' }]}>
|
|
|
- <Select
|
|
|
- placeholder="请选择任务紧急度"
|
|
|
- options={[
|
|
|
- { value: false, label: '普通' },
|
|
|
- { value: true, label: '置顶' }
|
|
|
- ]}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>任务状态</strong>} name='status' rules={[{ required: true, message: '请选择任务状态!' }]}>
|
|
|
- <Radio.Group>
|
|
|
- {Object.keys(StatusEnum).filter(key => initialValues?.id ? true : key === 'STATUS_EXPIRE' ? false : true).map(key => <Radio value={key} key={key}>{(StatusEnum as any)[key]}</Radio>)}
|
|
|
- </Radio.Group>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>任务分类</strong>} name='taskType' rules={[{ required: true, message: '请选择任务分类!' }]}>
|
|
|
- <Radio.Group>
|
|
|
- {Object.keys(TaskTypeEnum).map(key => <Radio value={key} key={key}>{(TaskTypeEnum as any)[key]}</Radio>)}
|
|
|
- </Radio.Group>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>素材类型</strong>} name='materialType' rules={[{ required: true, message: '请选择素材类型!' }]}>
|
|
|
- <Radio.Group>
|
|
|
- {Object.keys(MaterialTypeEnum).map(key => <Radio value={key} key={key}>{(MaterialTypeEnum as any)[key]}</Radio>)}
|
|
|
- </Radio.Group>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>素材来源</strong>} name='materialSource' rules={[{ required: true, message: '请选择素材类型!' }]}>
|
|
|
- <Radio.Group>
|
|
|
- {Object.keys(MaterialSourceEnum).map(key => <Radio value={key} key={key}>{(MaterialSourceEnum as any)[key]}</Radio>)}
|
|
|
- </Radio.Group>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>奖励结算</strong>} name='checkout' rules={[{ required: true, message: '请输入奖励结算!' }]}>
|
|
|
- <InputNumber
|
|
|
- addonBefore="消耗比例"
|
|
|
- min={0}
|
|
|
- max={100}
|
|
|
- formatter={(value) => `${value}%`}
|
|
|
- parser={(value) => value!.replace('%', '') as any}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- <Col span={12}>
|
|
|
- <Form.Item label={<strong>素材比例</strong>} name='ratio' rules={[{ required: true, message: '请选择素材比例!' }]}>
|
|
|
- <Select
|
|
|
- placeholder="请选择素材比例"
|
|
|
- options={Object.keys(RatioEnum).map(key => ({ label: (RatioEnum as any)[key], value: key }))}
|
|
|
- />
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>素材尺寸</strong>} name='size' rules={[{ required: true, message: '请选择素材比例!' }]}>
|
|
|
- <Interval unit="*" placeholder={['720', '1280']}/>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>素材大小</strong>} name='extent' tooltip="单位(MB)" rules={[{ required: true, message: '请选择素材比例!' }]}>
|
|
|
- <Interval placeholder={['20M', '40M']}/>
|
|
|
- </Form.Item>
|
|
|
- <Form.Item label={<strong>素材示例上传</strong>} name='materialExamples'>
|
|
|
- <UploadImgs isUpload={true} maxCount={10} />
|
|
|
- </Form.Item>
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
-
|
|
|
- </Form>
|
|
|
- </Modal>
|
|
|
-}
|
|
|
-
|
|
|
+import UploadImg from "@/components/UploadImg"
|
|
|
+import { QuestionCircleOutlined } from "@ant-design/icons"
|
|
|
+import { Col, DatePicker, Form, Input, InputNumber, Modal, Radio, Row, Select, Space, Tooltip, message } from "antd"
|
|
|
+import { RangePickerProps } from "antd/es/date-picker"
|
|
|
+import React from "react"
|
|
|
+import moment from "moment"
|
|
|
+import { CheckoutTypeEnum, MaterialSourceEnum, MaterialTypeEnum, RatioEnum, StatusEnum, TaskTypeEnum, UrgencyEnum } from "@/const"
|
|
|
+import Interval from "@/components/Interval"
|
|
|
+import UploadImgs from "@/components/UploadImgs"
|
|
|
+import UploadZip from "@/components/UploadZip"
|
|
|
+import { addTaskApi, modifyTaskApi } from "@/services/task-api/myTask"
|
|
|
+import { useRequest } from "ahooks"
|
|
|
+
|
|
|
+const disabledRangeTime = (current: any) => {
|
|
|
+ let upDate = moment(current).format('YYYY-MM-DD')//选中的年月日
|
|
|
+ let upHours = moment(current).format('HH')//选中的时
|
|
|
+ let upMinutes = moment(current).format('mm')//选中的分
|
|
|
+ let atDate = moment(new Date()).format('YYYY-MM-DD')//今天的年月日
|
|
|
+ let atHours = moment(new Date()).format('HH')//现在的时
|
|
|
+ let atMinutes = moment(new Date()).format('mm')//现在的分
|
|
|
+ let atSeconds = moment(new Date()).format('ss')//现在的秒
|
|
|
+ let range = (num: number, at: string) => {
|
|
|
+ if (upDate == atDate) {//假如选中时间的今天
|
|
|
+ let arr: number[] = []
|
|
|
+ Array(num).fill('').forEach((a, b) => { if (b < Number(at)) { arr.push(b) } })
|
|
|
+ return arr
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let minutes = (num: number, at: string) => {
|
|
|
+ if (upDate == atDate) {//假如选中时间的今天
|
|
|
+ let arr: number[] = []
|
|
|
+ if (upHours == atHours) {
|
|
|
+ Array(num).fill('').forEach((a, b) => { if (b < Number(at) + 5) { arr.push(b) } })
|
|
|
+ }
|
|
|
+ return arr
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let seconds = (num: number, at: string) => {
|
|
|
+ if (upDate == atDate) {//假如选中时间的今天
|
|
|
+ let arr: number[] = []
|
|
|
+ if (upHours == atHours) {
|
|
|
+ Array(num).fill('').forEach((a, b) => {
|
|
|
+ if (Number(upMinutes) - Number(atMinutes) > 5) {
|
|
|
+ } else {
|
|
|
+ if (b < Number(at) + 5) { arr.push(b) }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return arr
|
|
|
+ } else {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ disabledHours: () => range(24, atHours),
|
|
|
+ disabledMinutes: () => minutes(60, atMinutes),
|
|
|
+ disabledSeconds: () => seconds(60, atSeconds),
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+interface FormProps extends TASKAPI.AddTask {
|
|
|
+ ratio: any
|
|
|
+ size: any
|
|
|
+ extent: any
|
|
|
+ materialExamples: string[]
|
|
|
+}
|
|
|
+
|
|
|
+interface ModifyFormProps extends TASKAPI.ModifyTask {
|
|
|
+ materialExamples: string[]
|
|
|
+}
|
|
|
+
|
|
|
+interface Props {
|
|
|
+ initialValues?: any
|
|
|
+ visible?: boolean
|
|
|
+ onChange?: () => void
|
|
|
+ onClose?: () => void
|
|
|
+}
|
|
|
+/**
|
|
|
+ * 发布修改任务
|
|
|
+ * @returns
|
|
|
+ */
|
|
|
+const TaskModal: React.FC<Props> = ({ initialValues, visible, onChange, onClose }) => {
|
|
|
+
|
|
|
+ /*************************************/
|
|
|
+ const [form] = Form.useForm<FormProps>()
|
|
|
+ const endTime = Form.useWatch('endTime', form)
|
|
|
+ const startTime = Form.useWatch('startTime', form)
|
|
|
+ const checkoutType = Form.useWatch('checkoutType', form)
|
|
|
+ const addTask = useRequest(addTaskApi, { manual: true })
|
|
|
+ const modifyTask = useRequest(modifyTaskApi, { manual: true })
|
|
|
+ /*************************************/
|
|
|
+
|
|
|
+ const handleOk = async () => {
|
|
|
+ form.submit()
|
|
|
+ let data = await form.validateFields()
|
|
|
+ if (initialValues?.id) {
|
|
|
+ data.id = initialValues?.id
|
|
|
+ const { startTime, materialExamples, ...par } = data as ModifyFormProps
|
|
|
+ if (par?.endTime) {
|
|
|
+ par['endTime'] = moment(par.endTime).format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ }
|
|
|
+ if (materialExamples?.length > 0) {
|
|
|
+ par['materialExample'] = materialExamples.toString()
|
|
|
+ }
|
|
|
+ modifyTask.runAsync({ ...par, startTime: moment(startTime).format('YYYY-MM-DD HH:mm:ss') }).then(res => {
|
|
|
+ if (res?.data) {
|
|
|
+ message.success('修改成功')
|
|
|
+ onChange?.()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ const { size, extent, startTime, checkoutType, checkout, materialExamples, ...par } = data
|
|
|
+ let materialClaimJson = JSON.stringify({ size, extent })
|
|
|
+ if (par?.endTime) {
|
|
|
+ par['endTime'] = moment(par.endTime).format('YYYY-MM-DD HH:mm:ss')
|
|
|
+ }
|
|
|
+ if (materialExamples?.length > 0) {
|
|
|
+ par['materialExample'] = materialExamples.toString()
|
|
|
+ }
|
|
|
+ addTask.runAsync({ ...par, materialClaimJson, startTime: moment(startTime).format('YYYY-MM-DD HH:mm:ss'), checkoutType, checkout: checkoutType === 'CHECKOUT_TYPE_SCALE' ? checkout / 100 : checkout }).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res?.data) {
|
|
|
+ message.success('发布成功')
|
|
|
+ onChange?.()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const disabledStartDate: RangePickerProps['disabledDate'] = (current) => {
|
|
|
+ // Can not select days before today and today
|
|
|
+ if (endTime) {
|
|
|
+ return current && (current < moment().startOf('day') || current > moment(endTime).endOf('day'));
|
|
|
+ }
|
|
|
+ return current && (current < moment().startOf('day') || current > moment().add(30, 'day').endOf('day'));
|
|
|
+ };
|
|
|
+
|
|
|
+ const disabledEndDate: RangePickerProps['disabledDate'] = (current) => {
|
|
|
+ // Can not select days before today and today
|
|
|
+ if (startTime) {
|
|
|
+ return current && (current < moment(startTime).startOf('day') || current > moment().add(30, 'day').endOf('day'));
|
|
|
+ }
|
|
|
+ return current && (current < moment().startOf('day') || current > moment().add(30, 'day').endOf('day'));
|
|
|
+ };
|
|
|
+
|
|
|
+ return <Modal
|
|
|
+ title={initialValues?.id ? `修改任务` : `发布任务`}
|
|
|
+ open={visible}
|
|
|
+ onCancel={onClose}
|
|
|
+ onOk={handleOk}
|
|
|
+ width={1000}
|
|
|
+ confirmLoading={addTask.loading || modifyTask.loading}
|
|
|
+ >
|
|
|
+ <Form
|
|
|
+ initialValues={
|
|
|
+ Object.keys(initialValues).length > 0 ?
|
|
|
+ initialValues :
|
|
|
+ {
|
|
|
+ taskType: 'TASK_TYPE_GAME',
|
|
|
+ materialType: 'MATERIAL_TYPE_VIDEO',
|
|
|
+ status: 'STATUS_NORMAL',
|
|
|
+ materialSource: 'MATERIAL_SOURCE_ORIGINAL',
|
|
|
+ checkoutType: 'CHECKOUT_TYPE_SCALE',
|
|
|
+ checkout: 2,
|
|
|
+ // avatar: 'https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/AAFE07F5819A488EB0A7B14E03FBBE7E.jpg',
|
|
|
+ // materialExamples: ['https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/AAFE07F5819A488EB0A7B14E03FBBE7E.jpg', 'https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/2E6677DBEC314344B0416557531899D2.jpg', 'https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/AAFE07F5819A488EB0A7B14E03FBBE7E.jpg', 'https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/image/2E6677DBEC314344B0416557531899D2.jpg'],
|
|
|
+ // materialResource: 'https://zx-material-center-test.oss-cn-hangzhou.aliyuncs.com/zip/BBB2531663F448A7A4D599469F354DC9.zip'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ name="taskModal"
|
|
|
+ form={form}
|
|
|
+ labelCol={{ span: 6 }}
|
|
|
+ wrapperCol={{ span: 18 }}
|
|
|
+ colon={false}
|
|
|
+ labelAlign="left"
|
|
|
+ >
|
|
|
+ <Row gutter={20}>
|
|
|
+ <Col span={12}>
|
|
|
+ <Form.Item label={<strong>任务头像</strong>} name='avatar'>
|
|
|
+ <UploadImg isUpload={true} />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>任务名称</strong>} name='name' rules={[{ required: true, message: '请输入任务名称!' }]}>
|
|
|
+ <Input placeholder="请输入任务名称" />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>描述</strong>} name='remark'>
|
|
|
+ <Input placeholder="请输入任务描述" />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>说明</strong>} name='remarkMore' rules={[{ required: true, message: '请输入说明!' }]}>
|
|
|
+ <Input placeholder="请输入补充说明" />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>
|
|
|
+ <span style={{ color: '#ff4d4f' }}>*</span>有效时间
|
|
|
+ <Tooltip title="开始日期必填">
|
|
|
+ <QuestionCircleOutlined style={{ marginLeft: 2 }} />
|
|
|
+ </Tooltip>
|
|
|
+ </strong>}>
|
|
|
+ <Space>
|
|
|
+ <Form.Item name="startTime" noStyle rules={[{ required: true, message: '请设置开始日期!' }]}>
|
|
|
+ <DatePicker placeholder="开始日期" disabledDate={disabledStartDate} showTime disabledTime={disabledRangeTime} />
|
|
|
+ </Form.Item>
|
|
|
+ <span>-</span>
|
|
|
+ <Form.Item name="endTime" noStyle>
|
|
|
+ <DatePicker placeholder="结束日期" disabledDate={disabledEndDate} showTime disabledTime={disabledRangeTime} />
|
|
|
+ </Form.Item>
|
|
|
+ </Space>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>紧急度</strong>} name='urgency' rules={[{ required: true, message: '请选择任务紧急度!' }]} tooltip="任务紧急度决定任务的展示情况,默认将“置顶”任务展示页面最前,其次按照发布时间倒序排列展示(即最新发布的任务展示在页面最前端)">
|
|
|
+ <Select
|
|
|
+ placeholder="请选择任务紧急度"
|
|
|
+ options={Object.keys(UrgencyEnum).map(key => ({ label: (UrgencyEnum as any)[key], value: key }))}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>任务状态</strong>} name='status' rules={[{ required: true, message: '请选择任务状态!' }]}>
|
|
|
+ <Radio.Group>
|
|
|
+ {Object.keys(StatusEnum).filter(key => initialValues?.id ? true : key === 'STATUS_EXPIRE' ? false : true).map(key => <Radio value={key} key={key}>{(StatusEnum as any)[key]}</Radio>)}
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ {!initialValues?.id && <>
|
|
|
+ <Form.Item label={<strong>任务分类</strong>} name='taskType' rules={[{ required: true, message: '请选择任务分类!' }]}>
|
|
|
+ <Radio.Group>
|
|
|
+ {Object.keys(TaskTypeEnum).map(key => <Radio value={key} key={key}>{(TaskTypeEnum as any)[key]}</Radio>)}
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>素材类型</strong>} name='materialType' rules={[{ required: true, message: '请选择素材类型!' }]}>
|
|
|
+ <Radio.Group>
|
|
|
+ {Object.keys(MaterialTypeEnum).map(key => <Radio value={key} key={key}>{(MaterialTypeEnum as any)[key]}</Radio>)}
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>素材来源</strong>} name='materialSource' rules={[{ required: true, message: '请选择素材来源!' }]}>
|
|
|
+ <Radio.Group>
|
|
|
+ {Object.keys(MaterialSourceEnum).map(key => <Radio value={key} key={key}>{(MaterialSourceEnum as any)[key]}</Radio>)}
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>结算类型</strong>} name='checkoutType' rules={[{ required: true, message: '请选择结算类型!' }]} tooltip="消耗比例:按照最终素材的总消耗比例计算奖励,月度结算奖励;任务:按照任务最终审核状态为“合格”的素材计算奖励,月度结算奖励">
|
|
|
+ <Radio.Group onChange={(e) => {
|
|
|
+ if (e.target.value === 'CHECKOUT_TYPE_SCALE') form.setFieldsValue({ checkout: 2 })
|
|
|
+ else form.setFieldsValue({ checkout: 100 })
|
|
|
+ }}>
|
|
|
+ {Object.keys(CheckoutTypeEnum).map(key => <Radio value={key} key={key}>{(CheckoutTypeEnum as any)[key]}</Radio>)}
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>奖励结算</strong>} name='checkout' rules={[{ required: true, message: '请输入奖励结算!' }]}>
|
|
|
+ {checkoutType === 'CHECKOUT_TYPE_SCALE' ? <InputNumber
|
|
|
+ min={0}
|
|
|
+ max={100}
|
|
|
+ formatter={(value) => `${value}%`}
|
|
|
+ parser={(value) => value!.replace('%', '') as any}
|
|
|
+ /> : <InputNumber min={0} suffix="元" />}
|
|
|
+ </Form.Item>
|
|
|
+ </>}
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ {!initialValues?.id && <>
|
|
|
+ {/* <Form.Item label={<strong>素材比例</strong>} name='ratio' rules={[{ required: true, message: '请选择素材比例!' }]}>
|
|
|
+ <Select
|
|
|
+ placeholder="请选择素材比例"
|
|
|
+ options={Object.keys(RatioEnum).map(key => ({ label: (RatioEnum as any)[key], value: key }))}
|
|
|
+ />
|
|
|
+ </Form.Item> */}
|
|
|
+ <Form.Item label={<strong>素材尺寸</strong>} name='size' rules={[{ required: true, message: '请选择素材比例!' }]}>
|
|
|
+ <Interval unit="*" placeholder={['720', '1280']} />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>素材大小</strong>} name='extent' tooltip="单位(MB)" rules={[{ required: true, message: '请选择素材比例!' }]}>
|
|
|
+ <Interval placeholder={['20M', '40M']} />
|
|
|
+ </Form.Item>
|
|
|
+ </>}
|
|
|
+ <Form.Item label={<strong>素材示例</strong>} name='materialExamples'>
|
|
|
+ <UploadImgs isUpload={true} maxCount={10} />
|
|
|
+ </Form.Item>
|
|
|
+ <Form.Item label={<strong>素材资源包</strong>} name='materialResource'>
|
|
|
+ <UploadZip />
|
|
|
+ </Form.Item>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+
|
|
|
+ </Form>
|
|
|
+ </Modal>
|
|
|
+}
|
|
|
+
|
|
|
export default React.memo(TaskModal)
|