From 05ee38b119c6b2df3625075401089195b72d52f0 Mon Sep 17 00:00:00 2001 From: Ironsp <1522278303@qq.com> Date: Tue, 26 May 2026 17:52:32 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E7=9B=B4=E6=92=AD=E6=B5=81=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Copilot --- src/layout/components/notice/index.vue | 37 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/layout/components/notice/index.vue b/src/layout/components/notice/index.vue index 497c5fe..16f8e9d 100644 --- a/src/layout/components/notice/index.vue +++ b/src/layout/components/notice/index.vue @@ -73,15 +73,26 @@ const dialog = reactive({ title: '' }); +const parseNoticeItem = (notice: any) => { + const rawMessage = String(notice.message ?? ''); + const [messagePart, videoIdPart] = rawMessage.split('|', 2); + return { + ...notice, + rawMessage, + message: messagePart?.trim() ?? rawMessage, + videoId: videoIdPart?.trim() ?? '' + }; +}; + //查看画面 const handleSee = async (row: any) => { - console.log('查看画面', row); - // 在这里可以添加打开画面的逻辑 - // if (!row || !row.videoUrl) { - // proxy?.$modal.msgError('视频地址不存在'); - // return; - // } - await videosStore.getVideos('2057338485989367810'); + const videoId = row?.videoId; + console.log('查看画面', row, 'videoId', videoId); + if (!videoId) { + proxy?.$modal.msgError('视频ID不存在'); + return; + } + await videosStore.getVideos(videoId); monitorVideoUrl.value = videosStore.hisUrl; dialog.visible = true; await nextTick(); @@ -115,8 +126,8 @@ const getTableData = async () => { state.loading = true; const allNotices = [...noticeStore.state.notices]; // 复制数组避免直接修改原数据 - // 过滤消息 - const filteredNotices = filterMessages(allNotices); + // 过滤消息并解析 message/videoId + const filteredNotices = filterMessages(allNotices).map(parseNoticeItem); newsList.value = filteredNotices; state.loading = false; }; @@ -125,7 +136,7 @@ const getTableData = async () => { watch( () => noticeStore.state.notices, (newNotices) => { - const filteredNotices = filterMessages([...newNotices]); + const filteredNotices = filterMessages([...newNotices]).map(parseNoticeItem); newsList.value = filteredNotices; console.log('监听消息队列', newsList.value); }, @@ -148,11 +159,13 @@ const onNewsClick = (item: any) => { // 辅助函数:找到原始索引 const findOriginalIndex = (filteredIndex: number) => { - const filteredNotices = filterMessages([...noticeStore.state.notices]); + const filteredNotices = filterMessages([...noticeStore.state.notices]).map(parseNoticeItem); const currentMessage = filteredNotices[filteredIndex]; // 在原始数组中查找对应消息的索引 - return noticeStore.state.notices.findIndex((notice: any) => notice.message === currentMessage.message && notice.time === currentMessage.time); + return noticeStore.state.notices.findIndex( + (notice: any) => String(notice.message) === currentMessage.rawMessage && notice.time === currentMessage.time + ); }; // 前往通知中心点击