|
@ -28,16 +28,25 @@ export const useLocalChatStore = defineStore('localChatStore', () => { |
|
|
const chatTargetIp = ref("") |
|
|
const chatTargetIp = ref("") |
|
|
const showAddUser = ref(false) |
|
|
const showAddUser = ref(false) |
|
|
const handlerMessage = (data : any) => { |
|
|
const handlerMessage = (data : any) => { |
|
|
//console.log(data)
|
|
|
console.log(data) |
|
|
if(data.onlines && data.onlines.length > 0){ |
|
|
if(data.onlines && data.onlines.length > 0){ |
|
|
setUserList(data.onlines); |
|
|
setUserList(data.onlines); |
|
|
} |
|
|
} |
|
|
if(data.messages){ |
|
|
if(data.messages){ |
|
|
for(let i = 0; i < data.messages.length; i++){ |
|
|
for(let ip in data.messages){ |
|
|
const msg = data.messages[i]; |
|
|
const msgList:any = data.messages[ip].messages |
|
|
if(msg.type == 'text'){ |
|
|
if(!msgList || msgList.length < 1)return; |
|
|
addText(msg); |
|
|
msgList.forEach((msg: any) => { |
|
|
} |
|
|
//console.log(msg)
|
|
|
|
|
|
if (msg.type === "text") { |
|
|
|
|
|
msg.message = msg.message.replaceAll("\\n", "\n") |
|
|
|
|
|
console.log(msg) |
|
|
|
|
|
addText(msg) |
|
|
|
|
|
} |
|
|
|
|
|
//console.log(msg)
|
|
|
|
|
|
//console.log(msg.content)
|
|
|
|
|
|
//console.log(msg.content.length)
|
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -316,6 +325,10 @@ export const useLocalChatStore = defineStore('localChatStore', () => { |
|
|
targetId: targetUser.id, |
|
|
targetId: targetUser.id, |
|
|
targetIp: targetUser.ip, |
|
|
targetIp: targetUser.ip, |
|
|
content: data.message, |
|
|
content: data.message, |
|
|
|
|
|
reciperInfo:{ |
|
|
|
|
|
hostname: data.hostname, |
|
|
|
|
|
username: data.hostname |
|
|
|
|
|
}, |
|
|
createdAt: Date.now(), |
|
|
createdAt: Date.now(), |
|
|
isMe: false, |
|
|
isMe: false, |
|
|
isRead: false, |
|
|
isRead: false, |
|
|