feat: 学时历史可打开对应课程

This commit is contained in:
Nixevol
2026-11-19 01:59:36 +08:00
parent 0d26639fe5
commit 7a1c4e3d8b
4 changed files with 84 additions and 6 deletions
+22 -2
View File
@@ -135,13 +135,33 @@ const paged = computed(() => {
return rows.slice(start, start + pageSize.value);
});
const EUNIV_ORIGIN = "https://euniv.zte.com.cn";
function courseHref(path: string) {
const text = path.trim();
if (text.startsWith("/") && !text.startsWith("//")) return `${EUNIV_ORIGIN}${text}`;
try {
const url = new URL(text);
if (url.protocol === "https:" && url.hostname === "euniv.zte.com.cn") return url.href;
} catch {
return "";
}
return "";
}
const columns: DataTableColumns<HistoryItem> = [
{
title: "来源",
key: "title",
ellipsis: { tooltip: true },
render(row) {
return h("span", { class: "history-title", title: row.title }, row.title || "—");
const text = row.title || "—";
const href = courseHref(row.path);
if (!href) return h("span", { class: "history-title", title: row.title }, text);
return h(
"a",
{ class: "history-title", href, target: "_blank", rel: "noreferrer", title: row.title || "在学习平台打开" },
text,
);
},
},
{
+9
View File
@@ -1556,6 +1556,15 @@ select {
overflow-wrap: anywhere;
}
a.history-title {
color: var(--accent);
text-decoration: none;
}
a.history-title:hover {
text-decoration: underline;
}
.n-data-table {
--n-merged-th-color: transparent;
--n-merged-td-color: transparent;