mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
♻️ 公告页样式重构
This commit is contained in:
@@ -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,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user