1
1
import React , { useState , useEffect , useMemo } from 'react'
2
- import { Form , Input , Modal } from 'antd'
2
+ import { Form , Input , message , Modal } from 'antd'
3
3
import { EllipsisOutlined } from '@ant-design/icons'
4
4
5
5
import {
@@ -39,6 +39,11 @@ const CreateModal = ({ show, onClose }: CreateModalProps) => {
39
39
40
40
// 下载开始
41
41
const handleOk = async ( ) => {
42
+ if ( ! / ^ ( h t t p ( s ? ) | f t p | b l o b ) : | d a t a : .* ; b a s e 6 4 / . test ( formData . url ) ) {
43
+ message . error ( '下载地址只支持 http、ftp、base64、blob 协议' )
44
+ return
45
+ }
46
+
42
47
const item = await newDownloadFile ( formData )
43
48
if ( ! item ) return
44
49
@@ -104,6 +109,7 @@ const CreateModal = ({ show, onClose }: CreateModalProps) => {
104
109
< Form labelCol = { { span : 3 } } >
105
110
< Form . Item label = '地址:' >
106
111
< Input
112
+ placeholder = '支持 http、ftp、base64、blob 协议'
107
113
value = { formData ?. url }
108
114
onChange = { e => handleFormChange ( 'url' , e . target . value ) }
109
115
onFocus = { handleFocus }
@@ -112,7 +118,7 @@ const CreateModal = ({ show, onClose }: CreateModalProps) => {
112
118
< Form . Item label = '文件名:' >
113
119
< Input
114
120
value = { formData ?. fileName }
115
- onChange = { e => handleFormChange ( 'filename ' , e . target . value ) }
121
+ onChange = { e => handleFormChange ( 'fileName ' , e . target . value ) }
116
122
onFocus = { handleFocus }
117
123
/>
118
124
</ Form . Item >
0 commit comments