|
|
@@ -98,8 +98,9 @@ export const useAppStore = defineStore('ie-app', {
|
|
|
if (rows && rows.length) {
|
|
|
const notice = extractMaintenanceContent(rows[0].noticeContent);
|
|
|
if (notice) {
|
|
|
- const { beginTime, endTime, content } = notice;
|
|
|
+ const { title, beginTime, endTime, content } = notice;
|
|
|
this.maintainNotice = {
|
|
|
+ title,
|
|
|
beginTime,
|
|
|
endTime,
|
|
|
content,
|
|
|
@@ -152,17 +153,17 @@ const convertToStandardFormat = (dateStr: string): string => {
|
|
|
};
|
|
|
|
|
|
function extractMaintenanceContent(htmlString: string): System.MaintainNotice | null {
|
|
|
- const content = htmlString.replaceAll("</p><p>", "\n").replaceAll("</p>", "").replaceAll("<br>", "").replaceAll("<p>", "");
|
|
|
+ const htmlContent = htmlString.replaceAll("</p><p>", "\n").replaceAll("</p>", "").replaceAll("<br>", "").replaceAll("<p>", "");
|
|
|
// 使用正则表达式匹配维护时间范围(完整的一次匹配)
|
|
|
- const timeMatch = content.match(/维护开始时间:(\d{4}年\d{1,2}月\d{1,2}日\d{1,2}:\d{1,2}:\d{1,2})\n维护结束时间:(\d{4}年\d{1,2}月\d{1,2}日\d{1,2}:\d{1,2}:\d{1,2})/);
|
|
|
+ const timeMatch = htmlContent.match(/维护开始时间:(\d{4}年\d{1,2}月\d{1,2}日\d{1,2}:\d{1,2}:\d{1,2})\n维护结束时间:(\d{4}年\d{1,2}月\d{1,2}日\d{1,2}:\d{1,2}:\d{1,2})/);
|
|
|
if (timeMatch) {
|
|
|
// 提取开始时间和结束时间
|
|
|
const startTimeStr = timeMatch[1];
|
|
|
const endTimeStr = timeMatch[2];
|
|
|
const beginTime = convertToStandardFormat(startTimeStr);
|
|
|
const endTime = convertToStandardFormat(endTimeStr);
|
|
|
-
|
|
|
- return { content, beginTime, endTime, read: false };
|
|
|
+ const rows = htmlContent.split('\n');
|
|
|
+ return { title: rows[0], content: rows[3], beginTime, endTime, read: false };
|
|
|
}
|
|
|
return null;
|
|
|
}
|