Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-manage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
finance-oa
finance-manage
Commits
6505432b
Commit
6505432b
authored
Oct 12, 2022
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复文件上传组件格式验证问题(I5V32H)
parent
a32a931d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
11 deletions
+5
-11
ruoyi-ui/src/components/FileUpload/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 {
...
@@ -73,7 +73,7 @@ export default {
number
:
0
,
number
:
0
,
uploadList
:
[],
uploadList
:
[],
baseUrl
:
process
.
env
.
VUE_APP_BASE_API
,
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
:
{
headers
:
{
Authorization
:
"
Bearer
"
+
getToken
(),
Authorization
:
"
Bearer
"
+
getToken
(),
},
},
...
@@ -115,15 +115,9 @@ export default {
...
@@ -115,15 +115,9 @@ export default {
handleBeforeUpload
(
file
)
{
handleBeforeUpload
(
file
)
{
// 校检文件类型
// 校检文件类型
if
(
this
.
fileType
)
{
if
(
this
.
fileType
)
{
let
fileExtension
=
""
;
const
fileName
=
file
.
name
.
split
(
'
.
'
);
if
(
file
.
name
.
lastIndexOf
(
"
.
"
)
>
-
1
)
{
const
fileExt
=
fileName
[
fileName
.
length
-
1
];
fileExtension
=
file
.
name
.
slice
(
file
.
name
.
lastIndexOf
(
"
.
"
)
+
1
);
const
isTypeOk
=
this
.
fileType
.
indexOf
(
fileExt
)
>=
0
;
}
const
isTypeOk
=
this
.
fileType
.
some
((
type
)
=>
{
if
(
file
.
type
.
indexOf
(
type
)
>
-
1
)
return
true
;
if
(
fileExtension
&&
fileExtension
.
indexOf
(
type
)
>
-
1
)
return
true
;
return
false
;
});
if
(
!
isTypeOk
)
{
if
(
!
isTypeOk
)
{
this
.
$modal
.
msgError
(
`文件格式不正确, 请上传
${
this
.
fileType
.
join
(
"
/
"
)}
格式文件!`
);
this
.
$modal
.
msgError
(
`文件格式不正确, 请上传
${
this
.
fileType
.
join
(
"
/
"
)}
格式文件!`
);
return
false
;
return
false
;
...
@@ -147,7 +141,7 @@ export default {
...
@@ -147,7 +141,7 @@ export default {
},
},
// 上传失败
// 上传失败
handleUploadError
(
err
)
{
handleUploadError
(
err
)
{
this
.
$modal
.
msgError
(
"
上传
图片
失败,请重试
"
);
this
.
$modal
.
msgError
(
"
上传
文件
失败,请重试
"
);
this
.
$modal
.
closeLoading
()
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