feat: 补充前端

This commit is contained in:
橙子
2024-08-07 00:03:07 +08:00
parent 578d410b77
commit 5a4d00a788
2 changed files with 47 additions and 31 deletions

View File

@@ -4,11 +4,11 @@ import { dayjs } from 'element-plus'
const receiveMsg=(connection)=> { const receiveMsg=(connection)=> {
const noticeStore = useNoticeStore(); const noticeStore = useNoticeStore();
connection.on("Personal", (message) => { connection.on("Personal", (message,creationTime) => {
noticeStore.addNotice({ noticeStore.addNotice({
message:message, message:message,
isRead:false, isRead:false,
creationTime:dayjs().format() creationTime
}); });
}); });
}; };

View File

@@ -11,9 +11,7 @@
<el-menu-item index="1" @click="enterIndex">主页</el-menu-item> <el-menu-item index="1" @click="enterIndex">主页</el-menu-item>
<el-menu-item index="2" @click="enterStart" <el-menu-item index="2" @click="enterStart"
style="color: red;font-weight: bolder;font-size: large;" style="color: red;font-weight: bolder;font-size: large;">开始</el-menu-item>
>开始</el-menu-item>
<el-sub-menu index="3"> <el-sub-menu index="3">
<template #title>学习</template> <template #title>学习</template>
@@ -85,10 +83,18 @@
</el-dropdown-item> </el-dropdown-item>
<el-dropdown-item v-for="(item, index) in noticeList" :key="index"> <el-dropdown-item class="notice-item" v-for="(item, index) in noticeList" :key="index">
<div v-if="item.isRead" class="notice-msg" v-html="item.message"></div>
<div v-if="item.isRead" class="notice-msg" style="background-color: #f7f7f7;">
<span class="notice-time">[已读]通知时间 {{ dayjs(item.creationTime).format('YYYY年M月D日 HH时mm分ss秒') }}</span>
<div v-html="item.message"></div>
</div>
<el-badge is-dot v-else > <el-badge is-dot v-else >
<span class="notice-time">[未读]通知时间 {{ dayjs(item.creationTime).format('YYYY年M月D日 HH时mm分ss秒') }}</span>
<div class="notice-msg" v-html="item.message"></div> <div class="notice-msg" v-html="item.message"></div>
</el-badge> </el-badge>
@@ -118,6 +124,7 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { dayjs } from 'element-plus'
import { Bell } from '@element-plus/icons-vue' import { Bell } from '@element-plus/icons-vue'
import AvatarInfo from "@/components/AvatarInfo.vue"; import AvatarInfo from "@/components/AvatarInfo.vue";
import { computed, onMounted, ref } from "vue"; import { computed, onMounted, ref } from "vue";
@@ -219,6 +226,13 @@ const enterStart=()=>{
<style scoped lang="scss"> <style scoped lang="scss">
.notice-item{
padding: 10px 0px 30px 20px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.notice-time{
font-size: larger;
}
.money { .money {
font-size: small; font-size: small;
@@ -302,11 +316,13 @@ const enterStart=()=>{
.notice { .notice {
margin: 0 5px; margin: 0 5px;
&-oper { &-oper {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
width: 100%; width: 100%;
} }
&-msg { &-msg {
white-space: wrap !important; white-space: wrap !important;
width: 400px; width: 400px;