|
@@ -45,9 +45,6 @@ function AddBuilding(props) {
|
45
|
45
|
|
46
|
46
|
const [poi, setPoi] = useState([])
|
47
|
47
|
|
48
|
|
- // 视频上传按钮是否 禁用
|
49
|
|
- const [fileUploadDisabled, setFileUploadDisabled] = useState(false)
|
50
|
|
-
|
51
|
48
|
// console.log('props.building: ', props.building)
|
52
|
49
|
const { buildingId } = props.building
|
53
|
50
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -78,8 +75,6 @@ function AddBuilding(props) {
|
78
|
75
|
res.mapCoordinate = res.coordinate
|
79
|
76
|
if (res.videoUrl) {
|
80
|
77
|
res.videoUrl = [].concat(res.videoUrl)
|
81
|
|
- // 视频上传按钮禁用
|
82
|
|
- setFileUploadDisabled(true)
|
83
|
78
|
}
|
84
|
79
|
if (res.videoImage) {
|
85
|
80
|
res.videoImage = res.videoImage[0].url
|
|
@@ -138,11 +133,7 @@ function AddBuilding(props) {
|
138
|
133
|
function fileUploadBeforeUpload(file, fileList) {
|
139
|
134
|
// console.log('视频文件上传前 回调: ', file, fileList)
|
140
|
135
|
return new Promise((resolve, reject) => {
|
141
|
|
- if (fileUploadDisabled) {
|
142
|
|
- openNotificationWithIcon('error', '项目视频,只允许上传一个')
|
143
|
|
- reject()
|
144
|
|
- } else if (file.type === 'video/mp4' || file.type === '.mp4') {
|
145
|
|
- setFileUploadDisabled(true)
|
|
136
|
+ if (file.type === 'video/mp4' || file.type === '.mp4') {
|
146
|
137
|
resolve(file)
|
147
|
138
|
} else {
|
148
|
139
|
openNotificationWithIcon('error', '项目视频,仅支持MP4格式')
|
|
@@ -292,7 +283,7 @@ function AddBuilding(props) {
|
292
|
283
|
<Form.Item label="项目视频" help="视频仅支持mp4格式,建议尺寸:1920*1080,比例16:9">
|
293
|
284
|
{getFieldDecorator('videoUrl')(
|
294
|
285
|
// disabled={fileUploadDisabled}
|
295
|
|
- <FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频" />,
|
|
286
|
+ <FileUpload accept=".mp4" beforeUpload={fileUploadBeforeUpload} label="上传视频" size={1} />,
|
296
|
287
|
)}
|
297
|
288
|
</Form.Item>
|
298
|
289
|
<Form.Item label="视频封面图" help="建议图片尺寸:750*600px,比例5:4,格式:jpg,用于视频封面" >
|