From 4d1cc402f43ab0f19b30929a9e4443a96ea89d89 Mon Sep 17 00:00:00 2001 From: godo Date: Tue, 10 Sep 2024 11:59:27 +0800 Subject: [PATCH] change files status --- frontend/src/components/localchat/ChatContent.vue | 6 ++++++ frontend/src/stores/localchat.ts | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/localchat/ChatContent.vue b/frontend/src/components/localchat/ChatContent.vue index ca8754f..168aafb 100644 --- a/frontend/src/components/localchat/ChatContent.vue +++ b/frontend/src/components/localchat/ChatContent.vue @@ -108,6 +108,12 @@ async function scroll({ scrollTop }: { scrollTop: number }) { 已拒绝 + + 接收中 + + + 已接收 + diff --git a/frontend/src/stores/localchat.ts b/frontend/src/stores/localchat.ts index 202a7ff..aa55ba1 100644 --- a/frontend/src/stores/localchat.ts +++ b/frontend/src/stores/localchat.ts @@ -370,7 +370,7 @@ export const useLocalChatStore = defineStore('localChatStore', () => { console.log(saveMsg) const msgId = await db.addOne('chatmsg', saveMsg) //await getMsgList() - msgList.value.push(saveMsg) + const targetUser = userList.value.find((d: any) => d.ip === chatTargetIp.value) //console.log(targetUser) const messages = { @@ -401,23 +401,22 @@ export const useLocalChatStore = defineStore('localChatStore', () => { console.log(completion) notifyError("发送失败!") } else { + saveMsg.content = messages.message saveMsg.isRead = true saveMsg.status = 'sended' saveMsg.readAt = Date.now() await db.update('chatmsg', msgId, saveMsg) - // if(type === 'applyfile'){ - // notifySuccess("发送成功!") - // } - } + await updateContentList(saveMsg) }else{ notifyError("对方不在线!") } + msgList.value.push(saveMsg) sendInfo.value = "" } - async function cannelFile(item:any){ + async function cannelFile(item:any){ const messages = { type: 'cannelFile', message: item.content.msgId, @@ -439,7 +438,8 @@ export const useLocalChatStore = defineStore('localChatStore', () => { } } async function changeMsg(msg:any){ - const msgId = msg.content.msgId + console.log(msg) + const msgId = msg.message const item = await db.getOne('chatmsg', msgId) item.content.status = 'cannel' await db.update('chatmsg', item.id, item)