This commit is contained in:
2025-12-04 14:22:53 +08:00
parent 37d78c742b
commit 7d8123a76d
12 changed files with 201 additions and 64 deletions

View File

@@ -3,8 +3,52 @@ type Item = {
'标题': string;
'描述': string;
'总结': string;
'标签': string[];
'类型': string;
'启动时间'?: string;
}
const tasks = [{
title: '非任务',
},
{
title: '运行中',
},
{
title: '已停止',
},
{
title: '个人计划',
},
{
title: '已完成',
},
{
title: 'AI自动化'
}
];
const types = [{
title: '每日',
},
{
title: '每周',
},
{
title: '每月',
},
{
title: '每年',
},
{
title: '每年农历',
},
{
title: '备忘',
},
{
title: '归档',
},
{
title: '智能',
},]
export function generateRandomItem(): Item {
const titles = [
'探索未知的宇宙',
@@ -29,23 +73,25 @@ export function generateRandomItem(): Item {
'回顾了历史伟人对社会的贡献和影响。',
'总结了科技进步对生活方式的改变。'
];
const tagsList = [
['宇宙', '探索', '科学'],
['人工智能', '技术', '未来'],
['可持续发展', '环境', '社会'],
['历史', '人物', '影响'],
['科技', '生活', '进步']
];
const randomIndex = Math.floor(Math.random() * titles.length);
// 生成本月的随机时间
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth();
const daysInMonth = new Date(year, month + 1, 0).getDate();
const randomDay = Math.floor(Math.random() * daysInMonth) + 1;
const randomHour = Math.floor(Math.random() * 24);
const randomMinute = Math.floor(Math.random() * 60);
const randomSecond = Math.floor(Math.random() * 60);
const randomDate = new Date(year, month, randomDay, randomHour, randomMinute, randomSecond);
return {
'标题': titles[randomIndex],
'描述': descriptions[randomIndex],
'总结': summaries[randomIndex],
// '标签': tagsList[randomIndex],
'标签': ['b'],
'类型': types[Math.floor(Math.random() * types.length)].title,
'启动时间': randomDate.toISOString(),
};
}
@@ -53,7 +99,6 @@ export function generateMultipleRandomItems(count: number): Item[] {
const items: Item[] = [];
for (let i = 0; i < count; i++) {
const item = generateRandomItem();
item.Id = i + 1;
items.push(item);
}
return items;