|
@@ -1,18 +1,85 @@
|
|
<template>
|
|
<template>
|
|
- <div class="message-icon">
|
|
|
|
|
|
+ <div ref="messageIcon" class="message-icon">
|
|
|
|
+ <span v-show="unReadMessages?.newCount" class="un-read-num"></span>
|
|
<svg-icon name="message"></svg-icon>
|
|
<svg-icon name="message"></svg-icon>
|
|
</div>
|
|
</div>
|
|
|
|
+ <el-popover
|
|
|
|
+ placement="bottom-start"
|
|
|
|
+ :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>
|
|
|
|
+ <confirm-button
|
|
|
|
+ ok-text="收消息"
|
|
|
|
+ cancel-text="发消息"
|
|
|
|
+ @confirm="onReceiveMessage"
|
|
|
|
+ @cancel="onSendMessage"
|
|
|
|
+ ></confirm-button>
|
|
|
|
+ </div>
|
|
|
|
+ </el-popover>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="Message">
|
|
<script setup lang="ts" name="Message">
|
|
import { reactive, ref } from 'vue'
|
|
import { reactive, ref } from 'vue'
|
|
-import SvgIcon from '../common/SvgIcon.vue'
|
|
|
|
|
|
+import { ElPopover } from 'element-plus'
|
|
|
|
+import SvgIcon from '@/components/common/SvgIcon.vue'
|
|
|
|
+import useMessageLoop from '@/hooks/useMessageLoop'
|
|
|
|
+import ConfirmButton from '../common/ConfirmButton.vue'
|
|
|
|
+
|
|
|
|
+const messageIcon = ref<HTMLDivElement>()
|
|
|
|
+
|
|
|
|
+const unReadMessages = useMessageLoop()
|
|
|
|
+
|
|
|
|
+/** 收消息 */
|
|
|
|
+const onReceiveMessage = () => {
|
|
|
|
+ console.log('收消息')
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/** 发消息 */
|
|
|
|
+const onSendMessage = () => {
|
|
|
|
+ console.log('发消息')
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
.message-icon {
|
|
.message-icon {
|
|
display: grid;
|
|
display: grid;
|
|
place-items: center;
|
|
place-items: center;
|
|
- font-size: $MediumFont;
|
|
|
|
|
|
+ font-size: $LargeFont;
|
|
|
|
+ position: relative;
|
|
|
|
+ .un-read-num {
|
|
|
|
+ position: absolute;
|
|
|
|
+ width: 8px;
|
|
|
|
+ height: 8px;
|
|
|
|
+ right: -2px;
|
|
|
|
+ top: -2px;
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ background-color: $DangerColor;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+.message-popover-content {
|
|
|
|
+ .title {
|
|
|
|
+ .unread-count {
|
|
|
|
+ font-size: $MediumFont;
|
|
|
|
+ color: $DangerColor;
|
|
|
|
+ margin-right: 4px;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ .message-list {
|
|
|
|
+ .message-row {
|
|
|
|
+ padding: 10px 4px;
|
|
|
|
+ .message-send-user {
|
|
|
|
+ }
|
|
|
|
+ .message-content {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|