Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pet-business-web
Project
Project
Details
Activity
Releases
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
刘怀志
pet-business-web
Commits
ff9c1088
Commit
ff9c1088
authored
Oct 08, 2023
by
刘怀志
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
68383 兽医管理,上传证书图片问题
parent
0a97aad2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
imgUploadForBanner.vue
src/components/ImageUpload/imgUploadForBanner.vue
+9
-3
index.vue
src/components/ImageUpload/index.vue
+9
-3
No files found.
src/components/ImageUpload/imgUploadForBanner.vue
View file @
ff9c1088
...
@@ -208,14 +208,18 @@ export default {
...
@@ -208,14 +208,18 @@ export default {
const
suffix
=
img
===
'jpg'
||
img
===
'png'
||
img
===
'jpeg'
const
suffix
=
img
===
'jpg'
||
img
===
'png'
||
img
===
'jpeg'
if
(
!
suffix
)
{
if
(
!
suffix
)
{
this
.
$message
.
error
(
'文件格式不正确, 请上传png/jpg/jpeg图片格式文件'
)
this
.
$message
.
error
(
'文件格式不正确, 请上传png/jpg/jpeg图片格式文件'
)
this
.
$refs
.
imageUpload
.
clearFiles
()
// this.$refs.imageUpload.clearFiles()
const
arrayLength
=
this
.
fileList
.
length
this
.
fileList
=
arrayLength
>
0
?
[...
this
.
fileList
]
:
[]
return
false
return
false
}
}
if
(
this
.
fileSize
)
{
if
(
this
.
fileSize
)
{
const
isLt
=
file
.
size
/
1024
/
1024
<
this
.
fileSize
const
isLt
=
file
.
size
/
1024
/
1024
<
this
.
fileSize
if
(
!
isLt
)
{
if
(
!
isLt
)
{
this
.
$modal
.
msgError
(
`上传图片大小不能超过
${
this
.
fileSize
}
MB`
)
this
.
$modal
.
msgError
(
`上传图片大小不能超过
${
this
.
fileSize
}
MB`
)
this
.
$refs
.
imageUpload
.
clearFiles
()
// this.$refs.imageUpload.clearFiles()
const
arrayLength
=
this
.
fileList
.
length
this
.
fileList
=
arrayLength
>
0
?
[...
this
.
fileList
]
:
[]
return
false
return
false
}
}
}
}
...
@@ -223,7 +227,9 @@ export default {
...
@@ -223,7 +227,9 @@ export default {
console
.
log
(
'nameTest'
,
!
nameTest
.
test
(
fileName
))
console
.
log
(
'nameTest'
,
!
nameTest
.
test
(
fileName
))
if
(
!
nameTest
.
test
(
fileName
))
{
if
(
!
nameTest
.
test
(
fileName
))
{
this
.
$modal
.
msgError
(
'不能含有~!@#$^&()_+-[]{};
\'
,.等特殊字符'
)
this
.
$modal
.
msgError
(
'不能含有~!@#$^&()_+-[]{};
\'
,.等特殊字符'
)
this
.
$refs
.
imageUpload
.
clearFiles
()
// this.$refs.imageUpload.clearFiles()
const
arrayLength
=
this
.
fileList
.
length
this
.
fileList
=
arrayLength
>
0
?
[...
this
.
fileList
]
:
[]
return
false
return
false
}
}
// URL.createObjectURL的参数只能是blob或者file类型
// URL.createObjectURL的参数只能是blob或者file类型
...
...
src/components/ImageUpload/index.vue
View file @
ff9c1088
...
@@ -209,14 +209,18 @@ export default {
...
@@ -209,14 +209,18 @@ export default {
const
suffix
=
img
===
'jpg'
||
img
===
'png'
||
img
===
'jpeg'
const
suffix
=
img
===
'jpg'
||
img
===
'png'
||
img
===
'jpeg'
if
(
!
suffix
)
{
if
(
!
suffix
)
{
this
.
$message
.
error
(
'文件格式不正确, 请上传png/jpg/jpeg图片格式文件'
)
this
.
$message
.
error
(
'文件格式不正确, 请上传png/jpg/jpeg图片格式文件'
)
this
.
$refs
.
imageUpload
.
clearFiles
()
// this.$refs.imageUpload.clearFiles()
const
arrayLength
=
this
.
fileList
.
length
this
.
fileList
=
arrayLength
>
0
?
[...
this
.
fileList
]
:
[]
return
false
return
false
}
}
if
(
this
.
fileSize
)
{
if
(
this
.
fileSize
)
{
const
isLt
=
file
.
size
/
1024
/
1024
<
this
.
fileSize
const
isLt
=
file
.
size
/
1024
/
1024
<
this
.
fileSize
if
(
!
isLt
)
{
if
(
!
isLt
)
{
this
.
$modal
.
msgError
(
`上传图片大小不能超过
${
this
.
fileSize
}
MB`
)
this
.
$modal
.
msgError
(
`上传图片大小不能超过
${
this
.
fileSize
}
MB`
)
this
.
$refs
.
imageUpload
.
clearFiles
()
// this.$refs.imageUpload.clearFiles()
const
arrayLength
=
this
.
fileList
.
length
this
.
fileList
=
arrayLength
>
0
?
[...
this
.
fileList
]
:
[]
return
false
return
false
}
}
}
}
...
@@ -224,7 +228,9 @@ export default {
...
@@ -224,7 +228,9 @@ export default {
console
.
log
(
'nameTest'
,
!
nameTest
.
test
(
fileName
))
console
.
log
(
'nameTest'
,
!
nameTest
.
test
(
fileName
))
if
(
!
nameTest
.
test
(
fileName
))
{
if
(
!
nameTest
.
test
(
fileName
))
{
this
.
$modal
.
msgError
(
'不能含有~!@#$^&()_+-[]{};
\'
,.等特殊字符'
)
this
.
$modal
.
msgError
(
'不能含有~!@#$^&()_+-[]{};
\'
,.等特殊字符'
)
this
.
$refs
.
imageUpload
.
clearFiles
()
// this.$refs.imageUpload.clearFiles()
const
arrayLength
=
this
.
fileList
.
length
this
.
fileList
=
arrayLength
>
0
?
[...
this
.
fileList
]
:
[]
return
false
return
false
}
}
// URL.createObjectURL的参数只能是blob或者file类型
// URL.createObjectURL的参数只能是blob或者file类型
...
...
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