|
|
@ -1,6 +1,6 @@ |
|
|
|
import React, { useState, useEffect } from 'react'; |
|
|
|
import React, { useState } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Modal, Form, Button, Input, Card, List } from 'antd'; |
|
|
|
import { Modal, Form, Button, Input, Switch } from 'antd'; |
|
|
|
import Uploads from "../../../../components/Upload/index" |
|
|
|
import { putAddPropagata } from '../../actions/infor'; |
|
|
|
import { putEditPropagata } from '../../actions/infor'; |
|
|
@ -8,11 +8,9 @@ import { getPropagata } from '../../actions/infor'; |
|
|
|
|
|
|
|
|
|
|
|
const VideoUpload = (props) => { |
|
|
|
// const [counts, setCounts] = useState()//shuju
|
|
|
|
|
|
|
|
|
|
|
|
const { dispatch, record, counts, setCounts } = props |
|
|
|
const [success, setSuccess] = useState() //状态
|
|
|
|
const [form] = Form.useForm(); |
|
|
|
|
|
|
|
//弹窗
|
|
|
@ -34,7 +32,8 @@ const VideoUpload = (props) => { |
|
|
|
return item.storageUrl |
|
|
|
}) |
|
|
|
const videoname = values.videoname |
|
|
|
const data = { name: videoname, video: videoAddress } |
|
|
|
const enable = values.show |
|
|
|
const data = { name: videoname, video: videoAddress, enable: enable } |
|
|
|
dispatch(putAddPropagata(data)).then(() => { |
|
|
|
dispatch(getPropagata()).then((res) => { |
|
|
|
setCounts(res.payload.data) |
|
|
@ -48,9 +47,6 @@ const VideoUpload = (props) => { |
|
|
|
const handleOkEdit = (record) => { |
|
|
|
|
|
|
|
form.validateFields().then((values) => { |
|
|
|
const videoAddress = values.video.map((item) => { |
|
|
|
return item.storageUrl |
|
|
|
}) |
|
|
|
const videoname = values.username |
|
|
|
const id = record.id |
|
|
|
const video = record.video |
|
|
@ -68,8 +64,6 @@ const VideoUpload = (props) => { |
|
|
|
setIsModalVisible(false); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const handleCancel = () => { |
|
|
|
setIsModalVisible(false); |
|
|
|
}; |
|
|
@ -82,8 +76,6 @@ const VideoUpload = (props) => { |
|
|
|
console.log('Failed:', errorInfo); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
<div > |
|
|
|
{ |
|
|
@ -99,7 +91,7 @@ const VideoUpload = (props) => { |
|
|
|
span: 16, |
|
|
|
}} |
|
|
|
initialValues={{ |
|
|
|
remember: true, |
|
|
|
show: true |
|
|
|
}} |
|
|
|
onFinish={onFinish} |
|
|
|
onFinishFailed={onFinishFailed} |
|
|
@ -123,6 +115,12 @@ const VideoUpload = (props) => { |
|
|
|
<Form.Item |
|
|
|
label="选择视频" |
|
|
|
name="video" |
|
|
|
rules={[ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
message: '必须上传视频!', |
|
|
|
}, |
|
|
|
]} |
|
|
|
> |
|
|
|
<Uploads |
|
|
|
maxFilesNum={10} |
|
|
@ -130,6 +128,12 @@ const VideoUpload = (props) => { |
|
|
|
maxFileSize={200} |
|
|
|
/> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item |
|
|
|
label="是否开启展示" |
|
|
|
name="show" |
|
|
|
> |
|
|
|
<Switch checkedChildren="展示" unCheckedChildren="关闭" defaultChecked={true} /> |
|
|
|
</Form.Item> |
|
|
|
</Form> |
|
|
|
</Modal> |
|
|
|
</div> |
|
|
@ -180,8 +184,6 @@ const VideoUpload = (props) => { |
|
|
|
fileTypes={['mp4']} |
|
|
|
maxFileSize={200} |
|
|
|
/> |
|
|
|
|
|
|
|
|
|
|
|
</Form.Item> |
|
|
|
</Form> |
|
|
|
</Modal> |
|
|
|