Browse Source

change files status

master
godo 10 months ago
parent
commit
4d1cc402f4
  1. 6
      frontend/src/components/localchat/ChatContent.vue
  2. 14
      frontend/src/stores/localchat.ts

6
frontend/src/components/localchat/ChatContent.vue

@ -108,6 +108,12 @@ async function scroll({ scrollTop }: { scrollTop: number }) {
<span v-if="item.content.status === 'cannel'"> <span v-if="item.content.status === 'cannel'">
已拒绝 已拒绝
</span> </span>
<span v-if="item.content.status === 'accessing'">
接收中
</span>
<span v-if="item.content.status === 'accessed'">
已接收
</span>
</template> </template>
</el-card> </el-card>
</div> </div>

14
frontend/src/stores/localchat.ts

@ -370,7 +370,7 @@ export const useLocalChatStore = defineStore('localChatStore', () => {
console.log(saveMsg) console.log(saveMsg)
const msgId = await db.addOne('chatmsg', saveMsg) const msgId = await db.addOne('chatmsg', saveMsg)
//await getMsgList() //await getMsgList()
msgList.value.push(saveMsg)
const targetUser = userList.value.find((d: any) => d.ip === chatTargetIp.value) const targetUser = userList.value.find((d: any) => d.ip === chatTargetIp.value)
//console.log(targetUser) //console.log(targetUser)
const messages = { const messages = {
@ -401,23 +401,22 @@ export const useLocalChatStore = defineStore('localChatStore', () => {
console.log(completion) console.log(completion)
notifyError("发送失败!") notifyError("发送失败!")
} else { } else {
saveMsg.content = messages.message
saveMsg.isRead = true saveMsg.isRead = true
saveMsg.status = 'sended' saveMsg.status = 'sended'
saveMsg.readAt = Date.now() saveMsg.readAt = Date.now()
await db.update('chatmsg', msgId, saveMsg) await db.update('chatmsg', msgId, saveMsg)
// if(type === 'applyfile'){
// notifySuccess("发送成功!")
// }
} }
await updateContentList(saveMsg) await updateContentList(saveMsg)
}else{ }else{
notifyError("对方不在线!") notifyError("对方不在线!")
} }
msgList.value.push(saveMsg)
sendInfo.value = "" sendInfo.value = ""
} }
async function cannelFile(item:any){ async function cannelFile(item:any){
const messages = { const messages = {
type: 'cannelFile', type: 'cannelFile',
message: item.content.msgId, message: item.content.msgId,
@ -439,7 +438,8 @@ export const useLocalChatStore = defineStore('localChatStore', () => {
} }
} }
async function changeMsg(msg:any){ async function changeMsg(msg:any){
const msgId = msg.content.msgId console.log(msg)
const msgId = msg.message
const item = await db.getOne('chatmsg', msgId) const item = await db.getOne('chatmsg', msgId)
item.content.status = 'cannel' item.content.status = 'cannel'
await db.update('chatmsg', item.id, item) await db.update('chatmsg', item.id, item)

Loading…
Cancel
Save