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
bfc192a3
authored
Nov 23, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update
parent
2f3001c9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
20 deletions
components/chat-room.vue
store/index.ts
store/model.ts
components/chat-room.vue
View file @
bfc192a3
...
@@ -112,8 +112,7 @@
...
@@ -112,8 +112,7 @@
private
get
currentChat
()
{
private
get
currentChat
()
{
const
chatId
=
this
.
chatId
;
const
chatId
=
this
.
chatId
;
if
(
this
.
myChatList
==
null
)
return
;
const
result
=
this
.
myChatList
.
find
((
k
)
=>
k
.
chat_id
===
chatId
);
const
result
=
this
.
myChatList
.
list
.
find
((
k
)
=>
k
.
chat_id
===
chatId
);
return
result
??
{};
return
result
??
{};
}
}
...
...
store/index.ts
View file @
bfc192a3
...
@@ -136,7 +136,7 @@ export default {
...
@@ -136,7 +136,7 @@ export default {
[
ChatStore
.
STATE_CHAT_CURRENT_USER_UID
]:
null
,
[
ChatStore
.
STATE_CHAT_CURRENT_USER_UID
]:
null
,
[
ChatStore
.
STATE_CHAT_MSG_HISTORY
]:
null
,
[
ChatStore
.
STATE_CHAT_MSG_HISTORY
]:
null
,
[
ChatStore
.
STATE_CHAT_SENDING_MESSAGES
]:
[],
[
ChatStore
.
STATE_CHAT_SENDING_MESSAGES
]:
[],
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]:
null
,
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]:
[]
,
[
ChatStore
.
STATE_SINGLE_CHAT
]:
null
,
[
ChatStore
.
STATE_SINGLE_CHAT
]:
null
,
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
]:
null
,
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
]:
null
,
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
]:
null
,
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
]:
null
,
...
@@ -429,10 +429,7 @@ export default {
...
@@ -429,10 +429,7 @@ export default {
};
};
if
(
cache
&&
cache
.
length
)
{
if
(
cache
&&
cache
.
length
)
{
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
{
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
cache
);
list
:
cache
,
total
:
9999
,
});
const
ts
=
cache
const
ts
=
cache
.
map
((
i
)
=>
Math
.
max
(
i
.
last_msg_ts
,
i
.
update_time
))
.
map
((
i
)
=>
Math
.
max
(
i
.
last_msg_ts
,
i
.
update_time
))
.
sort
();
.
sort
();
...
@@ -473,10 +470,7 @@ export default {
...
@@ -473,10 +470,7 @@ export default {
buildChatItem
(
chat
)
buildChatItem
(
chat
)
);
);
dbController
.
saveChatList
(
items
);
dbController
.
saveChatList
(
items
);
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
{
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
items
);
list
:
items
,
total
:
9999
,
});
resolve
(
buildUnreadMessage
(
items
));
resolve
(
buildUnreadMessage
(
items
));
});
});
});
});
...
@@ -739,8 +733,9 @@ export default {
...
@@ -739,8 +733,9 @@ export default {
if
(
!
chatId
)
{
if
(
!
chatId
)
{
return
;
return
;
}
}
const
chatList
=
const
chatList
=
state
[
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]?.
list
??
[];
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]
as
ChatType
[];
let
wantedChatRoom
=
chatList
.
find
((
k
)
=>
k
.
chat_id
===
chatId
);
let
wantedChatRoom
=
chatList
.
find
((
k
)
=>
k
.
chat_id
===
chatId
);
if
(
!
wantedChatRoom
)
{
if
(
!
wantedChatRoom
)
{
...
@@ -864,7 +859,7 @@ export default {
...
@@ -864,7 +859,7 @@ export default {
})
})
.
execute
();
.
execute
();
await
dispatch
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
);
await
dispatch
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
);
const
firstChat
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]
?.
list
[
0
];
const
firstChat
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
][
0
];
if
(
firstChat
==
null
)
return
;
if
(
firstChat
==
null
)
return
;
await
getChatModelInfo
(
await
getChatModelInfo
(
firstChat
.
model_name
,
firstChat
.
model_name
,
...
@@ -1103,8 +1098,7 @@ export default {
...
@@ -1103,8 +1098,7 @@ export default {
if
(
singleChat
&&
singleChat
.
chat_id
===
chatId
)
{
if
(
singleChat
&&
singleChat
.
chat_id
===
chatId
)
{
return
singleChat
;
return
singleChat
;
}
}
const
chatList
=
const
chatList
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
];
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
]?.
list
??
[];
return
chatList
.
find
((
chat
)
=>
chat
.
chat_id
===
chatId
);
return
chatList
.
find
((
chat
)
=>
chat
.
chat_id
===
chatId
);
},
},
},
},
...
...
store/model.ts
View file @
bfc192a3
...
@@ -20,10 +20,7 @@ export namespace ChatStore {
...
@@ -20,10 +20,7 @@ export namespace ChatStore {
export
const
STATE_CHAT_DIALOG_IS_SINGLE
=
"会话模块是否是单个弹窗"
;
export
const
STATE_CHAT_DIALOG_IS_SINGLE
=
"会话模块是否是单个弹窗"
;
export
type
STATE_CHAT_DIALOG_IS_SINGLE
=
boolean
;
export
type
STATE_CHAT_DIALOG_IS_SINGLE
=
boolean
;
export
const
STATE_MY_CHAT_ROOM_LIST
=
"我的会话列表"
;
export
const
STATE_MY_CHAT_ROOM_LIST
=
"我的会话列表"
;
export
type
STATE_MY_CHAT_ROOM_LIST
=
{
export
type
STATE_MY_CHAT_ROOM_LIST
=
ChatType
[];
list
:
ChatType
[];
total
:
number
;
}
|
null
;
export
const
STATE_SINGLE_CHAT
=
"单独的会话"
;
export
const
STATE_SINGLE_CHAT
=
"单独的会话"
;
export
type
STATE_SINGLE_CHAT
=
ChatType
|
null
;
export
type
STATE_SINGLE_CHAT
=
ChatType
|
null
;
export
const
STATE_CHAT_MSG_HISTORY
=
"某个会话聊天记录"
;
export
const
STATE_CHAT_MSG_HISTORY
=
"某个会话聊天记录"
;
...
...
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