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
ba4ae341
authored
Dec 24, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
alias name
parent
40cbc7b7
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
11 deletions
components/controller/chat-list.ts
components/message.vue
components/who-read-list.vue
model/index.ts
store/index.ts
utils/user-info.ts
components/controller/chat-list.ts
View file @
ba4ae341
...
...
@@ -3,7 +3,7 @@ import { parserMessage } from ".";
import
{
chatStore
,
ChatStore
}
from
"@/customer-service/store/model"
;
import
{
formatTime
,
TimeFormatRule
}
from
"@/customer-service/utils/time"
;
import
{
Chat
as
ChatItem
}
from
"@/customer-service/xim/models/chat"
;
import
{
getUserInfo
}
from
"@/customer-service/utils/user-info"
;
import
{
ChatUserInfoService
}
from
"@/customer-service/utils/user-info"
;
@
Component
({
components
:
{}
})
export
default
class
ChatList
extends
Vue
{
...
...
@@ -64,9 +64,11 @@ export default class ChatList extends Vue {
protected
parseMesage
(
data
:
ChatItem
)
{
if
(
data
.
last_msg_sender
&&
data
.
last_msg_sender
!==
"0"
)
{
if
(
this
.
userNames
[
data
.
last_msg_sender
]
===
undefined
)
{
const
id
=
data
.
last_msg_sender
const
id
=
data
.
last_msg_sender
;
this
.
updateUserName
({
id
,
name
:
""
});
getUserInfo
(
id
).
then
(
d
=>
this
.
updateUserName
({
id
,
name
:
d
.
name
}))
ChatUserInfoService
.
getUserInfo
(
id
).
then
((
d
)
=>
this
.
updateUserName
({
id
,
name
:
d
.
alias_name
||
d
.
name
})
);
}
}
if
(
data
.
last_msg_content
===
""
)
{
...
...
components/message.vue
View file @
ba4ae341
...
...
@@ -350,7 +350,7 @@
if
(
this
.
chatMembers
)
{
const
t
=
this
.
chatMembers
.
find
((
i
)
=>
i
.
eid
===
this
.
data
.
eid
);
if
(
t
)
{
return
this
.
getFilterUsername
(
t
.
name
);
return
this
.
getFilterUsername
(
t
.
alias_name
||
t
.
name
);
}
}
return
""
;
...
...
components/who-read-list.vue
View file @
ba4ae341
...
...
@@ -58,7 +58,7 @@
import
avatar
from
"@/customer-service/components/avatar.vue"
;
import
{
ChatStore
}
from
"@/customer-service/store/model"
;
import
xim
from
"@/customer-service/xim/xim"
;
import
{
getUserInfo
}
from
"../utils/user-info"
;
import
{
ChatUserInfoService
}
from
"../utils/user-info"
;
const
chatStoreNamespace
=
namespace
(
"chatStore"
);
...
...
@@ -113,7 +113,7 @@
}
private
async
getUserNameByid
(
eid
:
string
)
{
const
data
=
await
getUserInfo
(
eid
);
const
data
=
await
ChatUserInfoService
.
getUserInfo
(
eid
);
return
data
.
name
;
}
...
...
model/index.ts
View file @
ba4ae341
...
...
@@ -216,6 +216,7 @@ export interface TransferedChatItem extends BaseChatItem {
export
type
ChatMemberExtraInfo
=
{
name
?:
string
;
phone
?:
string
;
alias_name
?:
string
;
};
export
interface
ChatMember
{
...
...
@@ -242,6 +243,7 @@ export interface ChatMember {
update_time
:
number
;
name
:
string
;
phone
:
string
;
alias_name
?:
string
;
}
export
type
ChatMembers
=
readonly
ChatMember
[];
...
...
store/index.ts
View file @
ba4ae341
...
...
@@ -12,7 +12,7 @@ import {
import
{
isAccessibleUrl
}
from
"../service/tools"
;
import
{
unique
}
from
"../utils"
;
import
{
getChatModelInfo
}
from
"../utils/chat-info"
;
import
{
getUserInfo
}
from
"../utils/user-info"
;
import
{
ChatUserInfoService
}
from
"../utils/user-info"
;
import
Chat
from
"../xim"
;
import
{
Chat
as
ChatType
,
Message
}
from
"../xim/models/chat"
;
import
xim
,
{
ChatNotifyListener
,
Xim
}
from
"../xim/xim"
;
...
...
@@ -910,7 +910,9 @@ export default {
chatMembers
.
map
(
async
(
member
)
=>
{
let
result
:
NonNullable
<
ChatStore
.
STATE_CURRENT_CHAT_MEMBERS
>
[
number
];
try
{
const
data
=
await
getUserInfo
(
member
.
eid
);
const
data
=
await
ChatUserInfoService
.
getUserInfo
(
member
.
eid
);
result
=
{
...
member
,
...
data
,
...
...
@@ -1164,7 +1166,7 @@ export default {
}
return
new
Promise
<
{
id
:
string
;
name
:
string
}
>
(
(
resolve
,
reject
)
=>
getUserInfo
(
id
)
ChatUserInfoService
.
getUserInfo
(
id
)
.
then
((
d
)
=>
{
Vue
.
set
(
state
[
ChatStore
.
STATE_CHAT_USERNAME
],
...
...
utils/user-info.ts
View file @
ba4ae341
...
...
@@ -6,6 +6,7 @@ export type UserMapping = {
name
:
string
;
phone
:
string
;
icon
:
string
;
alias_name
:
string
;
};
};
...
...
@@ -19,16 +20,18 @@ interface UserInfo {
realname
:
string
;
uniplatId
:
string
;
username
:
string
;
alias_name
:
string
;
}
export
const
getUserMapping
=
()
=>
userMapping
;
export
async
function
getUserInfo
(
eid
:
string
,
sdk
?:
UniplatSdk
)
{
export
class
ChatUserInfoService
{
public
static
async
getUserInfo
(
eid
:
string
,
sdk
?:
UniplatSdk
)
{
if
(
userMapping
[
eid
])
{
return
userMapping
[
eid
];
}
if
(
!+
eid
||
+
eid
<
0
)
{
return
{
name
:
""
,
phone
:
""
,
icon
:
""
};
return
{
name
:
""
,
phone
:
""
,
icon
:
""
,
alias_name
:
""
};
}
const
info
=
await
(
sdk
||
Chat
.
getSdk
())
.
domainService
(
...
...
@@ -41,7 +44,26 @@ export async function getUserInfo(eid: string, sdk?: UniplatSdk) {
name
:
info
.
username
||
info
.
realname
||
info
.
mobile
||
info
.
mobile
,
phone
:
info
.
mobile
,
icon
:
info
.
avatar_url
,
alias_name
:
info
.
alias_name
,
};
userMapping
[
eid
]
=
data
;
return
data
;
}
public
static
updateCache
(
uid
:
string
,
alias_name
:
string
)
{
const
t
=
userMapping
[
uid
];
t
&&
(
t
.
alias_name
=
alias_name
);
}
public
static
setAliasName
(
uid
:
string
|
number
,
name
:
string
,
sdk
?:
UniplatSdk
)
{
return
(
sdk
||
Chat
.
getSdk
())
.
domainService
(
"passport"
,
"anonymous"
,
`oidc.account/set_alias`
)
.
request
<
any
,
any
,
{}
>
(
"post"
,
{
data
:
{
id
:
uid
,
alias_name
:
name
},
});
}
}
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