@@ -73,15 +73,26 @@ const dialog = reactive<DialogOption>({
|
|||||||
title: ''
|
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) => {
|
const handleSee = async (row: any) => {
|
||||||
console.log('查看画面', row);
|
const videoId = row?.videoId;
|
||||||
// 在这里可以添加打开画面的逻辑
|
console.log('查看画面', row, 'videoId', videoId);
|
||||||
// if (!row || !row.videoUrl) {
|
if (!videoId) {
|
||||||
// proxy?.$modal.msgError('视频地址不存在');
|
proxy?.$modal.msgError('视频ID不存在');
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
await videosStore.getVideos('2057338485989367810');
|
await videosStore.getVideos(videoId);
|
||||||
monitorVideoUrl.value = videosStore.hisUrl;
|
monitorVideoUrl.value = videosStore.hisUrl;
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
await nextTick();
|
await nextTick();
|
||||||
@@ -115,8 +126,8 @@ const getTableData = async () => {
|
|||||||
state.loading = true;
|
state.loading = true;
|
||||||
const allNotices = [...noticeStore.state.notices]; // 复制数组避免直接修改原数据
|
const allNotices = [...noticeStore.state.notices]; // 复制数组避免直接修改原数据
|
||||||
|
|
||||||
// 过滤消息
|
// 过滤消息并解析 message/videoId
|
||||||
const filteredNotices = filterMessages(allNotices);
|
const filteredNotices = filterMessages(allNotices).map(parseNoticeItem);
|
||||||
newsList.value = filteredNotices;
|
newsList.value = filteredNotices;
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
};
|
};
|
||||||
@@ -125,7 +136,7 @@ const getTableData = async () => {
|
|||||||
watch(
|
watch(
|
||||||
() => noticeStore.state.notices,
|
() => noticeStore.state.notices,
|
||||||
(newNotices) => {
|
(newNotices) => {
|
||||||
const filteredNotices = filterMessages([...newNotices]);
|
const filteredNotices = filterMessages([...newNotices]).map(parseNoticeItem);
|
||||||
newsList.value = filteredNotices;
|
newsList.value = filteredNotices;
|
||||||
console.log('监听消息队列', newsList.value);
|
console.log('监听消息队列', newsList.value);
|
||||||
},
|
},
|
||||||
@@ -148,11 +159,13 @@ const onNewsClick = (item: any) => {
|
|||||||
|
|
||||||
// 辅助函数:找到原始索引
|
// 辅助函数:找到原始索引
|
||||||
const findOriginalIndex = (filteredIndex: number) => {
|
const findOriginalIndex = (filteredIndex: number) => {
|
||||||
const filteredNotices = filterMessages([...noticeStore.state.notices]);
|
const filteredNotices = filterMessages([...noticeStore.state.notices]).map(parseNoticeItem);
|
||||||
const currentMessage = filteredNotices[filteredIndex];
|
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
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 前往通知中心点击
|
// 前往通知中心点击
|
||||||
|
|||||||
Reference in New Issue
Block a user