|
|
@@ -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={() => { }} |
|
|
|
> |
|
|
|
<a href="#">删除</a> |
|
|
|
</Popconfirm>, |
|
|
|
<a |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
const config = { |
|
|
|
title: '二维码', |
|
|
|
content: ( |
|
|
|
<QRCode |
|
|
|
id="qrCode" |
|
|
|
value={`https://black-pa.com:5443/lead?activityId=${record.id}`} |
|
|
|
size={200} // 二维码的大小 |
|
|
|
fgColor="#000000" // 二维码的颜色 |
|
|
|
style={{ margin: 'auto' }} |
|
|
|
/> |
|
|
|
), |
|
|
|
}; |
|
|
|
Modal.info(config); |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|
const config = { |
|
|
|
title: '二维码', |
|
|
|
content: ( |
|
|
|
<QRCode |
|
|
|
id="qrCode" |
|
|
|
value={`https://black-pa.com:5443/lead?activityId=${record.id}`} |
|
|
|
size={200} // 二维码的大小 |
|
|
|
fgColor="#000000" // 二维码的颜色 |
|
|
|
style={{ margin: 'auto' }} |
|
|
|
/> |
|
|
|
), |
|
|
|
}; |
|
|
|
Modal.info(config); |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
二维码 |
|
|
|
</a> |
|
|
|
}} |
|
|
|
> |
|
|
|
{' '} |
|
|
|
二维码 |
|
|
|
</a> |
|
|
|
]; |
|
|
|
return template; |
|
|
|
}, |
|
|
@@ -384,7 +385,7 @@ const activityInfManage = () => { |
|
|
|
</Button>, |
|
|
|
]} |
|
|
|
columns={columns} |
|
|
|
// rowSelection={{}} |
|
|
|
// rowSelection={{}} |
|
|
|
/> |
|
|
|
|
|
|
|
<CreateForm |
|
|
@@ -411,6 +412,7 @@ const activityInfManage = () => { |
|
|
|
}} |
|
|
|
createModalVisible={createModalVisible} |
|
|
|
values={currentRow || {}} |
|
|
|
form={form} |
|
|
|
/> |
|
|
|
|
|
|
|
<ConfigurationForm |
|
|
|