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
ea792670
authored
Feb 25, 2022
by
杨铁龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
step commit
parent
d2b53e6d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
36 deletions
components/chat-room.vue
components/message-input.vue
store/index.ts
store/model.ts
xim/index.ts
components/chat-room.vue
View file @
ea792670
...
...
@@ -238,6 +238,7 @@
top
:
calc
(
100%
-
130px
+
1px
);
height
:
6px
;
width
:
100%
;
z-index
:
1
;
&:hover
{
background-color
:
#eee
;
...
...
components/message-input.vue
View file @
ea792670
...
...
@@ -10,9 +10,7 @@
import
{
Component
,
Ref
,
Vue
,
Watch
}
from
"vue-property-decorator"
;
import
ChatInput
,
{
isFileElement
,
isImageOrFile
}
from
"./hybrid-input.vue"
;
import
{
MessageType
}
from
"../model"
;
// import { uploadFile } from "../service/upload";
import
xim
from
"../xim/xim"
;
import
Chat
from
"../xim"
;
import
{
ChatStore
,
chatStore
}
from
"@/customer-service/store/model"
;
@
Component
({
components
:
{
ChatInput
}
})
...
...
store/index.ts
View file @
ea792670
...
...
@@ -573,12 +573,11 @@ export default {
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
// TODO 发消息
return
xim
.
sendMsg
(
"users"
,
chat
.
chat_id
,
params
.
msgType
,
params
.
msg
);
return
xim
.
sendMsg
(
"users"
,
chat
.
chat_id
,
params
.
msgType
,
params
.
msg
)
.
then
(()
=>
{
dispatch
(
ChatStore
.
ACTION_GET_FRESH_MESSAGE
);
});
// return await Chat.getSdk()
// .model(chat.model_name)
// .chat(chat.obj_id, orgId())
...
...
@@ -749,16 +748,19 @@ export default {
},
async
[
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
](
{
state
,
commit
,
dispatch
},
chatId
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
p
:
{
chatId
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
uid
:
number
;
}
)
{
if
(
!
chatId
)
{
if
(
!
p
.
chatId
)
{
return
;
}
const
chatList
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
];
let
wantedChatRoom
=
chatList
.
find
((
k
)
=>
k
.
chat_id
===
chatId
);
let
wantedChatRoom
=
chatList
.
find
((
k
)
=>
k
.
chat_id
===
p
.
chatId
);
if
(
!
wantedChatRoom
)
{
const
data
=
await
xim
.
fetchChat
(
chatId
);
const
data
=
await
xim
.
fetchChat
(
p
.
chatId
);
if
(
!
data
)
{
return
;
}
...
...
@@ -771,13 +773,10 @@ export default {
commit
(
ChatStore
.
MUTATION_CLEAR_SINGLE_CHAT
);
}
// if (!state[ChatStore.STATE_CHAT_CURRENT_USER_UID]) {
// const userInfo = await Chat.getSdk().getUserInfo();
// commit(ChatStore.MUTATION_SET_CURRENT_USER_UID, userInfo.id);
// }
commit
(
ChatStore
.
MUTATION_SET_CURRENT_USER_UID
,
p
.
uid
);
commit
(
ChatStore
.
MUTATION_CLEAR_CHAT_MSG_HISTORY
);
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_ID
,
chatId
);
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_ID
,
p
.
chatId
);
// getChatModelInfo(
// wantedChatRoom.model_name,
...
...
@@ -809,7 +808,7 @@ export default {
}
finally
{
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_TITLE
,
wantedChatRoom
.
title
||
`在线咨询-
${
chatId
}
`
wantedChatRoom
.
title
||
`在线咨询-
${
p
.
chatId
}
`
);
commit
(
ChatStore
.
MUTATION_INITING_CHAT_DONE
);
commit
(
ChatStore
.
MUTATION_SCROLL_TO_BOTTOM
);
...
...
@@ -883,23 +882,9 @@ export default {
const
id
=
Number
(
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
]
);
// await model()
// .action("update")
// .updateInitialParams({
// selected_list: [{ v, id }],
// })
// .addInputs_parameter({
// Status: ChatStatus.terminated,
// })
// .execute();
await
dispatch
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
);
const
firstChat
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
][
0
];
if
(
firstChat
==
null
)
return
;
// await getChatModelInfo(
// firstChat.model_name,
// firstChat.obj_id,
// firstChat.detail_name
// );
await
dispatch
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
,
firstChat
.
chat_id
...
...
store/model.ts
View file @
ea792670
...
...
@@ -286,9 +286,10 @@ export namespace ChatStore {
})
=>
Promise
<
number
>
;
export
const
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
=
"action:保存当前chat-id"
;
export
type
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
=
(
chatId
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
)
=>
Promise
<
void
>
;
export
type
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
=
(
p
:
{
chatId
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
uid
:
number
;
})
=>
Promise
<
void
>
;
export
const
ACTION_CLEAR_CURRENT_CHAT_DATA
=
"action:清空当前会话数据"
;
export
type
ACTION_CLEAR_CURRENT_CHAT_DATA
=
()
=>
Promise
<
void
>
;
...
...
xim/index.ts
View file @
ea792670
...
...
@@ -47,7 +47,7 @@ class Chat {
option
.
message
&&
(
this
.
messageController
=
option
.
message
);
option
.
avatar
!==
undefined
&&
(
this
.
defaultAvatar
=
option
.
avatar
);
// indexDb缓存
// if (!option.disabledIndexDb) {
// await this.setupIndexDb("test").catch((err) => {
// // 必须catch error不然小程序不会向后运行
...
...
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