diff --git a/src/pages/activity/activityInfo/components/CreateForm.jsx b/src/pages/activity/activityInfo/components/CreateForm.jsx index 78b5cd7..1c946dd 100644 --- a/src/pages/activity/activityInfo/components/CreateForm.jsx +++ b/src/pages/activity/activityInfo/components/CreateForm.jsx @@ -21,7 +21,7 @@ import { MinusCircleOutlined, PlusOutlined, UploadOutlined } from '@ant-design/i import { GetActivityConfiguration, GetCouponCanUseCountAndLimit, GetGoodsInfo, GetCosRequestURL } from '../service'; import axios from 'axios'; const CreateForm = (props) => { - const [form] = Form.useForm(); + const { Option, OptGroup } = Select; const [options, setoptions] = useState(); const [current, setCurrent] = React.useState(0); @@ -176,7 +176,7 @@ const CreateForm = (props) => { onProgress({ percent: Math.round(loaded / total * 100).toFixed(2) }, file); }, }).then(response => { - form.setFieldsValue({ activityImg: r.seeUrl }); + props.form.setFieldsValue({ activityImg: r.seeUrl }); if (response.status == 200 || response.statusText == 'OK') { setimgUrl(r.seeUrl) } @@ -208,10 +208,10 @@ const CreateForm = (props) => { >
@@ -649,7 +649,7 @@ const CreateForm = (props) => { > { - return current && current > form.getFieldValue('activityEndTime'); + return current && current > props.form.getFieldValue('activityEndTime'); }} /> { { - return current && current < form.getFieldValue('activityStartTime'); + return current && current < props.form.getFieldValue('activityStartTime'); }} /> diff --git a/src/pages/activity/activityInfo/index.jsx b/src/pages/activity/activityInfo/index.jsx index a28169b..8884ed8 100644 --- a/src/pages/activity/activityInfo/index.jsx +++ b/src/pages/activity/activityInfo/index.jsx @@ -1,5 +1,5 @@ import { PlusOutlined } from '@ant-design/icons'; -import { Switch, Popconfirm, Space, Tag, Button, message, Input, Drawer,Modal } from 'antd'; +import { Switch, Popconfirm, Space, Tag, Button, message, Input, Drawer, Modal, Form } from 'antd'; import React, { useState, useRef, useEffect } from 'react'; import { PageContainer, FooterToolbar } from '@ant-design/pro-layout'; import ProTable from '@ant-design/pro-table'; @@ -21,6 +21,7 @@ import { const key = 'message'; const activityInfManage = () => { + const [form] = Form.useForm(); const actionRef = useRef(); const [currentRow, setCurrentRow] = useState(); const [createModalVisible, handleModalVisible] = useState(false); @@ -32,9 +33,9 @@ const activityInfManage = () => { const handleAdd = async (fields) => { message.loading('正在添加...', key); try { - if(fields.activityType==3){ + if (fields.activityType == 3) { fields.activityRewards.forEach(element => { - element.value=`[${element.value.join()}]` + element.value = `[${element.value.join()}]` }); } await AddActivityInfo(JSON.stringify(fields)).then((r) => { @@ -86,10 +87,10 @@ const activityInfManage = () => { const handleUpdate = async (fields) => { message.loading('正在修改...', key); try { - if(fields.activityType==3){ - + if (fields.activityType == 3) { + fields.activityRewards.forEach(element => { - element.value=`[${element.value.join()}]` + element.value = `[${element.value.join()}]` }); } await UpdateActivityInfo(JSON.stringify(fields)).then((r) => { @@ -269,12 +270,12 @@ const activityInfManage = () => { record.activityStartTime = moment(record.activityStartTime); record.activityEndTime = moment(record.activityEndTime); record.activityRewards = r.data; - if (record.activityType==3) - { - record.activityRewards.forEach((item)=>{ - item.value= JSON.parse(item.value) + if (record.activityType == 3) { + record.activityRewards.forEach((item) => { + item.value = JSON.parse(item.value) }) } + form.setFieldsValue(record); return record; }); } @@ -318,32 +319,32 @@ const activityInfManage = () => { onConfirm={() => { handleRemove([record]); }} - onCancel={() => {}} + onCancel={() => { }} > 删除 , { - const config = { - title: '二维码', - content: ( - - ), - }; - Modal.info(config); + key="primary" + onClick={() => { + const config = { + title: '二维码', + content: ( + + ), + }; + Modal.info(config); - }} - > - {' '} - 二维码 - + }} + > + {' '} + 二维码 + ]; return template; }, @@ -384,7 +385,7 @@ const activityInfManage = () => { , ]} columns={columns} - // rowSelection={{}} + // rowSelection={{}} /> { }} createModalVisible={createModalVisible} values={currentRow || {}} + form={form} />