Compare commits

...

2 Commits

  1. 6
      web/client/src/sections/fillion/actions/infor.js
  2. 31
      web/client/src/sections/fillion/components/infor/videoUpload.js

6
web/client/src/sections/fillion/actions/infor.js

@ -343,7 +343,7 @@ export function putAddPropagata (query) {
data: query, data: query,
actionType: 'PUT_PROPAGATA', actionType: 'PUT_PROPAGATA',
url: ApiTable.putpropagata, url: ApiTable.putpropagata,
msg: { error: '新增宣传视频信息失败' }, msg: { option: '新增宣传视频' },
// reducer: { name: 'reportstatistic' } // reducer: { name: 'reportstatistic' }
}); });
} }
@ -354,7 +354,7 @@ export function putEditPropagata (query) {
data: query, data: query,
actionType: 'PUT_PROPAGATA', actionType: 'PUT_PROPAGATA',
url: ApiTable.putpropagata, url: ApiTable.putpropagata,
msg: { error: '编辑宣传视频信息失败' }, msg: { option: '编辑宣传视频' },
// reducer: { name: 'reportstatistic' } // reducer: { name: 'reportstatistic' }
}); });
} }
@ -364,7 +364,7 @@ export function delPropagata (query) {
dispatch: dispatch, dispatch: dispatch,
actionType: 'DEL_PROPAGATA', actionType: 'DEL_PROPAGATA',
url: ApiTable.delpropagata.replace("{publicityId}", query?.publicityId), url: ApiTable.delpropagata.replace("{publicityId}", query?.publicityId),
msg: { error: '删除宣传视频信息失败' }, msg: { option: '删除宣传视频信息' },
// reducer: { name: 'reportstatistic' } // reducer: { name: 'reportstatistic' }
}); });
} }

31
web/client/src/sections/fillion/components/infor/videoUpload.js

@ -9,7 +9,6 @@ import { getPropagata } from '../../actions/infor';
const VideoUpload = (props) => { const VideoUpload = (props) => {
const { dispatch, record, counts, setCounts } = props const { dispatch, record, counts, setCounts } = props
const [form] = Form.useForm(); const [form] = Form.useForm();
@ -20,11 +19,9 @@ const VideoUpload = (props) => {
} }
const showModalEdit = () => { const showModalEdit = () => {
setIsModalVisible(true); setIsModalVisible(true);
}; };
//新增 //新增
const handleOkAdd = () => { const handleOkAdd = () => {
form.validateFields().then((values) => { form.validateFields().then((values) => {
@ -49,24 +46,28 @@ const VideoUpload = (props) => {
form.validateFields().then((values) => { form.validateFields().then((values) => {
const videoname = values.username const videoname = values.username
const id = record.id const id = record.id
const video = record.video const newVideoAddress = values.video.map((item) => {
return item.storageUrl
const data = { publicityId: id, name: videoname, video: video } })
const data = { publicityId: id, name: videoname, video: newVideoAddress }
dispatch(putEditPropagata(data)).then(() => { dispatch(putEditPropagata(data)).then(() => {
dispatch(getPropagata()).then((res) => { dispatch(getPropagata()).then((res) => {
setCounts(res.payload.data) setCounts(res.payload.data)
console.log(data);
}) })
}) })
setIsModalVisible(false);
} }
); );
setIsModalVisible(false);
}; };
const handleCancel = () => { const handleCancel = () => {
setIsModalVisible(false); setIsModalVisible(false);
}; };
const handleCancelEdit = () => {
setIsModalVisible(false);
form.resetFields()
};
const onFinish = (values) => { const onFinish = (values) => {
console.log('Success:', values); console.log('Success:', values);
@ -80,7 +81,7 @@ const VideoUpload = (props) => {
<div > <div >
{ {
props.type_ys ? <div><Button type='primary' onClick={showModal}>新增</Button> props.type_ys ? <div><Button type='primary' onClick={showModal}>新增</Button>
<Modal visible={isModalVisible} onOk={handleOkAdd} onCancel={handleCancel}> <Modal visible={isModalVisible} onOk={handleOkAdd} onCancel={handleCancelEdit} >
<Form <Form
form={form} form={form}
name="basic" name="basic"
@ -123,7 +124,7 @@ const VideoUpload = (props) => {
]} ]}
> >
<Uploads <Uploads
maxFilesNum={10} maxFilesNum={1}
fileTypes={['mp4']} fileTypes={['mp4']}
maxFileSize={200} maxFileSize={200}
/> />
@ -178,9 +179,15 @@ const VideoUpload = (props) => {
<Form.Item <Form.Item
label="选择视频" label="选择视频"
name="video" name="video"
rules={[
{
required: true,
message: '必须上传视频!',
},
]}
> >
<Uploads <Uploads
maxFilesNum={10} maxFilesNum={1}
fileTypes={['mp4']} fileTypes={['mp4']}
maxFileSize={200} maxFileSize={200}
/> />

Loading…
Cancel
Save