|
@ -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} |
|
|
/> |
|
|
/> |
|
|