update code

This commit is contained in:
lychang
2025-11-05 02:04:09 +08:00
parent 43cb0ff431
commit e81d9edbd5
9 changed files with 83 additions and 56 deletions

View File

@@ -40,7 +40,7 @@ function generateReport() {
}
// 转换格式:YYYY-WWW 到 YYYY-WW
const weekFormatted = week.replace('W', '-W');
const weekFormatted = week.replace('W', '');
showLoading();
@@ -50,7 +50,10 @@ function generateReport() {
hideLoading();
if (data.success) {
document.getElementById('report-content').textContent = data.report;
// 保存原始Markdown内容到data属性
document.getElementById('report-content').setAttribute('data-markdown', data.report);
// 使用innerHTML显示格式化内容
document.getElementById('report-content').innerHTML = data.report.replace(/\n/g, '<br>');
document.getElementById('report-container').style.display = 'block';
// 显示统计数据
@@ -116,7 +119,7 @@ function displayCategoryChart(categories) {
}
function exportReport() {
const reportContent = document.getElementById('report-content').textContent;
const reportContent = document.getElementById('report-content').getAttribute('data-markdown');
if (!reportContent) {
showError('请先生成周报');
return;