From ac67215c782c6425b1d9255ba483a4f0e27de87a Mon Sep 17 00:00:00 2001 From: chenxing Date: Fri, 9 Oct 2026 15:06:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(header):=20WS=20=E5=AE=9E=E6=97=B6?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E5=8D=A1=E7=89=87=E8=90=BD=E5=9C=B0=20design?= =?UTF-8?q?/03=20.ws-toast=E2=80=94=E2=80=94=E7=B1=BB=E5=9E=8B=E8=89=B2?= =?UTF-8?q?=E6=9D=A1+=E5=9B=BE=E6=A0=87=E7=AB=A0+=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=9D=A1=208s=20=E8=87=AA=E5=8A=A8=E6=B6=88=E9=80=80+=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E8=BF=9B=20/msg=EF=BC=8C=E6=9B=BF=E4=BB=A3=20Notice.i?= =?UTF-8?q?nfo=20=E4=B8=B4=E6=97=B6=E5=8D=A1=E7=89=87=EF=BC=88=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E7=9B=B4=E6=89=B9=E6=8C=89=E9=92=AE=E6=9C=AC=E6=9C=9F?= =?UTF-8?q?=E4=B8=8D=E5=81=9A=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.vue | 23 +-- src/components/WsToastLayer.vue | 275 ++++++++++++++++++++++++++++++++ 2 files changed, 282 insertions(+), 16 deletions(-) create mode 100644 src/components/WsToastLayer.vue diff --git a/src/components/Header.vue b/src/components/Header.vue index 81ea9fc..4b0658e 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -79,6 +79,9 @@ + + + @@ -236,7 +239,7 @@ import ContextMenu from "@/components/ContextMenu.vue"; import TeacherCopilotModal from "@/components/TeacherCopilotModal.vue"; import BaseApi from "@/api/BaseApi"; import MsgApprovalModal from "@/components/MsgApprovalModal.vue"; -import { Notice } from "view-ui-plus"; +import WsToastLayer from "@/components/WsToastLayer.vue"; import { IframePageParmas, RoleInfo } from "@/types"; import { isEqual, orderBy } from "lodash"; import UserSettingApi from "@/api/UserSettingApi"; @@ -249,6 +252,7 @@ import { openAppPage } from "@/utils/bschLinkPage"; const route = useRoute(); const router = useRouter(); +const wsToastRef = ref>(); const store = useDefaultStore(); const refMsgApproval = ref(); const { $conf } = useCurrentInstance(); @@ -338,11 +342,6 @@ async function connectMsgWs() { }; } -/** WS 通知标题用类型标签(appKey 属后端签名标识,帧消费已随 0e57022 口径移除) */ -function frameAppName(frame: any) { - return msgTypeLabel(frame ? frame.msgType : null); -} - function onNewMessage(frame: any) { // 他校新消息对当前学校口径无信息量(不计未读、不打扰、也不触发 /msg 页重拉) if (!bellVisibleForCurrentSchool(frame)) { @@ -351,11 +350,8 @@ function onNewMessage(frame: any) { store.incUnread(); // /msg 页开着时自刷新(页内监听该事件重拉第一页与摘要) mittBus.emit("msgCenter:newMessage", frame); - Notice.info({ - title: `【${frameAppName(frame)}】新消息`, - desc: frame.content || "", - duration: 5, - }); + // design/03 .ws-toast 实时卡片(2026-10-09):类型色条+图标章+进度条自动消退,点击进 /msg + wsToastRef.value?.push(frame); } /** @@ -533,11 +529,6 @@ async function changeRole(role: RoleInfo) { await loadLogoList(); } -/** 消息类型名(UserMsg msgType:0系统通知/1业务提醒/2审批待办);WS 帧缺 appName 时的降级标签 */ -function msgTypeLabel(msgType: number | null) { - return { 0: "系统通知", 1: "业务提醒", 2: "审批待办" }[msgType as 0 | 1 | 2] || "系统通知"; -} - async function wallpaperSuccess(response: any, file: any, fileListt: any) { await getUserWallpaperList(); } diff --git a/src/components/WsToastLayer.vue b/src/components/WsToastLayer.vue new file mode 100644 index 0000000..9f24753 --- /dev/null +++ b/src/components/WsToastLayer.vue @@ -0,0 +1,275 @@ + + + + +