Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AITokenPool</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%234ecdc4'/%3E%3Cstop offset='1' stop-color='%232a9d8f'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='64' height='64' rx='14' fill='url(%23g)'/%3E%3Ctext x='32' y='43' font-family='-apple-system,Segoe UI,Arial,sans-serif' font-size='30' font-weight='800' text-anchor='middle' fill='%23062021'%3EAT%3C/text%3E%3C/svg%3E">
<link rel="stylesheet" href="css/style.css?v=20260824-6">
<link rel="stylesheet" href="css/style.css?v=20260824-7">
</head>
<body>

Expand Down Expand Up @@ -683,9 +683,9 @@ <h3 id="chat-title">使用模型</h3>
</div>
</div>

<script src="js/api.js?v=20260824-6"></script>
<script src="js/data.js?v=20260824-6"></script>
<script src="js/i18n.js?v=20260824-6"></script>
<script src="js/app.js?v=20260824-6"></script>
<script src="js/api.js?v=20260824-7"></script>
<script src="js/data.js?v=20260824-7"></script>
<script src="js/i18n.js?v=20260824-7"></script>
<script src="js/app.js?v=20260824-7"></script>
</body>
</html>
32 changes: 29 additions & 3 deletions ui/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@

const TX_COLUMNS = [
// rant 2026-08-23T16:01:07:列表内移除 time 列筛选(外部 tx-range 已有时间段筛选,两套并存冗余)
{ key: "time", title: () => T("tx.col.time"), sort: "string", render: (t) => timeCell(t.time) },
{ key: "time", title: () => T("tx.col.time"), sort: "string", render: (t) => timeCell(t.time, true) },
{ key: "type", title: () => T("tx.col.type"), sort: "string", filter: "select",
options: () => ["consume", "earn", "topup", "withdraw", "gift"].map(txType),
filterVal: (t) => txType(t.type),
Expand Down Expand Up @@ -2432,8 +2432,30 @@
return full;
}

// 时间单元格:相对时间展示 + title 悬停显示本地化绝对时间(rant 2026-08-19T20:45:32)
function timeCell(s) {
// 精确本地时间(YYYY-MM-DD HH:MM:SS,到秒)——交易列表时间列(rant 2026-08-24T12:38:44)
function fmtPrecise(s) {
if (!s) return "";
const t = String(s);
const p2 = (x) => String(x).padStart(2, "0");
let m = t.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?Z$/);
let d = null;
if (m) {
d = new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +(m[6] || 0)));
} else {
// 旧后端格式 'YYYY-MM-DD[ HH:MM[:SS]]' → 视为 UTC(同 timeAgo 口径)
m = t.match(/^(\d{4})-(\d{2})-(\d{2})(?:\s+(\d{2}):(\d{2})(?::(\d{2}))?)?$/);
if (m) d = new Date(Date.UTC(+m[1], +m[2] - 1, +m[3], +(m[4] || 0), +(m[5] || 0), +(m[6] || 0)));
}
if (d && !isNaN(d.getTime())) {
return d.getFullYear() + "-" + p2(d.getMonth() + 1) + "-" + p2(d.getDate()) +
" " + p2(d.getHours()) + ":" + p2(d.getMinutes()) + ":" + p2(d.getSeconds());
}
return t; // 非标准格式(游客 mock 'MM-DD HH:mm' 等)原样返回
}

// 时间单元格:precise=true → 精确本地时间为主文本、相对时间入 title(交易列表,rant 2026-08-24T12:38:44);
// 默认 → 相对时间为主文本、title 悬停显示本地化绝对时间(rant 2026-08-19T20:45:32)
function timeCell(s, precise) {
if (!s) return "";
const t = String(s);
const iso = /^(\d{4})-(\d{2})-(\d{2})[T ]/.test(t);
Expand All @@ -2442,6 +2464,10 @@
const d = new Date(iso && t.includes("T") ? t : t.replace(" ", "T") + "Z");
if (!isNaN(d.getTime())) title = d.toLocaleString();
}
if (precise) {
const rel = timeAgo(s);
return '<span class="timeago" title="' + esc(rel) + '">' + esc(fmtPrecise(s)) + "</span>";
}
return '<span class="timeago" title="' + esc(title) + '">' + esc(timeAgo(s)) + "</span>";
}

Expand Down
Loading