Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6e9fbd6b
authored
Jan 14, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整消息机制,调整图片显示机制
parent
6711c5df
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
22 deletions
components/image-preview.vue
components/message-item/image-message.vue
store/index.ts
components/image-preview.vue
View file @
6e9fbd6b
...
...
@@ -4,20 +4,20 @@
:before-close=
"close"
:visible=
"value"
:show-close=
"false"
custom-class=
"transparent"
custom-class=
"transparent
flex
"
width=
"90%"
top=
"60px"
>
<div
class=
"d-flex flex-column"
>
<div
class=
"d-flex justify-content-center align-items-start"
>
<img
v-if=
"file"
:src=
"file.url"
/>
<img
v-if=
"file"
:src=
"file.url"
:style=
"imgStyle"
/>
<i
class=
"el-icon-close"
@
click=
"close"
></i>
</div>
<div
class=
"d-flex justify-content-center actions"
>
<a
class=
"d-flex align-items-center justify-content-center"
:href=
"file.url"
:download=
"getAttachment"
target=
"_blank"
>
<i
class=
"el-icon-download"
></i>
</a>
...
...
@@ -37,6 +37,13 @@
@
Prop
()
private
file
!
:
{
name
:
string
;
url
:
string
};
private
get
imgStyle
()
{
return
{
"max-width"
:
`
${
document
.
body
.
scrollWidth
*
0.8
}
px`
,
"max-height"
:
`
${
document
.
body
.
scrollHeight
*
0.8
}
px`
,
};
}
private
close
()
{
this
.
$emit
(
"update"
,
false
);
}
...
...
@@ -70,25 +77,19 @@
}
}
.actions
{
margin
:
15px
0
;
a
{
padding
:
10px
;
background-color
:
#7a7b7d
;
border-radius
:
50%
;
position
:
absolute
;
left
:
50%
;
bottom
:
-65px
;
margin-left
:
-50px
;
a
{
width
:
50px
;
height
:
50px
;
background-color
:
#7a7b7d
;
i
{
color
:
#fff
;
border-radius
:
50%
;
font-size
:
30px
;
cursor
:
pointer
;
i
{
color
:
#fff
;
font-size
:
30px
;
}
&
+
span
{
margin-left
:
15px
;
}
}
}
</
style
>
components/message-item/image-message.vue
View file @
6e9fbd6b
...
...
@@ -6,8 +6,8 @@
@click="open"
>
<img
v-if=
"m
essageRealUrl
"
:src=
"m
essageRealUrl
"
v-if=
"m
ini
"
:src=
"m
ini
"
:title=
"messageBody.msg.name"
:alt=
"messageBody.msg.name"
@
error=
"onImageError"
...
...
@@ -22,6 +22,7 @@
import
BaseMessage
from
"./index"
;
import
FileIcon
from
"./file-icon.vue"
;
import
{
UserAgentHelper
}
from
"@/customer-service/third-party/user-agent"
;
import
Chat
from
"@/customer-service/xim/"
;
@
Component
({
components
:
{
FileIcon
}
})
export
default
class
Index
extends
BaseMessage
{
...
...
@@ -31,6 +32,21 @@
window
.
navigator
.
userAgent
);
private
get
mini
()
{
if
(
this
.
messageRealUrl
)
{
const
sdk
=
Chat
.
getSdk
();
const
s
=
sdk
.
mediaController
.
buildThumbnail
;
if
(
this
.
messageRealUrl
.
startsWith
(
"http"
))
{
return
(
sdk
.
global
.
baseUrl
+
s
(
this
.
messageRealUrl
.
replace
(
sdk
.
global
.
baseUrl
,
""
),
300
)
);
}
return
s
(
this
.
messageRealUrl
,
300
);
}
return
""
;
}
private
onImageError
()
{
this
.
fileFailed2Load
=
true
;
this
.
messageRealUrl
=
""
;
...
...
store/index.ts
View file @
6e9fbd6b
This diff is collapsed.
Click to expand it.
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