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
973d467b
authored
Jan 05, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into pre
parents
999659ed
b948fa15
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
17 deletions
components/message.vue
store/index.ts
store/model.ts
components/message.vue
View file @
973d467b
...
@@ -78,12 +78,7 @@
...
@@ -78,12 +78,7 @@
/>
/>
<avatar
<avatar
v-if=
"!isQuestionAnswerMessage && !isWithdrawMessage"
v-if=
"!isQuestionAnswerMessage && !isWithdrawMessage"
:src=
"
:src=
"avatar || defaultAvatar"
chatRole === 'admin' ||
chatRole === 'customer-service'
? defaultAvatar
: avatar
"
shape=
"circle"
shape=
"circle"
/>
/>
</div>
</div>
...
@@ -224,8 +219,8 @@
...
@@ -224,8 +219,8 @@
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_USER_UID
)
@
chatStore
.
State
(
ChatStore
.
STATE_CHAT_CURRENT_USER_UID
)
private
readonly
chatMyId
!
:
ChatStore
.
STATE_CHAT_CURRENT_USER_UID
;
private
readonly
chatMyId
!
:
ChatStore
.
STATE_CHAT_CURRENT_USER_UID
;
@
chatStore
.
Getter
(
ChatStore
.
STATE_CURRENT
_CHAT_MEMBERS
)
@
chatStore
.
State
(
ChatStore
.
STATE_ALL_HISTORY
_CHAT_MEMBERS
)
private
readonly
allChatMembers
!
:
ChatStore
.
STATE_
CURRENT
_CHAT_MEMBERS
;
private
readonly
allChatMembers
!
:
ChatStore
.
STATE_
ALL_HISTORY
_CHAT_MEMBERS
;
@
chatStore
.
Getter
(
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
)
@
chatStore
.
Getter
(
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
)
private
readonly
chatMembers
!
:
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
;
private
readonly
chatMembers
!
:
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
;
...
@@ -403,7 +398,7 @@
...
@@ -403,7 +398,7 @@
if
(
this
.
chatMembers
)
{
if
(
this
.
chatMembers
)
{
const
t
=
this
.
chatMembers
.
find
((
i
)
=>
i
.
eid
===
this
.
data
.
eid
);
const
t
=
this
.
chatMembers
.
find
((
i
)
=>
i
.
eid
===
this
.
data
.
eid
);
if
(
t
)
{
if
(
t
)
{
const
name
=
this
.
getFilterUsername
(
t
.
alias_name
||
t
.
name
);
const
name
=
this
.
getFilterUsername
(
t
.
alias_name
,
t
.
name
);
if
(
name
)
{
if
(
name
)
{
return
name
;
return
name
;
}
}
...
@@ -413,15 +408,18 @@
...
@@ -413,15 +408,18 @@
return
this
.
refetchUsername
;
return
this
.
refetchUsername
;
}
}
private
getFilterUsername
(
name
:
string
)
{
private
getFilterUsername
(
name1
:
string
,
name2
:
string
)
{
const
backend
=
Xim
.
isBackend
();
if
(
if
(
this
.
currentChat
&&
this
.
currentChat
&&
this
.
currentChat
.
catalog
===
"福利宝"
&&
this
.
currentChat
.
catalog
===
"福利宝"
&&
this
.
chatRole
===
"customer-service"
this
.
chatRole
===
"customer-service"
)
{
)
{
return
`采购顾问
${
name
}
`
;
return
backend
&&
name1
?
`采购顾问
${
name1
}
(
${
name2
}
)`
:
`采购顾问
${
name1
||
name2
}
`
;
}
}
return
name
;
return
backend
&&
name1
?
`
${
name1
}
(
${
name2
}
)`
:
name1
||
name2
;
}
}
private
get
avatar
()
{
private
get
avatar
()
{
...
@@ -615,7 +613,14 @@
...
@@ -615,7 +613,14 @@
if
(
this
.
data
&&
this
.
data
.
eid
)
{
if
(
this
.
data
&&
this
.
data
.
eid
)
{
ChatUserInfoService
.
getUserInfo
(
this
.
data
.
eid
).
then
((
r
)
=>
{
ChatUserInfoService
.
getUserInfo
(
this
.
data
.
eid
).
then
((
r
)
=>
{
if
(
r
)
{
if
(
r
)
{
this
.
refetchUsername
=
r
.
alias_name
||
r
.
name
||
r
.
phone
;
if
(
Xim
.
isBackend
()
&&
r
.
alias_name
)
{
this
.
refetchUsername
=
`
${
r
.
alias_name
}
(
${
r
.
name
||
r
.
phone
}
)`
;
}
else
{
this
.
refetchUsername
=
r
.
alias_name
||
r
.
name
||
r
.
phone
;
}
r
.
icon
&&
(
this
.
refetchUserIcon
=
r
.
icon
);
r
.
icon
&&
(
this
.
refetchUserIcon
=
r
.
icon
);
}
}
});
});
...
...
store/index.ts
View file @
973d467b
...
@@ -159,6 +159,7 @@ export default {
...
@@ -159,6 +159,7 @@ export default {
[
ChatStore
.
STATE_CHAT_MY_UID
]:
null
,
[
ChatStore
.
STATE_CHAT_MY_UID
]:
null
,
[
ChatStore
.
STATE_CHAT_SOURCE
]:
ServiceType
.
Frontend
,
[
ChatStore
.
STATE_CHAT_SOURCE
]:
ServiceType
.
Frontend
,
[
ChatStore
.
STATE_CURRENT_CHAT_MEMBERS
]:
null
,
[
ChatStore
.
STATE_CURRENT_CHAT_MEMBERS
]:
null
,
[
ChatStore
.
STATE_ALL_HISTORY_CHAT_MEMBERS
]:
null
,
[
ChatStore
.
STATE_CURRENT_CHAT_TITLE
]:
""
,
[
ChatStore
.
STATE_CURRENT_CHAT_TITLE
]:
""
,
[
ChatStore
.
STATE_FUNC_SCROLL_TO_BOTTOM
]:
()
=>
true
,
[
ChatStore
.
STATE_FUNC_SCROLL_TO_BOTTOM
]:
()
=>
true
,
[
ChatStore
.
STATE_FUNC_ON_NEW_MSG
]:
()
=>
true
,
[
ChatStore
.
STATE_FUNC_ON_NEW_MSG
]:
()
=>
true
,
...
@@ -881,7 +882,7 @@ export default {
...
@@ -881,7 +882,7 @@ export default {
commit
(
ChatStore
.
MUTATION_CLEAR_CHAT_MSG_HISTORY
);
commit
(
ChatStore
.
MUTATION_CLEAR_CHAT_MSG_HISTORY
);
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_ID
,
chatId
);
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_ID
,
chatId
);
await
getChatModelInfo
(
getChatModelInfo
(
wantedChatRoom
.
model_name
,
wantedChatRoom
.
model_name
,
wantedChatRoom
.
obj_id
,
wantedChatRoom
.
obj_id
,
wantedChatRoom
.
detail_name
wantedChatRoom
.
detail_name
...
@@ -895,13 +896,13 @@ export default {
...
@@ -895,13 +896,13 @@ export default {
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_UNIPLAT_ID
,
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_UNIPLAT_ID
,
info
.
uniplatId
info
.
uniplatId
);
);
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
})
})
.
catch
(
console
.
error
);
.
catch
(
console
.
error
);
commit
(
ChatStore
.
MUTATION_INITING_CHAT
);
commit
(
ChatStore
.
MUTATION_INITING_CHAT
);
removeRegisterChatEvents
.
forEach
((
k
)
=>
k
());
removeRegisterChatEvents
.
forEach
((
k
)
=>
k
());
removeRegisterChatEvents
=
[];
removeRegisterChatEvents
=
[];
try
{
try
{
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
await
Promise
.
all
([
await
Promise
.
all
([
dispatch
(
ChatStore
.
ACTION_REGISTER_EVENT
),
dispatch
(
ChatStore
.
ACTION_REGISTER_EVENT
),
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MESSAGES
),
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MESSAGES
),
...
@@ -937,7 +938,7 @@ export default {
...
@@ -937,7 +938,7 @@ export default {
const
getChatMembersResult
=
await
xim
.
fetchChatMembers
(
chatId
);
const
getChatMembersResult
=
await
xim
.
fetchChatMembers
(
chatId
);
if
(
!
getChatMembersResult
)
return
;
if
(
!
getChatMembersResult
)
return
;
const
chatMembers
=
getChatMembersResult
.
args
[
0
]
as
ChatMember
[];
const
chatMembers
=
getChatMembersResult
.
args
[
0
]
as
ChatMember
[];
let
newChatMembers
=
await
Promise
.
all
(
const
all
=
await
Promise
.
all
(
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
{
...
@@ -956,7 +957,8 @@ export default {
...
@@ -956,7 +957,8 @@ export default {
return
result
;
return
result
;
})
})
);
);
newChatMembers
=
newChatMembers
.
filter
((
it
)
=>
!
it
.
is_exited
);
state
[
ChatStore
.
STATE_ALL_HISTORY_CHAT_MEMBERS
]
=
all
;
const
newChatMembers
=
all
.
filter
((
it
)
=>
!
it
.
is_exited
);
const
member
=
newChatMembers
.
find
(
const
member
=
newChatMembers
.
find
(
(
it
)
=>
(
it
)
=>
it
.
eid
===
it
.
eid
===
...
@@ -969,6 +971,7 @@ export default {
...
@@ -969,6 +971,7 @@ export default {
commit
(
ChatStore
.
MUTATION_CHAT_UPDATE_IS_MEMBER
,
false
);
commit
(
ChatStore
.
MUTATION_CHAT_UPDATE_IS_MEMBER
,
false
);
commit
(
ChatStore
.
MUTATION_CHAT_UPDATE_USER_TYPE
,
"0"
);
commit
(
ChatStore
.
MUTATION_CHAT_UPDATE_USER_TYPE
,
"0"
);
}
}
commit
(
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_MEMBERS
,
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_MEMBERS
,
unique
(
newChatMembers
,
function
(
item
,
all
)
{
unique
(
newChatMembers
,
function
(
item
,
all
)
{
...
...
store/model.ts
View file @
973d467b
...
@@ -73,6 +73,11 @@ export namespace ChatStore {
...
@@ -73,6 +73,11 @@ export namespace ChatStore {
|
readonly
(
dto
.
ChatMember
&
dto
.
ChatMemberExtraInfo
)[]
|
readonly
(
dto
.
ChatMember
&
dto
.
ChatMemberExtraInfo
)[]
|
null
;
|
null
;
export
const
STATE_ALL_HISTORY_CHAT_MEMBERS
=
"当前会话历史所有参与者"
;
export
type
STATE_ALL_HISTORY_CHAT_MEMBERS
=
|
readonly
(
dto
.
ChatMember
&
dto
.
ChatMemberExtraInfo
)[]
|
null
;
export
const
STATE_CURRENT_CHAT_TITLE
=
"会话标题"
;
export
const
STATE_CURRENT_CHAT_TITLE
=
"会话标题"
;
export
type
STATE_CURRENT_CHAT_TITLE
=
string
;
export
type
STATE_CURRENT_CHAT_TITLE
=
string
;
...
...
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