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
e25d4958
authored
Dec 15, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
u
parent
959d9b39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
9 deletions
store/index.ts
xim/index.ts
store/index.ts
View file @
e25d4958
...
...
@@ -222,10 +222,12 @@ export default {
[
ChatStore
.
MUTATION_SAVE_MYSELF_ID
](
state
)
{
if
(
!
state
[
ChatStore
.
STATE_CHAT_MY_ID
])
{
Chat
.
getToken
().
then
((
token
)
=>
{
const
eid
=
decodeJwt
<
{
user_id
:
string
;
sub
:
string
}
>
(
token
);
state
[
ChatStore
.
STATE_CHAT_MY_ID
]
=
String
(
eid
.
user_id
);
state
[
ChatStore
.
STATE_CHAT_MY_UID
]
=
eid
.
sub
;
if
(
token
)
{
const
eid
=
decodeJwt
<
{
user_id
:
string
;
sub
:
string
}
>
(
token
);
state
[
ChatStore
.
STATE_CHAT_MY_ID
]
=
String
(
eid
.
user_id
);
state
[
ChatStore
.
STATE_CHAT_MY_UID
]
=
eid
.
sub
;
}
});
}
},
...
...
xim/index.ts
View file @
e25d4958
...
...
@@ -56,8 +56,7 @@ class Chat {
this
.
eventHub
=
option
.
eventHub
||
null
;
option
.
message
&&
(
this
.
messageController
=
option
.
message
);
option
.
avatar
!==
undefined
&&
(
this
.
defaultAvatar
=
option
.
avatar
);
option
.
avatar
!==
undefined
&&
(
this
.
defaultAvatar
=
option
.
avatar
);
await
this
.
setupIndexDb
(
option
.
orgId
());
this
.
token
=
async
()
=>
option
.
sdk
().
global
.
jwtToken
;
...
...
@@ -73,7 +72,9 @@ class Chat {
// this.keywords = ["社保"];
const
path
=
socketMapping
.
get
(
option
.
connection
as
ImEnvironment
)
as
string
||
option
.
connection
as
string
;
const
path
=
(
socketMapping
.
get
(
option
.
connection
as
ImEnvironment
)
as
string
)
||
(
option
.
connection
as
string
);
return
this
.
initChatSdk
((
this
.
ws
=
path
)).
finally
(()
=>
{
this
.
connected
=
true
;
...
...
@@ -86,7 +87,7 @@ class Chat {
private
setupIndexDb
(
orgId
:
number
|
string
)
{
if
(
this
.
_sdk
)
{
const
s
=
this
.
_sdk
();
const
key
=
`
${
s
.
global
.
uid
}
-
${
orgId
||
0
}
`
const
key
=
`
${
s
.
global
.
uid
}
-
${
orgId
||
0
}
`
;
return
dbController
.
setup
(
key
);
}
return
Promise
.
reject
();
...
...
@@ -134,7 +135,10 @@ class Chat {
}
public
async
getToken
()
{
return
this
.
trimToken
(
await
this
.
token
());
if
(
this
.
token
)
{
return
this
.
trimToken
(
await
this
.
token
());
}
return
Promise
.
resolve
(
""
);
}
private
async
initChatSdk
(
uri
:
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