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
f24ba7b7
authored
Jul 26, 2021
by
panjiangyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化打开会话的逻辑
parent
0fa8de52
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
28 deletions
components/chat-list.vue
store/index.ts
store/model.ts
components/chat-list.vue
View file @
f24ba7b7
...
@@ -175,19 +175,8 @@ export default class ChatList extends Vue {
...
@@ -175,19 +175,8 @@ export default class ChatList extends Vue {
private
async
selectFirstChat
()
{
private
async
selectFirstChat
()
{
if
(
this
.
chatId
!=
null
)
return
;
if
(
this
.
chatId
!=
null
)
return
;
if
(
!
this
.
chatRooms
.
length
)
return
;
if
(
!
this
.
chatRooms
.
length
)
return
;
const
{
chat_id
,
business_data
}
=
this
.
chatRooms
[
0
];
const
{
chat_id
}
=
this
.
chatRooms
[
0
];
if
(
business_data
==
null
)
{
this
.
saveChatId
(
chat_id
);
return
;
}
const
data
=
await
getChatModelInfo
(
business_data
.
model_name
,
business_data
.
obj_id
);
this
.
saveChatId
({
chatId
:
chat_id
,
v
:
data
.
uniplat_version
,
uniplatId
:
data
.
uniplatId
,
});
}
}
@
buttonThrottle
()
@
buttonThrottle
()
...
@@ -217,11 +206,7 @@ export default class ChatList extends Vue {
...
@@ -217,11 +206,7 @@ export default class ChatList extends Vue {
wantedChatRoom
.
business_data
.
obj_id
,
wantedChatRoom
.
business_data
.
obj_id
,
wantedChatRoom
.
business_data
.
detail_name
wantedChatRoom
.
business_data
.
detail_name
);
);
await
this
.
saveChatId
({
await
this
.
saveChatId
(
wantedChatRoom
.
chat_id
).
finally
(
this
.
raiseChatIdChanged
);
chatId
:
wantedChatRoom
.
chat_id
,
v
:
info
.
uniplat_version
,
uniplatId
:
info
.
uniplatId
,
}).
finally
(
this
.
raiseChatIdChanged
);
this
.
showChat
();
this
.
showChat
();
this
.
close
();
this
.
close
();
...
...
store/index.ts
View file @
f24ba7b7
...
@@ -473,14 +473,31 @@ export default {
...
@@ -473,14 +473,31 @@ export default {
xim
.
on
(
"chat_notify"
,
"user.input"
,
onInputing
);
xim
.
on
(
"chat_notify"
,
"user.input"
,
onInputing
);
},
},
async
[
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
](
async
[
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
](
{
commit
,
dispatch
},
{
state
,
commit
,
dispatch
},
params
:
Parameters
<
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
>
[
0
]
chatId
:
Parameters
<
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
>
[
0
]
)
{
)
{
const
{
chatId
,
v
,
uniplatId
}
=
params
;
const
chatList
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]?.
list
??
[];
if
(
chatList
.
length
===
0
)
return
;
const
wantedChatRoom
=
chatList
.
find
(
(
k
)
=>
k
.
chat_id
===
chatId
);
if
(
wantedChatRoom
==
null
)
return
;
if
(
wantedChatRoom
.
business_data
==
null
)
{
return
;
}
const
info
=
await
getChatModelInfo
(
wantedChatRoom
.
business_data
.
model_name
,
wantedChatRoom
.
business_data
.
obj_id
,
wantedChatRoom
.
business_data
.
detail_name
);
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
);
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_VERSION
,
v
);
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_VERSION
,
info
.
uniplat_version
);
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_UNIPLAT_ID
,
uniplatId
);
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_UNIPLAT_ID
,
info
.
uniplatId
);
commit
(
ChatStore
.
MUTATION_INITING_CHAT
);
commit
(
ChatStore
.
MUTATION_INITING_CHAT
);
removeRegisterChatEvents
.
forEach
((
k
)
=>
k
());
removeRegisterChatEvents
.
forEach
((
k
)
=>
k
());
await
Promise
.
all
([
await
Promise
.
all
([
...
...
store/model.ts
View file @
f24ba7b7
...
@@ -227,11 +227,7 @@ export namespace ChatStore {
...
@@ -227,11 +227,7 @@ export namespace ChatStore {
})
=>
Promise
<
number
>
})
=>
Promise
<
number
>
export
const
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
=
"action:保存当前chat-id"
;
export
const
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
=
"action:保存当前chat-id"
;
export
type
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
=
(
params
:
{
export
type
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
=
(
chatId
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
)
=>
Promise
<
void
>
chatId
:
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
;
v
:
number
;
uniplatId
:
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
;
})
=>
Promise
<
void
>
export
const
ACTION_CLEAR_CURRENT_CHAT_DATA
=
"action:清空当前会话数据"
;
export
const
ACTION_CLEAR_CURRENT_CHAT_DATA
=
"action:清空当前会话数据"
;
export
type
ACTION_CLEAR_CURRENT_CHAT_DATA
=
()
=>
Promise
<
void
>
export
type
ACTION_CLEAR_CURRENT_CHAT_DATA
=
()
=>
Promise
<
void
>
...
...
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