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 73a20e83
authored
Jan 05, 2022
by
test
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
朋友圈图片分辨率设置
1 parent
556a23ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
47 deletions
linkwe-ui/src/components/Upload.vue
linkwe-ui/src/views/friendCircle/publish.vue
linkwe-ui/src/components/Upload.vue
View file @
73a20e8
<
script
>
<
script
>
import
{
upload
}
from
'@/api/material'
import
{
upload
}
from
'@/api/material'
import
Video
from
'video.js'
import
Video
from
'video.js'
import
BenzAMRRecorder
from
'benz-amr-recorder'
import
BenzAMRRecorder
from
'benz-amr-recorder'
export
default
{
export
default
{
name
:
'Upload'
,
name
:
'Upload'
,
components
:
{},
components
:
{},
props
:
{
props
:
{
...
@@ -41,7 +41,7 @@ export default {
...
@@ -41,7 +41,7 @@ export default {
// },
// },
// },
// },
},
},
data
()
{
data
()
{
return
{
return
{
loading
:
false
,
loading
:
false
,
action
:
process
.
env
.
VUE_APP_BASE_API
+
'/common/uploadFile2Cos'
,
action
:
process
.
env
.
VUE_APP_BASE_API
+
'/common/uploadFile2Cos'
,
...
@@ -54,14 +54,14 @@ export default {
...
@@ -54,14 +54,14 @@ export default {
},
},
watch
:
{},
watch
:
{},
computed
:
{
computed
:
{
accept
()
{
accept
()
{
return
[
'image/*'
,
'amr/*'
,
'video/*'
,
'*'
][
this
.
type
]
return
[
'image/*'
,
'amr/*'
,
'video/*'
,
'*'
][
this
.
type
]
}
}
},
},
created
()
{
},
created
()
{
},
mounted
()
{
},
mounted
()
{
},
methods
:
{
methods
:
{
async
handleBeforeUpload
(
file
)
{
async
handleBeforeUpload
(
file
)
{
this
.
loading
=
true
this
.
loading
=
true
let
isFormat
=
true
let
isFormat
=
true
let
isSize
=
true
let
isSize
=
true
...
@@ -112,7 +112,7 @@ export default {
...
@@ -112,7 +112,7 @@ export default {
image
.
src
=
url
image
.
src
=
url
}
else
if
(
window
.
FileReader
)
{
}
else
if
(
window
.
FileReader
)
{
let
reader
=
new
FileReader
()
let
reader
=
new
FileReader
()
reader
.
onload
=
function
(
e
)
{
reader
.
onload
=
function
(
e
)
{
let
data
=
e
.
target
.
result
let
data
=
e
.
target
.
result
image
.
src
=
data
image
.
src
=
data
}
}
...
@@ -173,7 +173,7 @@ export default {
...
@@ -173,7 +173,7 @@ export default {
// }
// }
return
(
isFormat
&&
isSize
)
||
Promise
.
reject
()
return
(
isFormat
&&
isSize
)
||
Promise
.
reject
()
},
},
onSuccess
(
res
,
file
)
{
onSuccess
(
res
,
file
)
{
if
(
res
.
code
===
200
)
{
if
(
res
.
code
===
200
)
{
this
.
loading
=
false
this
.
loading
=
false
// this.$emit('update:fileUrl', res.data.materialUrl)
// this.$emit('update:fileUrl', res.data.materialUrl)
...
@@ -192,44 +192,23 @@ export default {
...
@@ -192,44 +192,23 @@ export default {
this
.
$message
.
error
(
res
.
msg
)
this
.
$message
.
error
(
res
.
msg
)
}
}
},
},
onError
(
err
,
file
,
fileList
)
{
onError
(
err
,
file
,
fileList
)
{
this
.
loading
=
false
this
.
loading
=
false
this
.
$message
.
error
(
'上传文件失败'
)
this
.
$message
.
error
(
'上传文件失败'
)
}
}
}
}
}
}
</
script
>
</
script
>
<
template
>
<
template
>
<div>
<div>
<el-upload
<el-upload
v-loading=
"loading"
element-loading-text=
"正在上传..."
class=
"uploader"
:accept=
"accept"
:action=
"action"
:headers=
"headers"
:data=
"
{ mediaType: type }" :show-file-list="false" :on-success="onSuccess" :on-error="onError" :before-upload="handleBeforeUpload">
v-loading=
"loading"
element-loading-text=
"正在上传..."
class=
"uploader"
:accept=
"accept"
:action=
"action"
:headers=
"headers"
:data=
"
{ mediaType: type }"
:show-file-list="false"
:on-success="onSuccess"
:on-error="onError"
:before-upload="handleBeforeUpload"
>
<slot>
<slot>
<template
v-if=
"fileUrl"
>
<template
v-if=
"fileUrl"
>
<img
v-if=
"type === '0'"
:src=
"fileUrl"
class=
"upload-img"
/>
<img
v-if=
"type === '0'"
:src=
"fileUrl"
class=
"upload-img"
/>
<div
v-else-if=
"type === '2'"
>
<div
v-else-if=
"type === '2'"
>
<video
<video
id=
"myVideo"
class=
"video-js vjs-default-skin
id=
"myVideo"
vjs-big-play-centered"
width=
"100%"
controls
webkit-playsinline=
"true"
playsinline=
"true"
:autoplay=
"false"
preload=
"auto"
>
class=
"video-js vjs-default-skin
vjs-big-play-centered"
width=
"100%"
controls
webkit-playsinline=
"true"
playsinline=
"true"
:autoplay=
"false"
preload=
"auto"
>
<source
:src=
"fileUrl"
type=
"video/mp4"
/>
<source
:src=
"fileUrl"
type=
"video/mp4"
/>
</video>
</video>
</div>
</div>
...
@@ -245,7 +224,7 @@ export default {
...
@@ -245,7 +224,7 @@ export default {
</template>
</template>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
/
deep
/
.uploader
{
/
deep
/
.uploader
{
display
:
inline-block
;
display
:
inline-block
;
.el-upload
{
.el-upload
{
border-radius
:
6px
;
border-radius
:
6px
;
...
@@ -256,9 +235,9 @@ export default {
...
@@ -256,9 +235,9 @@ export default {
border-color
:
#409eff
;
border-color
:
#409eff
;
}
}
}
}
}
}
.uploader-icon
{
.uploader-icon
{
font-size
:
28px
;
font-size
:
28px
;
color
:
#8c939d
;
color
:
#8c939d
;
width
:
178px
;
width
:
178px
;
...
@@ -267,14 +246,14 @@ export default {
...
@@ -267,14 +246,14 @@ export default {
text-align
:
center
;
text-align
:
center
;
border-radius
:
6px
;
border-radius
:
6px
;
border
:
1px
dashed
#d9d9d9
;
border
:
1px
dashed
#d9d9d9
;
}
}
.upload-img
{
.upload-img
{
width
:
178px
;
width
:
178px
;
height
:
178px
;
height
:
178px
;
display
:
block
;
display
:
block
;
}
}
.tip
{
.tip
{
color
:
#aaa
;
color
:
#aaa
;
font-size
:
12px
;
font-size
:
12px
;
}
}
</
style
>
</
style
>
linkwe-ui/src/views/friendCircle/publish.vue
View file @
73a20e8
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
</div>
</div>
</div>
</div>
<el-form-item
label=
"图片上传"
required
:error=
"item.contentError"
>
<el-form-item
label=
"图片上传"
required
:error=
"item.contentError"
>
<upload
class=
"image-uploader"
:fileUrl
.
sync=
"item.annexUrl"
type=
"0"
></upload>
<upload
:maxImgPx=
"limit"
class=
"image-uploader"
:fileUrl
.
sync=
"item.annexUrl"
type=
"0"
></upload>
</el-form-item>
</el-form-item>
</div>
</div>
<!-- 图文 -->
<!-- 图文 -->
...
@@ -131,7 +131,8 @@
...
@@ -131,7 +131,8 @@
selectedUserList
:
[],
selectedUserList
:
[],
dialogVisibleSelectUser
:
false
,
dialogVisibleSelectUser
:
false
,
dialogVisibleSelectTag
:
false
,
dialogVisibleSelectTag
:
false
,
selectedTagList
:
[]
selectedTagList
:
[],
limit
:
[
1440
,
1080
]
}
}
},
},
mounted
()
{
mounted
()
{
...
...
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