From 2036d5c58d5f2c5d9794bda8e051b7e2cdf05007 Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Sun, 7 Jul 2024 17:23:44 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A=E5=92=8C=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/enums/MessageTypeEnum.ts | 15 ++ src/enums/NoticeTypeEnum.ts | 30 ++++ .../NavBar/components/NavbarAction.vue | 107 ++++++++++-- src/views/dashboard/components/VisitTrend.vue | 6 +- src/views/dashboard/index.vue | 159 ++++++++++++------ 5 files changed, 255 insertions(+), 62 deletions(-) create mode 100644 src/enums/MessageTypeEnum.ts create mode 100644 src/enums/NoticeTypeEnum.ts diff --git a/src/enums/MessageTypeEnum.ts b/src/enums/MessageTypeEnum.ts new file mode 100644 index 00000000..42a6fb94 --- /dev/null +++ b/src/enums/MessageTypeEnum.ts @@ -0,0 +1,15 @@ +/* 消息类型枚举 */ +export const enum MessageTypeEnum { + /* 消息 */ + MESSAGE = "MESSAGE", + /* 通知 */ + NOTICE = "NOTICE", + /* 待办 */ + TODO = "TODO", +} + +export const MessageTypeLabels = { + [MessageTypeEnum.MESSAGE]: "消息", + [MessageTypeEnum.NOTICE]: "通知", + [MessageTypeEnum.TODO]: "待办", +}; diff --git a/src/enums/NoticeTypeEnum.ts b/src/enums/NoticeTypeEnum.ts new file mode 100644 index 00000000..49c0f8eb --- /dev/null +++ b/src/enums/NoticeTypeEnum.ts @@ -0,0 +1,30 @@ +/* 通知类型枚举 */ +export const enum NoticeTypeEnum { + /** 系统升级 */ + SYSTEM_UPGRADE = "SYSTEM_UPGRADE", + /** 系统维护 */ + SYSTEM_MAINTENANCE = "SYSTEM_MAINTENANCE", + /** 安全警告 */ + SECURITY_ALERT = "SECURITY_ALERT", + /** 假期通知 */ + HOLIDAY_NOTICE = "HOLIDAY_NOTICE", + /** 公司新闻 */ + COMPANY_NEWS = "COMPANY_NEWS", + /** 其他通知 */ + OTHER = "OTHER", +} + +// 定义标签映射 +const NoticeTypeLabels: Record = { + [NoticeTypeEnum.SYSTEM_UPGRADE]: "系统升级", + [NoticeTypeEnum.SYSTEM_MAINTENANCE]: "系统维护", + [NoticeTypeEnum.SECURITY_ALERT]: "安全警告", + [NoticeTypeEnum.HOLIDAY_NOTICE]: "假期通知", + [NoticeTypeEnum.COMPANY_NEWS]: "公司新闻", + [NoticeTypeEnum.OTHER]: "其他通知", +}; + +// 导出获取标签函数 +export const getNoticeLabel = (type: NoticeTypeEnum): string => { + return NoticeTypeLabels[type] || ""; +}; diff --git a/src/layout/components/NavBar/components/NavbarAction.vue b/src/layout/components/NavBar/components/NavbarAction.vue index 6f199f79..d1d4eb21 100644 --- a/src/layout/components/NavBar/components/NavbarAction.vue +++ b/src/layout/components/NavBar/components/NavbarAction.vue @@ -20,10 +20,47 @@ + - +
+ +
+
@@ -71,6 +108,7 @@ import { } from "@/store"; import defaultSettings from "@/settings"; import { DeviceEnum } from "@/enums/DeviceEnum"; +import { MessageTypeEnum, MessageTypeLabels } from "@/enums/MessageTypeEnum"; const appStore = useAppStore(); const tagsViewStore = useTagsViewStore(); @@ -84,9 +122,49 @@ const isMobile = computed(() => appStore.device === DeviceEnum.MOBILE); const { isFullscreen, toggle } = useFullscreen(); -/** - * 注销 - */ +const activeTab = ref(MessageTypeEnum.MESSAGE); + +const messages = ref([ + { + id: 1, + title: "系统升级通知:服务器将于今晚12点进行升级维护,请提前保存工作内容。", + type: MessageTypeEnum.MESSAGE, + }, + { + id: 2, + title: "新功能发布:我们的应用程序现在支持多语言功能。", + type: MessageTypeEnum.MESSAGE, + }, + { + id: 3, + title: "重要提醒:请定期更改您的密码以保证账户安全。", + type: MessageTypeEnum.MESSAGE, + }, + { + id: 4, + title: "通知:您有一条未读的系统消息,请及时查看。", + type: MessageTypeEnum.NOTICE, + }, + { + id: 5, + title: "新订单通知:您有一笔新的订单需要处理。", + type: MessageTypeEnum.NOTICE, + }, + { + id: 6, + title: "审核提醒:您的审核请求已被批准。", + type: MessageTypeEnum.NOTICE, + }, + { id: 7, title: "待办事项:完成用户权限设置。", type: MessageTypeEnum.TODO }, + { id: 8, title: "待办事项:更新产品列表。", type: MessageTypeEnum.TODO }, + { id: 9, title: "待办事项:备份数据库。", type: MessageTypeEnum.TODO }, +]); + +const getFilteredMessages = (type: MessageTypeEnum) => { + return messages.value.filter((message) => message.type === type); +}; + +/* 注销 */ function logout() { ElMessageBox.confirm("确定注销并退出系统吗?", "提示", { confirmButtonText: "确定", @@ -121,18 +199,25 @@ function logout() { } :deep(.message .el-badge__content.is-fixed.is-dot) { - top: 10px; + top: 5px; + right: 10px; } -.layout-top, -.layout-mix { - .nav-action-item, - .el-icon { - color: var(--el-color-white); - } +:deep(.el-divider--horizontal) { + margin: 10px 0; } .dark .nav-action-item:hover { background: rgb(255 255 255 / 20%); } + +.see-more { + padding: 10px 0; + text-align: center; +} + +.see-more a { + color: var(--el-color-primary); + text-decoration: none; +} diff --git a/src/views/dashboard/components/VisitTrend.vue b/src/views/dashboard/components/VisitTrend.vue index 415986df..7e4960cc 100644 --- a/src/views/dashboard/components/VisitTrend.vue +++ b/src/views/dashboard/components/VisitTrend.vue @@ -95,7 +95,7 @@ const setChartOptions = (data: VisitTrendVO) => { type: "line", data: data.pvList, areaStyle: { - color: "rgba(64, 158, 255, 0.3)", + color: "rgba(64, 158, 255, 0.1)", }, smooth: true, itemStyle: { @@ -110,7 +110,7 @@ const setChartOptions = (data: VisitTrendVO) => { type: "line", data: data.ipList, areaStyle: { - color: "rgba(103, 194, 58, 0.3)", + color: "rgba(103, 194, 58, 0.1)", }, smooth: true, itemStyle: { @@ -187,7 +187,7 @@ const handleDownloadChart = () => { if (ctx) { ctx.drawImage(img, 0, 0, img.width, img.height); const link = document.createElement("a"); - link.download = `业绩柱状图.png`; + link.download = `访问趋势.png`; link.href = canvas.toDataURL("image/png", 0.9); document.body.appendChild(link); link.click(); diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index e71679ca..303ad176 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -72,17 +72,20 @@ v-for="(item, index) in visitStatsList" :key="index" > - + -