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
6505432b
Commit
6505432b
authored
Oct 12, 2022
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复文件上传组件格式验证问题(I5V32H)
parent
a32a931d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
index.vue
ruoyi-ui/src/components/FileUpload/index.vue
+5
-11
No files found.
ruoyi-ui/src/components/FileUpload/index.vue
View file @
6505432b
...
...
@@ -73,7 +73,7 @@ export default {
number
:
0
,
uploadList
:
[],
baseUrl
:
process
.
env
.
VUE_APP_BASE_API
,
uploadFileUrl
:
process
.
env
.
VUE_APP_BASE_API
+
"/common/upload"
,
// 上传
的图片
服务器地址
uploadFileUrl
:
process
.
env
.
VUE_APP_BASE_API
+
"/common/upload"
,
// 上传
文件
服务器地址
headers
:
{
Authorization
:
"Bearer "
+
getToken
(),
},
...
...
@@ -115,15 +115,9 @@ export default {
handleBeforeUpload
(
file
)
{
// 校检文件类型
if
(
this
.
fileType
)
{
let
fileExtension
=
""
;
if
(
file
.
name
.
lastIndexOf
(
"."
)
>
-
1
)
{
fileExtension
=
file
.
name
.
slice
(
file
.
name
.
lastIndexOf
(
"."
)
+
1
);
}
const
isTypeOk
=
this
.
fileType
.
some
((
type
)
=>
{
if
(
file
.
type
.
indexOf
(
type
)
>
-
1
)
return
true
;
if
(
fileExtension
&&
fileExtension
.
indexOf
(
type
)
>
-
1
)
return
true
;
return
false
;
});
const
fileName
=
file
.
name
.
split
(
'.'
);
const
fileExt
=
fileName
[
fileName
.
length
-
1
];
const
isTypeOk
=
this
.
fileType
.
indexOf
(
fileExt
)
>=
0
;
if
(
!
isTypeOk
)
{
this
.
$modal
.
msgError
(
`文件格式不正确, 请上传
${
this
.
fileType
.
join
(
"/"
)}
格式文件!`
);
return
false
;
...
...
@@ -147,7 +141,7 @@ export default {
},
// 上传失败
handleUploadError
(
err
)
{
this
.
$modal
.
msgError
(
"上传
图片
失败,请重试"
);
this
.
$modal
.
msgError
(
"上传
文件
失败,请重试"
);
this
.
$modal
.
closeLoading
()
},
// 上传成功回调
...
...
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