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 @@
...
@@ -4,20 +4,20 @@
:before-close=
"close"
:before-close=
"close"
:visible=
"value"
:visible=
"value"
:show-close=
"false"
:show-close=
"false"
custom-class=
"transparent"
custom-class=
"transparent
flex
"
width=
"90%"
width=
"90%"
top=
"60px"
>
>
<div
class=
"d-flex flex-column"
>
<div
class=
"d-flex flex-column"
>
<div
class=
"d-flex justify-content-center align-items-start"
>
<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>
<i
class=
"el-icon-close"
@
click=
"close"
></i>
</div>
<div
class=
"d-flex justify-content-center actions"
>
<a
<a
class=
"d-flex align-items-center justify-content-center"
class=
"d-flex align-items-center justify-content-center"
:href=
"file.url"
:href=
"file.url"
:download=
"getAttachment"
:download=
"getAttachment"
target=
"_blank"
>
>
<i
class=
"el-icon-download"
></i>
<i
class=
"el-icon-download"
></i>
</a>
</a>
...
@@ -37,6 +37,13 @@
...
@@ -37,6 +37,13 @@
@
Prop
()
@
Prop
()
private
file
!
:
{
name
:
string
;
url
:
string
};
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
()
{
private
close
()
{
this
.
$emit
(
"update"
,
false
);
this
.
$emit
(
"update"
,
false
);
}
}
...
@@ -70,25 +77,19 @@
...
@@ -70,25 +77,19 @@
}
}
}
}
.actions
{
a
{
margin
:
15px
0
;
padding
:
10px
;
background-color
:
#7a7b7d
;
border-radius
:
50%
;
position
:
absolute
;
left
:
50%
;
bottom
:
-65px
;
margin-left
:
-50px
;
a
{
i
{
width
:
50px
;
height
:
50px
;
background-color
:
#7a7b7d
;
color
:
#fff
;
color
:
#fff
;
border-radius
:
50%
;
font-size
:
30px
;
cursor
:
pointer
;
cursor
:
pointer
;
i
{
color
:
#fff
;
font-size
:
30px
;
}
&
+
span
{
margin-left
:
15px
;
}
}
}
}
}
</
style
>
</
style
>
components/message-item/image-message.vue
View file @
6e9fbd6b
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
@click="open"
@click="open"
>
>
<img
<img
v-if=
"m
essageRealUrl
"
v-if=
"m
ini
"
:src=
"m
essageRealUrl
"
:src=
"m
ini
"
:title=
"messageBody.msg.name"
:title=
"messageBody.msg.name"
:alt=
"messageBody.msg.name"
:alt=
"messageBody.msg.name"
@
error=
"onImageError"
@
error=
"onImageError"
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
import
BaseMessage
from
"./index"
;
import
BaseMessage
from
"./index"
;
import
FileIcon
from
"./file-icon.vue"
;
import
FileIcon
from
"./file-icon.vue"
;
import
{
UserAgentHelper
}
from
"@/customer-service/third-party/user-agent"
;
import
{
UserAgentHelper
}
from
"@/customer-service/third-party/user-agent"
;
import
Chat
from
"@/customer-service/xim/"
;
@
Component
({
components
:
{
FileIcon
}
})
@
Component
({
components
:
{
FileIcon
}
})
export
default
class
Index
extends
BaseMessage
{
export
default
class
Index
extends
BaseMessage
{
...
@@ -31,6 +32,21 @@
...
@@ -31,6 +32,21 @@
window
.
navigator
.
userAgent
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
()
{
private
onImageError
()
{
this
.
fileFailed2Load
=
true
;
this
.
fileFailed2Load
=
true
;
this
.
messageRealUrl
=
""
;
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