()
| 154 | |
| 155 | // 导出事件数据(单独) |
| 156 | export async function exportEventsData(): Promise<void> { |
| 157 | const events = await eventService.getAllEvents() |
| 158 | |
| 159 | if (events.length === 0) { |
| 160 | alert('暂无事件数据可导出') |
| 161 | return |
| 162 | } |
| 163 | |
| 164 | const data = { |
| 165 | version: '1.0.0', |
| 166 | exportTime: Date.now(), |
| 167 | events, |
| 168 | } |
| 169 | |
| 170 | const jsonContent = JSON.stringify(data, null, 2) |
| 171 | |
| 172 | downloadFile(jsonContent, `消息日历_${getDateString()}.json`, 'application/json') |
| 173 | } |
| 174 | |
| 175 | // 从 JSON 导入数据 |
| 176 | export function importFromJSON(jsonContent: string): { |
nothing calls this directly
no test coverage detected