Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
91ae9a16
Commit
91ae9a16
authored
Nov 05, 2024
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
校检文件名是否包含特殊字符
parent
d3326987
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
index.vue
ruoyi-ui/src/components/FileUpload/index.vue
+6
-1
index.vue
ruoyi-ui/src/components/ImageUpload/index.vue
+5
-1
No files found.
ruoyi-ui/src/components/FileUpload/index.vue
View file @
91ae9a16
...
@@ -119,10 +119,15 @@ export default {
...
@@ -119,10 +119,15 @@ export default {
const
fileExt
=
fileName
[
fileName
.
length
-
1
];
const
fileExt
=
fileName
[
fileName
.
length
-
1
];
const
isTypeOk
=
this
.
fileType
.
indexOf
(
fileExt
)
>=
0
;
const
isTypeOk
=
this
.
fileType
.
indexOf
(
fileExt
)
>=
0
;
if
(
!
isTypeOk
)
{
if
(
!
isTypeOk
)
{
this
.
$modal
.
msgError
(
`文件格式不正确
,
请上传
${
this
.
fileType
.
join
(
"/"
)}
格式文件!`
);
this
.
$modal
.
msgError
(
`文件格式不正确
,
请上传
${
this
.
fileType
.
join
(
"/"
)}
格式文件!`
);
return
false
;
return
false
;
}
}
}
}
// 校检文件名是否包含特殊字符
if
(
file
.
name
.
includes
(
','
))
{
this
.
$modal
.
msgError
(
'文件名不正确,不能包含英文逗号!'
);
return
false
;
}
// 校检文件大小
// 校检文件大小
if
(
this
.
fileSize
)
{
if
(
this
.
fileSize
)
{
const
isLt
=
file
.
size
/
1024
/
1024
<
this
.
fileSize
;
const
isLt
=
file
.
size
/
1024
/
1024
<
this
.
fileSize
;
...
...
ruoyi-ui/src/components/ImageUpload/index.vue
View file @
91ae9a16
...
@@ -136,7 +136,11 @@ export default {
...
@@ -136,7 +136,11 @@ export default {
}
}
if
(
!
isImg
)
{
if
(
!
isImg
)
{
this
.
$modal
.
msgError
(
`文件格式不正确, 请上传
${
this
.
fileType
.
join
(
"/"
)}
图片格式文件!`
);
this
.
$modal
.
msgError
(
`文件格式不正确,请上传
${
this
.
fileType
.
join
(
"/"
)}
图片格式文件!`
);
return
false
;
}
if
(
file
.
name
.
includes
(
','
))
{
this
.
$modal
.
msgError
(
'文件名不正确,不能包含英文逗号!'
);
return
false
;
return
false
;
}
}
if
(
this
.
fileSize
)
{
if
(
this
.
fileSize
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment