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
8cc8f134
authored
Nov 01, 2021
by
zhousil
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' of
http://gitlab.corp.qinqinxiaobao.com:9880/uniplat/customer-service
parents
7192e922
005ff905
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
16 deletions
components/controller/chat-list.ts
components/message.vue
model/index.ts
store/index.ts
store/model.ts
utils/user-info.ts
xim/index.ts
components/controller/chat-list.ts
View file @
8cc8f134
...
...
@@ -53,7 +53,7 @@ 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
]
)
{
if
(
this
.
userNames
[
data
.
last_msg_sender
]
===
undefined
)
{
this
.
updateUserName
({
id
:
data
.
last_msg_sender
,
name
:
""
});
this
.
invoker
.
model
(
"user"
)
...
...
@@ -65,7 +65,7 @@ export default class ChatList extends Vue {
name
:
userInfo
.
row
.
first_name
.
display
as
string
,
});
})
.
catch
(()
=>
{
});
.
catch
(()
=>
{});
}
}
if
(
data
.
last_msg_content
===
""
)
{
...
...
components/message.vue
View file @
8cc8f134
...
...
@@ -222,8 +222,12 @@
private
get
messageBody
():
{
eid
?:
string
;
oid
?:
string
;
msg
:
any
}
{
if
(
this
.
data
)
{
const
msg
=
this
.
data
.
msg
;
try
{
return
{
...
this
.
data
,
msg
:
JSON
.
parse
(
this
.
data
.
msg
)
};
if
(
msg
.
startsWith
(
"{"
))
{
return
{
...
this
.
data
,
msg
:
JSON
.
parse
(
this
.
data
.
msg
)
};
}
return
{
...
this
.
data
,
msg
:
this
.
data
.
msg
};
}
catch
{
return
{
...
this
.
data
,
...
...
model/index.ts
View file @
8cc8f134
...
...
@@ -191,7 +191,7 @@ export interface ChatMember {
oid
:
string
;
eid
:
string
;
chat_id
:
number
;
type
:
number
;
type
:
ChatRole
;
join_msg_id
:
number
;
exit_msg_id
:
number
;
is_exited
:
boolean
;
...
...
store/index.ts
View file @
8cc8f134
...
...
@@ -31,7 +31,7 @@ function uniqueMessages(
messages
:
NonNullable
<
ChatStore
.
STATE_CHAT_MSG_HISTORY
>
)
{
const
arr
=
[...
messages
];
return
unique
(
arr
,
function
(
item
,
all
)
{
return
unique
(
arr
,
function
(
item
,
all
)
{
return
all
.
findIndex
((
k
)
=>
k
.
id
===
item
.
id
);
});
}
...
...
@@ -327,7 +327,7 @@ export default {
state
[
ChatStore
.
STATE_CHAT_SENDING_MESSAGES
]
=
[...
current
];
}
},
[
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_INPUTING
]:
(
function
()
{
[
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_INPUTING
]:
(
function
()
{
const
setTimeoutId
:
{
[
key
:
string
]:
number
}
=
{};
return
(
state
:
ChatStoreState
,
...
...
@@ -390,7 +390,9 @@ export default {
let
sum
=
0
;
items
.
forEach
((
i
)
=>
(
sum
+=
i
.
unread_msg_count
));
state
[
ChatStore
.
STATE_CURRENT_UNREAD_MESSAGE_COUNT
]
=
sum
;
return
items
;
return
items
.
sort
((
x
,
y
)
=>
x
.
last_msg_ts
<
y
.
last_msg_ts
?
1
:
-
1
);
};
if
(
cache
&&
cache
.
length
)
{
...
...
@@ -732,7 +734,7 @@ export default {
}
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_MEMBERS
,
unique
(
newChatMembers
,
function
(
item
,
all
)
{
unique
(
newChatMembers
,
function
(
item
,
all
)
{
return
all
.
findIndex
((
k
)
=>
k
.
eid
===
item
.
eid
);
})
);
...
...
@@ -836,7 +838,7 @@ export default {
return
await
Chat
.
getSdk
()
.
model
(
currentChat
.
model_name
)
.
chat
(
currentChat
.
obj_id
,
orgId
())
.
addMember
(
uids
.
map
((
id
)
=>
Number
(
id
)
))
.
addMember
(
uids
.
map
((
id
)
=>
+
id
))
.
finally
(()
=>
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
));
},
async
[
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
](
...
...
@@ -854,7 +856,7 @@ export default {
return
await
Chat
.
getSdk
()
.
model
(
currentChat
.
model_name
)
.
chat
(
currentChat
.
obj_id
,
orgId
())
.
removeMember
(
uids
.
map
((
id
)
=>
Number
(
id
)
))
.
removeMember
(
uids
.
map
((
id
)
=>
+
id
))
.
finally
(()
=>
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
));
},
async
[
ChatStore
.
ACTION_CHAT_ADD_CS
](
...
...
store/model.ts
View file @
8cc8f134
...
...
@@ -320,9 +320,9 @@ export namespace ChatStore {
export
const
ACTION_TERINATE_CHAT
=
"结束会话"
;
export
type
ACTION_TERINATE_CHAT
=
()
=>
Promise
<
void
>
;
export
const
ACTION_CHAT_ADD_MEMBERS
=
"添加成员"
;
export
type
ACTION_CHAT_ADD_MEMBERS
=
(
uids
:
string
[])
=>
Promise
<
void
>
;
export
type
ACTION_CHAT_ADD_MEMBERS
=
(
uids
:
(
string
|
number
)
[])
=>
Promise
<
void
>
;
export
const
ACTION_CHAT_REMOVE_MEMBER
=
"移除成员"
;
export
type
ACTION_CHAT_REMOVE_MEMBER
=
(
uids
:
string
[])
=>
Promise
<
void
>
;
export
type
ACTION_CHAT_REMOVE_MEMBER
=
(
uids
:
(
string
|
number
)
[])
=>
Promise
<
void
>
;
export
const
ACTION_CHAT_ADD_CS
=
"添加客服"
;
export
type
ACTION_CHAT_ADD_CS
=
(
uids
:
string
[])
=>
Promise
<
void
>
;
...
...
utils/user-info.ts
View file @
8cc8f134
...
...
@@ -11,7 +11,9 @@ const userMapping: UserMapping = {};
export
const
getUserMapping
=
()
=>
userMapping
;
export
async
function
getUserInfo
(
eid
:
string
)
{
if
(
userMapping
[
eid
]
!=
null
)
return
userMapping
[
eid
];
if
(
userMapping
[
eid
])
{
return
userMapping
[
eid
];
}
const
info
=
await
Chat
.
getSdk
().
model
(
"user"
).
detail
(
eid
).
query
();
const
data
=
{
name
:
info
.
row
.
first_name
.
value
as
string
,
...
...
xim/index.ts
View file @
8cc8f134
...
...
@@ -70,11 +70,10 @@ class Chat {
if
(
this
.
_sdk
)
{
const
s
=
this
.
_sdk
();
return
dbController
.
setup
(
s
.
global
.
uid
+
"-"
+
(
s
.
global
.
initData
.
orgId
||
0
)
s
.
global
.
uid
+
"-"
+
(
s
.
global
.
initData
.
orgId
||
0
)
);
}
return
Promise
.
reject
();
}
public
resetup
(
org
:
()
=>
string
|
number
)
{
...
...
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