fix(report): 矩阵方向改回「博主做行、日期做列」
Deploy VitePress site to Pages / build (push) Canceled after 0s
Deploy VitePress site to Pages / Deploy (push) Canceled after 0s

用户要的是日期在上、昵称在左。上一版转置反了:日期做行、博主做列。
只改渲染方向,数据接口不变(它返回的是长表,两个方向都能拼)。
This commit is contained in:
butubb
2026-10-22 14:06:28 +08:00
parent 2153207bf9
commit c095530879
+9 -7
View File
@@ -250,25 +250,27 @@
const table = document.createElement('table');
const thead = document.createElement('thead');
const headRow = document.createElement('tr');
// 左上角那一格钉住两个方向 —— 横着滚日期、竖着滚博主都要能看到它。
const corner = document.createElement('th');
corner.textContent = '日期';
corner.textContent = '博主 \\ 日期';
headRow.appendChild(corner);
for (const creator of data.creators) {
for (const day of data.dates) {
const th = document.createElement('th');
th.textContent = creator.name;
th.textContent = day;
headRow.appendChild(th);
}
thead.appendChild(headRow);
table.appendChild(thead);
const tbody = document.createElement('tbody');
for (const day of data.dates) {
for (const creator of data.creators) {
const tr = document.createElement('tr');
const th = document.createElement('th');
th.textContent = day;
th.textContent = creator.name;
th.title = creator.name;
tr.appendChild(th);
const rowCells = data.cells[day] || {};
for (const creator of data.creators) {
for (const day of data.dates) {
const rowCells = data.cells[day] || {};
tr.appendChild(cellNode(rowCells[creator.hash]));
}
tbody.appendChild(tr);