♻️ 公告页样式重构

This commit is contained in:
BTMuli
2023-10-15 16:57:48 +08:00
parent cbce3eda60
commit 3691397cec
4 changed files with 158 additions and 152 deletions

View File

@@ -1,8 +1,7 @@
/**
* @file web utils transAnno.ts
* @description 公告数据转换工具
* @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.1.2
* @since Beta v0.3.3
*/
// 默认封面图
@@ -10,7 +9,7 @@ const defaultCover = "/source/UI/defaultCover.webp";
/**
* @description 将获取到的数据转为渲染用的卡片
* @since Alpha v0.1.2
* @since Beta v0.3.3
* @param {TGApp.BBS.Announcement.ListData[]} data 公告数据
* @returns {TGApp.App.Announcement.ListCard[]} 渲染用的卡片
*/
@@ -20,6 +19,9 @@ export function getAnnoCard(
const cards: TGApp.App.Announcement.ListCard[] = [];
data.list.map((annoList: TGApp.BBS.Announcement.ListItem) => {
return annoList.list.map((anno: TGApp.BBS.Announcement.AnnoSingle) => {
const timeStart = anno.start_time.split(" ")[0];
const timeEnd = anno.end_time.split(" ")[0];
const time = `${timeStart} ~ ${timeEnd}`;
return cards.push({
id: anno.ann_id,
title: anno.title,
@@ -27,8 +29,8 @@ export function getAnnoCard(
banner: anno.banner || defaultCover,
typeLabel: anno.type_label,
tagIcon: anno.tag_icon,
startTime: anno.start_time,
endTime: anno.end_time,
tagLabel: anno.tag_label,
timeStr: time,
});
});
});