Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 556a23ed
authored
Jan 04, 2022
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
--no commit message
1 parent
769453ca
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
27 deletions
linkwe-ui/src/components/Upload.vue
linkwe-ui/src/components/Upload.vue
View file @
556a23e
...
...
@@ -89,35 +89,39 @@ export default {
}
if
(
this
.
maxImgPx
)
{
await
new
Promise
((
resolve
)
=>
{
let
width
,
height
let
image
=
new
Image
()
//加载图片获取图片真实宽度和高度
image
.
onload
=
()
=>
{
width
=
image
.
width
height
=
image
.
height
if
(
width
>
this
.
maxImgPx
[
0
])
{
isSize
=
false
this
.
$message
.
error
(
'图片“宽”度超限,请重新选择'
)
}
else
if
(
height
>
this
.
maxImgPx
[
1
])
{
this
.
$message
.
error
(
'图片“高”度超限,请重新选择'
)
isSize
=
false
try
{
await
new
Promise
((
resolve
)
=>
{
let
width
,
height
let
image
=
new
Image
()
//加载图片获取图片真实宽度和高度
image
.
onload
=
()
=>
{
width
=
image
.
width
height
=
image
.
height
if
(
width
>
this
.
maxImgPx
[
0
])
{
isSize
=
false
this
.
$message
.
error
(
'图片“宽”度超限,请重新选择'
)
}
else
if
(
height
>
this
.
maxImgPx
[
1
])
{
this
.
$message
.
error
(
'图片“高”度超限,请重新选择'
)
isSize
=
false
}
window
.
URL
&&
window
.
URL
.
revokeObjectURL
(
image
.
src
)
resolve
()
}
window
.
URL
&&
window
.
URL
.
revokeObjectURL
(
image
.
src
)
resolve
()
}
if
(
window
.
URL
)
{
url
=
window
.
URL
.
createObjectURL
(
file
)
image
.
src
=
url
}
else
if
(
window
.
FileReader
)
{
let
reader
=
new
FileReader
()
reader
.
onload
=
function
(
e
)
{
let
data
=
e
.
target
.
result
image
.
src
=
data
if
(
window
.
URL
)
{
let
url
=
window
.
URL
.
createObjectURL
(
file
)
image
.
src
=
url
}
else
if
(
window
.
FileReader
)
{
let
reader
=
new
FileReader
()
reader
.
onload
=
function
(
e
)
{
let
data
=
e
.
target
.
result
image
.
src
=
data
}
reader
.
readAsDataURL
(
file
)
}
reader
.
readAsDataURL
(
file
)
}
})
})
}
catch
(
e
)
{
console
.
error
(
e
)
}
}
}
else
if
(
this
.
type
===
'1'
)
{
// 语音
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment