Commit 6f9fd479 authored by 沈翠玲's avatar 沈翠玲

增加收到新消息提示

parent 292e88dd
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="message"> <div class="message">
<el-popover placement="bottom" :width="310" trigger="click"> <el-popover placement="bottom" :width="310" trigger="click">
<template #reference> <template #reference>
<el-badge :value="msgList.length" class="item"> <el-badge :value="msgList.length" class="item" @click="clickMsg">
<i :class="'iconfont icon-xiaoxi'" class="toolBar-icon"></i> <i :class="'iconfont icon-xiaoxi'" class="toolBar-icon"></i>
</el-badge> </el-badge>
</template> </template>
...@@ -39,6 +39,21 @@ ...@@ -39,6 +39,21 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> --> </el-tabs> -->
</el-popover> </el-popover>
<el-popover
:visible="visible"
placement="bottom"
title="收到1条新消息"
:width="200"
>
<template #reference>
<el-badge class="item">
<i :class="'iconfont icon-xiaoxi'" class="toolBar-icon" style="display: none"></i>
</el-badge>
</template>
<div>
{{socketStore.msg.title}}
</div>
</el-popover>
</div> </div>
</template> </template>
...@@ -55,6 +70,7 @@ ...@@ -55,6 +70,7 @@
const router = useRouter(); const router = useRouter();
const activeName = ref('first'); const activeName = ref('first');
const msgList = ref([]); const msgList = ref([]);
const visible = ref(false)
const socketStore = useSocketStore(); const socketStore = useSocketStore();
console.log('socketStore', socketStore) console.log('socketStore', socketStore)
const query = () => { const query = () => {
...@@ -70,6 +86,7 @@ ...@@ -70,6 +86,7 @@
}); });
} }
watch(() => socketStore.msg, (newValue, oldValue) => { watch(() => socketStore.msg, (newValue, oldValue) => {
visible.value = true
query() query()
}); });
import { getAppEnvConfig } from '@/utils/env'; import { getAppEnvConfig } from '@/utils/env';
...@@ -83,6 +100,9 @@ ...@@ -83,6 +100,9 @@
if (socketStore.ws){ if (socketStore.ws){
socketStore.sendMsg({ aa: 44 }); socketStore.sendMsg({ aa: 44 });
} }
const clickMsg = () => {
visible.value = false
}
const clickMessage = (item) => { const clickMessage = (item) => {
readMessage({ readMessage({
msgId: item.id msgId: item.id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment