参会角色变化时,清空local storage中的数据
This commit is contained in:
@ -559,7 +559,8 @@ const initWebSocket = () => {
|
||||
|
||||
// 监听websocket消息
|
||||
socket.addEventListener("message", async (event) => {
|
||||
// console.log(JSON.parse(event.data));
|
||||
console.log(JSON.parse(event.data));
|
||||
console.log(event.data);
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(JSON.parse(event.data));
|
||||
@ -567,7 +568,7 @@ const initWebSocket = () => {
|
||||
console.log(error);
|
||||
data = JSON.parse(event.data);
|
||||
}
|
||||
console.log(data);
|
||||
|
||||
// 会议信息更新时
|
||||
if (data.type === "isRefreshMeeting") {
|
||||
await store.dispatch("getMeetingInfo", store.getters.meetingId);
|
||||
@ -579,10 +580,8 @@ const initWebSocket = () => {
|
||||
}
|
||||
// 收到聊天消息时
|
||||
else if (data.type === "isChat") {
|
||||
console.log(data.content);
|
||||
console.log(JSON.parse(JSON.parse(JSON.parse(data.content).msg)));
|
||||
messages.value.push({
|
||||
...JSON.parse(JSON.parse(JSON.parse(data.content).msg)),
|
||||
...JSON.parse(data.content),
|
||||
id: uniqueId(),
|
||||
time: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||
});
|
||||
@ -654,14 +653,17 @@ initWebSocket();
|
||||
const messages = ref([]);
|
||||
messages.value = store.state.messagesList.map((msg) => msg);
|
||||
const sendMessage = (msgObj) => {
|
||||
console.log(JSON.stringify(JSON.stringify(msgObj)));
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
account: joinName.value,
|
||||
msg: msgObj.msg,
|
||||
})
|
||||
);
|
||||
socket.send(
|
||||
JSON.stringify(
|
||||
JSON.stringify({
|
||||
account: joinName.value,
|
||||
msg: msgObj.msg,
|
||||
})
|
||||
)
|
||||
JSON.stringify({
|
||||
account: joinName.value,
|
||||
msg: msgObj.msg,
|
||||
})
|
||||
);
|
||||
messages.value.push(msgObj);
|
||||
nextTick(() => {
|
||||
|
Reference in New Issue
Block a user