Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fns_front_2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenqikuai
fns_front_2
Commits
58343dae
Commit
58343dae
authored
Sep 27, 2021
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复删除消息时的bug
parent
2ccd1b9e
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
7 deletions
+37
-7
ChatMessageDB.ts
src/db/ChatMessageDB.ts
+29
-3
index.ts
src/db/index.ts
+1
-1
Chat.vue
src/views/Chat/Chat.vue
+6
-2
ChatContentMessage.vue
src/views/Chat/ChatContentMessage.vue
+1
-1
No files found.
src/db/ChatMessageDB.ts
View file @
58343dae
...
...
@@ -28,11 +28,37 @@ export default class ChatMessageDB extends MyAppDatabase {
})
}
deleteMsg
({
uuid
,
logid
}:
{
uuid
?:
string
;
logid
?:
string
})
{
async
deleteMsg
({
uuid
,
logid
}:
{
uuid
?:
string
;
logid
?:
string
})
{
const
updateChatList
=
async
(
masterId
:
string
,
target
:
string
)
=>
{
const
latestedMsg
=
await
this
.
chatMessage
.
filter
((
i
)
=>
i
.
masterId
===
masterId
&&
i
.
target
==
target
)
.
last
()
if
(
latestedMsg
)
{
/* 如果和target还有聊天消息 */
// latestedMsg.content.content
this
.
chatListCard
.
filter
((
i
)
=>
i
.
masterId
===
masterId
&&
i
.
targetId
===
target
)
.
modify
((
i
)
=>
(
i
.
content
=
latestedMsg
.
content
.
content
as
string
))
}
else
{
/* 如果和target没有聊天消息 */
this
.
chatListCard
.
filter
((
i
)
=>
i
.
masterId
===
masterId
&&
i
.
targetId
===
target
)
.
modify
((
i
)
=>
(
i
.
content
=
''
))
}
}
if
(
uuid
)
{
return
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
delete
()
// console.log(uuid, 'uuid')
const
item
=
await
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
first
()
// console.log(item, 'delted msg')
await
this
.
chatMessage
.
where
(
'uuid'
).
equals
(
uuid
).
delete
()
item
&&
updateChatList
(
item
?.
masterId
,
item
?.
target
as
string
)
}
else
if
(
logid
)
{
return
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
delete
()
// console.log(logid, 'logid')
const
item
=
await
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
first
()
await
this
.
chatMessage
.
where
(
'logid'
).
equals
(
logid
).
delete
()
item
&&
updateChatList
(
item
?.
masterId
,
item
?.
target
as
string
)
}
else
{
throw
new
Error
(
'没有uuid或者logid'
)
}
...
...
src/db/index.ts
View file @
58343dae
...
...
@@ -3,7 +3,7 @@ import { DisplayMessage } from '@/store/messagesStore'
import
{
iContact
,
iUserinfo
}
from
'@/service/UserService/types'
export
interface
iChatMessage
extends
DisplayMessage
{
masterId
:
string
masterId
:
string
// 这条消息展示在谁的页面上
}
export
interface
iChatListCard
{
...
...
src/views/Chat/Chat.vue
View file @
58343dae
...
...
@@ -69,6 +69,8 @@ export default defineComponent({
const
optionList
=
[
{
name
:
'常用问题'
,
id
:
1
},
{
name
:
'人工服务'
,
id
:
2
},
{
name
:
'电话咨询'
,
id
:
3
},
];
const
setShowSentences
=
(
show
:
boolean
)
=>
...
...
@@ -92,6 +94,10 @@ export default defineComponent({
}
else
{
setShowSentences
(
false
)
}
if
(
selectedChatOption
.
value
===
3
)
{
}
})
const
useSentence
=
(
content
:
string
)
=>
{
...
...
@@ -150,8 +156,6 @@ export default defineComponent({
})
return
{
connectionState
,
selected
,
...
...
src/views/Chat/ChatContentMessage.vue
View file @
58343dae
...
...
@@ -157,7 +157,7 @@ export default defineComponent({
const
textMsgActions
=
[
{
text
:
'删除'
,
cb
(
data
:
{
content
:
any
,
uuid
:
string
,
logid
?:
string
})
{
text
:
'删除'
,
cb
(
data
:
{
content
:
any
,
uuid
:
string
,
logid
?:
string
,
})
{
ChatMessageDB
.
getInstance
().
deleteMsg
({
uuid
:
data
.
uuid
,
logid
:
data
.
logid
});
const
index
=
messageStore
.
messages
.
findIndex
(
i
=>
{
return
i
.
uuid
===
data
.
uuid
...
...
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