|
@@ -1,64 +1,80 @@
|
|
|
<template>
|
|
|
- <div ref="messageIcon" class="message-icon">
|
|
|
- <span v-show="unReadMessages?.newCount" class="un-read-num"></span>
|
|
|
- <svg-icon name="message"></svg-icon>
|
|
|
- </div>
|
|
|
- <el-popover
|
|
|
- placement="bottom-start"
|
|
|
- :width="useVW(400)"
|
|
|
- :show-arrow="false"
|
|
|
- :virtual-ref="messageIcon"
|
|
|
- trigger="click"
|
|
|
- virtual-triggering
|
|
|
- >
|
|
|
- <div class="message-popover-content">
|
|
|
- <div class="title">
|
|
|
- <span class="unread-count">{{ unReadMessages?.newCount || 0 }}</span>
|
|
|
- <span>条消息</span>
|
|
|
- </div>
|
|
|
- <div class="message-list">
|
|
|
- <div class="flex message-row">
|
|
|
- <div class="message-send-user">
|
|
|
- <div class="user-name">陈晓明</div>
|
|
|
- <div class="message-time">20:88:33</div>
|
|
|
- </div>
|
|
|
- <div class="flex-1 message-content">
|
|
|
- 啥可适当就卡省的就卡省的就看撒好的就卡省的就看撒好的金卡和健康大使金卡是框架啥可适当就卡省的就卡省的就看撒好的就卡省的就看撒好的金卡和健康大使金卡是框架
|
|
|
- </div>
|
|
|
+ <message-component>
|
|
|
+ <div ref="messageIcon" class="message-icon">
|
|
|
+ <span v-show="unReadMessages?.newCount" class="un-read-num"></span>
|
|
|
+ <svg-icon name="message"></svg-icon>
|
|
|
+ </div>
|
|
|
+ <el-popover
|
|
|
+ placement="bottom-start"
|
|
|
+ :width="useVW(400)"
|
|
|
+ :show-arrow="false"
|
|
|
+ :virtual-ref="messageIcon"
|
|
|
+ trigger="click"
|
|
|
+ virtual-triggering
|
|
|
+ >
|
|
|
+ <div class="message-popover-content">
|
|
|
+ <div class="title">
|
|
|
+ <span class="unread-count">{{ unReadMessages?.newCount || 0 }}</span>
|
|
|
+ <span>条消息</span>
|
|
|
</div>
|
|
|
- <div class="flex message-row">
|
|
|
- <div class="message-send-user">
|
|
|
- <div class="user-name">陈明</div>
|
|
|
- <div class="message-time">20:88:33</div>
|
|
|
+ <div class="message-list">
|
|
|
+ <div class="flex message-row">
|
|
|
+ <div class="message-send-user">
|
|
|
+ <div class="user-name">陈晓明</div>
|
|
|
+ <div class="message-time">20:88:33</div>
|
|
|
+ </div>
|
|
|
+ <div class="flex-1 message-content">
|
|
|
+ 啥可适当就卡省的就卡省的就看撒好的就卡省的就看撒好的金卡和健康大使金卡是框架啥可适当就卡省的就卡省的就看撒好的就卡省的就看撒好的金卡和健康大使金卡是框架
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- <div class="flex-1 message-content">
|
|
|
- 啥可适当就卡省的就卡省的就看撒好的就卡省的就看撒好的金卡和健康大使金卡是框架啥可适当就卡省的就卡省的就看撒好的就卡省的就看撒好的金卡和健康大使金卡是框架
|
|
|
+ <div class="flex message-row">
|
|
|
+ <div class="message-send-user">
|
|
|
+ <div class="user-name">陈明</div>
|
|
|
+ <div class="message-time">20:88:33</div>
|
|
|
+ </div>
|
|
|
+ <div class="flex-1 message-content">
|
|
|
+ 啥可适当就卡省的就卡省的就看撒好的就卡省的就看撒好的金卡和健康大使金卡是框架啥可适当就卡省的就卡省的就看撒好的就卡省的就看撒好的金卡和健康大使金卡是框架
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <confirm-button
|
|
|
+ size="small"
|
|
|
+ between
|
|
|
+ ok-text="收消息"
|
|
|
+ cancel-text="发消息"
|
|
|
+ @confirm="onReceiveMessage"
|
|
|
+ @cancel="onSendMessage"
|
|
|
+ ></confirm-button>
|
|
|
</div>
|
|
|
- <confirm-button
|
|
|
- size="small"
|
|
|
- between
|
|
|
- ok-text="收消息"
|
|
|
- cancel-text="发消息"
|
|
|
- @confirm="onReceiveMessage"
|
|
|
- @cancel="onSendMessage"
|
|
|
- ></confirm-button>
|
|
|
- </div>
|
|
|
- </el-popover>
|
|
|
- <message-window v-model="visibleMessageWindow" :type="messageWindowType"></message-window>
|
|
|
+ </el-popover>
|
|
|
+ <message-window v-model="visibleMessageWindow" :type="messageWindowType"></message-window>
|
|
|
+ </message-component>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="Message">
|
|
|
/** 头部消息组件 */
|
|
|
-import { reactive, ref } from 'vue'
|
|
|
+import { defineComponent, ref, useSlots } from 'vue'
|
|
|
import { ElPopover } from 'element-plus'
|
|
|
import useVW from '@/hooks/useVW'
|
|
|
import useMessageLoop from '@/hooks/useMessageLoop'
|
|
|
+import useMainStore from '@/store/main'
|
|
|
import MessageWindow from '@/components/shared/message/MessageWindow.vue'
|
|
|
import ConfirmButton from '@/components/common/ConfirmButton.vue'
|
|
|
import SvgIcon from '@/components/common/SvgIcon.vue'
|
|
|
|
|
|
+const MessageComponent = defineComponent({
|
|
|
+ setup() {
|
|
|
+ const mainStore = useMainStore()
|
|
|
+ return {
|
|
|
+ mainStore,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ render() {
|
|
|
+ const slots = useSlots()
|
|
|
+ return this.mainStore?.myUserInfo?.role === 'ADMIN' ? null : slots.default?.()
|
|
|
+ },
|
|
|
+})
|
|
|
+
|
|
|
const messageIcon = ref<HTMLDivElement>()
|
|
|
|
|
|
const unReadMessages = useMessageLoop()
|