fix(projects): 修复消息通知字典值未处理问题

This commit is contained in:
xlsea
2025-09-12 10:04:36 +08:00
parent 34ab7d5da2
commit 3f148a4e62

View File

@ -1,6 +1,7 @@
import { watch } from 'vue'; import { watch } from 'vue';
import { useEventSource } from '@vueuse/core'; import { useEventSource } from '@vueuse/core';
import useNoticeStore from '@/store/modules/notice'; import useNoticeStore from '@/store/modules/notice';
import { $t } from '@/locales';
import { localStg } from './storage'; import { localStg } from './storage';
// 初始化 // 初始化
@ -34,9 +35,14 @@ export const initSSE = (url: any) => {
read: false, read: false,
time: new Date().toLocaleString() time: new Date().toLocaleString()
}); });
let content = data.value;
const noticeType = content.match(/\[dict\.(.*?)\]/)?.[1];
if (noticeType) {
content = content.replace(`dict.${noticeType}`, $t(`dict.${noticeType}` as App.I18n.I18nKey));
}
window.$notification?.create({ window.$notification?.create({
title: '消息', title: '消息',
content: data.value, content,
type: 'success', type: 'success',
duration: 3000 duration: 3000
}); });