Просмотр исходного кода

互动页面bug 修改

tags/小炒逻辑变更前
gwbvipvip 2 лет назад
Родитель
Сommit
7cd7c82195
2 измененных файлов: 40 добавлений и 38 удалений
  1. +6
    -6
      src/pages/activity/activityInfo/components/CreateForm.jsx
  2. +34
    -32
      src/pages/activity/activityInfo/index.jsx

+ 6
- 6
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) => {
>
<Form
preserve={false}
form={form}
form={props.form}
labelCol={{ span: 4 }}
layout="Horizontal"
initialValues={props.values}
// initialValues={props.values}
onFinish={props.onFinish}
>
<span style={{ display: isFormShow ? 'block' : 'none' }}>
@@ -649,7 +649,7 @@ const CreateForm = (props) => {
>
<DatePicker placeholder="开始时间"
disabledDate={(current) => {
return current && current > form.getFieldValue('activityEndTime');
return current && current > props.form.getFieldValue('activityEndTime');
}} />
</Form.Item>
<Form.Item
@@ -661,7 +661,7 @@ const CreateForm = (props) => {
<DatePicker placeholder="结束时间"
disabledDate={(current) => {

return current && current < form.getFieldValue('activityStartTime');
return current && current < props.form.getFieldValue('activityStartTime');
}} />
</Form.Item>
</Form.Item>


+ 34
- 32
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={() => { }}
>
<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


Загрузка…
Отмена
Сохранить