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
2b02de5c
authored
Jul 16, 2021
by
panjiangyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
成员名字
parent
803da04e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
35 deletions
components/message.vue
store/index.ts
utils/user-info.ts
components/message.vue
View file @
2b02de5c
<
template
>
<
template
>
<div
<div
class=
"message-con d-flex"
class=
"message-con d-flex align-items-center"
:class=
"
:class=
"isMyMessage ? 'my-message flex-row-reverse' : ''"
isMyMessage
? 'my-message align-items-start flex-row-reverse'
: 'align-items-start'
"
>
>
<span
class=
"no-selection"
>
<avatar
:size=
"40"
class=
"msg-avatar"
:shape=
"shape"
:src=
"avatar"
/>
</span>
<div
class=
"msg-content"
>
<div
class=
"msg-content"
>
<div
class=
"msg-name no-selection"
>
{{
usern
ame
}}
</div>
<div
class=
"msg-name no-selection"
>
{{
senderN
ame
}}
</div>
<!-- Image -->
<!-- Image -->
<div
<div
class=
"msg-detail image-message"
class=
"msg-detail image-message"
...
@@ -26,7 +18,10 @@
...
@@ -26,7 +18,10 @@
:title=
"messageBody.msg.name"
:title=
"messageBody.msg.name"
:alt=
"messageBody.msg.name"
:alt=
"messageBody.msg.name"
/>
/>
<file-icon
v-else-if=
"fileFailed2Load"
:value=
"image404"
></file-icon>
<file-icon
v-else-if=
"fileFailed2Load"
:value=
"image404"
></file-icon>
</div>
</div>
<!-- File -->
<!-- File -->
<div
<div
...
@@ -107,7 +102,11 @@
...
@@ -107,7 +102,11 @@
<img
src=
"~@/customer-service/imgs/download.png"
alt=
"Download"
/>
<img
src=
"~@/customer-service/imgs/download.png"
alt=
"Download"
/>
</a>
</a>
<i
class=
"el-icon-warning text-danger"
v-if=
"failed"
title=
"发送失败"
></i>
<i
class=
"el-icon-warning text-danger"
v-if=
"failed"
title=
"发送失败"
></i>
<i
class=
"el-icon-loading"
v-else-if=
"isSendingMessage"
></i>
<i
class=
"el-icon-loading"
v-else-if=
"isSendingMessage"
></i>
<template
v-if=
"showReadSummary"
>
<template
v-if=
"showReadSummary"
>
...
@@ -132,10 +131,11 @@
...
@@ -132,10 +131,11 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Component
,
Inject
,
Mixins
,
Prop
,
Ref
}
from
"vue-property-decorator"
;
import
{
Component
,
Inject
,
Mixins
,
Prop
,
Ref
}
from
"vue-property-decorator"
;
import
{
Filters
}
from
'../mixin/filter'
;
import
{
Filters
}
from
"../mixin/filter"
;
import
*
as
dto
from
"../model"
;
import
*
as
dto
from
"../model"
;
import
{
isAccessibleUrl
}
from
"../service/tools"
;
import
{
isAccessibleUrl
}
from
"../service/tools"
;
import
{
replaceText2Link
}
from
"../utils"
;
import
{
replaceText2Link
}
from
"../utils"
;
import
{
getUserInfo
}
from
"../utils/user-info"
;
import
chat
from
"./../xim"
;
import
chat
from
"./../xim"
;
import
{
import
{
...
@@ -178,6 +178,7 @@ export default class Message extends Mixins(Filters) {
...
@@ -178,6 +178,7 @@ export default class Message extends Mixins(Filters) {
private
fileFailed2Load
=
false
;
private
fileFailed2Load
=
false
;
private
image404
=
FileType
.
Image_404
;
private
image404
=
FileType
.
Image_404
;
private
loadingRealUrl
=
false
;
private
loadingRealUrl
=
false
;
private
senderName
=
""
;
@
Prop
({
type
:
Object
,
default
:
()
=>
Object
.
create
(
null
)
})
@
Prop
({
type
:
Object
,
default
:
()
=>
Object
.
create
(
null
)
})
private
data
!
:
dto
.
Message
;
private
data
!
:
dto
.
Message
;
...
@@ -243,7 +244,8 @@ export default class Message extends Mixins(Filters) {
...
@@ -243,7 +244,8 @@ export default class Message extends Mixins(Filters) {
const
source
=
msg
.
msg
.
source
;
const
source
=
msg
.
msg
.
source
;
if
(
source
)
{
if
(
source
)
{
return
(
return
(
source
===
this
.
chatSource
&&
senderEid
===
this
.
chatMyId
source
===
this
.
chatSource
&&
senderEid
===
this
.
chatMyId
);
);
}
}
...
@@ -263,14 +265,13 @@ export default class Message extends Mixins(Filters) {
...
@@ -263,14 +265,13 @@ export default class Message extends Mixins(Filters) {
return
false
;
return
false
;
}
}
private
get
username
()
{
public
created
()
{
const
avatar
:
any
=
chat
.
getUserMapping
();
this
.
getUserName
(
this
.
data
.
eid
);
if
(
this
.
data
==
null
)
return
""
;
}
if
(
avatar
==
null
)
return
this
.
data
.
id
;
const
value
=
avatar
[
this
.
data
.
eid
];
private
async
getUserName
(
eid
:
string
)
{
if
(
value
==
null
)
return
""
;
const
data
=
await
getUserInfo
(
eid
);
if
(
value
.
name
==
null
)
return
""
;
this
.
senderName
=
data
.
name
;
return
value
.
name
;
}
}
private
get
avatar
()
{
private
get
avatar
()
{
...
@@ -444,10 +445,6 @@ export default class Message extends Mixins(Filters) {
...
@@ -444,10 +445,6 @@ export default class Message extends Mixins(Filters) {
margin-left
:
10px
;
margin-left
:
10px
;
}
}
.msg-name
{
display
:
none
;
}
.msg-detail
{
.msg-detail
{
margin-top
:
0
;
margin-top
:
0
;
background-color
:
#dbf2ff
;
background-color
:
#dbf2ff
;
...
@@ -519,8 +516,10 @@ i.msg-avatar {
...
@@ -519,8 +516,10 @@ i.msg-avatar {
}
}
.msg-name
{
.msg-name
{
font-size
:
12
px
;
font-size
:
14
px
;
color
:
#888
;
color
:
#888
;
text-align
:
right
;
margin-bottom
:
3px
;
}
}
.msg-detail
{
.msg-detail
{
...
...
store/index.ts
View file @
2b02de5c
...
@@ -5,6 +5,7 @@ import { ChatMember } from "../model";
...
@@ -5,6 +5,7 @@ import { ChatMember } from "../model";
import
{
isAccessibleUrl
}
from
"../service/tools"
;
import
{
isAccessibleUrl
}
from
"../service/tools"
;
import
{
unique
}
from
"../utils"
;
import
{
unique
}
from
"../utils"
;
import
{
decode
}
from
"../utils/jwt"
;
import
{
decode
}
from
"../utils/jwt"
;
import
{
getUserInfo
}
from
"../utils/user-info"
;
import
Chat
from
"../xim"
;
import
Chat
from
"../xim"
;
import
chatType
from
"../xim/chat-type"
;
import
chatType
from
"../xim/chat-type"
;
import
xim
,
{
ChatNotifyListener
}
from
"../xim/xim"
;
import
xim
,
{
ChatNotifyListener
}
from
"../xim/xim"
;
...
@@ -548,14 +549,10 @@ export default {
...
@@ -548,14 +549,10 @@ export default {
chatMembers
.
map
(
async
(
member
)
=>
{
chatMembers
.
map
(
async
(
member
)
=>
{
let
result
:
NonNullable
<
ChatStore
.
STATE_CURRENT_CHAT_MEMBERS
>
[
number
];
let
result
:
NonNullable
<
ChatStore
.
STATE_CURRENT_CHAT_MEMBERS
>
[
number
];
try
{
try
{
const
info
=
await
sdk
()
const
data
=
await
getUserInfo
(
member
.
eid
);
.
model
(
"user"
)
.
detail
(
member
.
eid
)
.
query
();
result
=
{
result
=
{
...
member
,
...
member
,
name
:
info
.
row
.
first_name
.
value
as
string
,
...
data
,
phone
:
info
.
row
.
last_name
.
value
as
string
,
};
};
}
catch
(
error
)
{
}
catch
(
error
)
{
// eslint-disable-next-line no-console
// eslint-disable-next-line no-console
...
@@ -621,7 +618,7 @@ export default {
...
@@ -621,7 +618,7 @@ export default {
});
});
detailManager
.
done
();
detailManager
.
done
();
await
action
.
execute
();
await
action
.
execute
();
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
500
));
await
new
Promise
(
(
resolve
)
=>
setTimeout
(
resolve
,
500
));
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
},
},
},
},
...
...
utils/user-info.ts
0 → 100644
View file @
2b02de5c
import
Chat
from
"../xim"
;
export
type
UserMapping
=
{
[
eid
:
string
]:
{
name
:
string
;
phone
:
string
;
};
};
const
userMapping
:
UserMapping
=
{};
export
const
getUserMapping
=
()
=>
userMapping
;
export
async
function
getUserInfo
(
eid
:
string
)
{
if
(
userMapping
[
eid
]
!=
null
)
return
userMapping
[
eid
];
const
info
=
await
Chat
.
getSdk
().
model
(
"user"
).
detail
(
eid
).
query
();
const
data
=
{
name
:
info
.
row
.
first_name
.
value
as
string
,
phone
:
info
.
row
.
last_name
.
value
as
string
,
};
userMapping
[
eid
]
=
data
;
return
data
;
}
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