订单需管理员审核后才开通节点,并更新登录页文案。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-10 23:04:24 +08:00
parent 8b55b9cf55
commit f329f647c7
22 changed files with 583 additions and 81 deletions
+24
View File
@@ -37,6 +37,30 @@ export async function api(path, options = {}) {
return data;
}
export async function download(path, filename) {
const headers = {};
const token = localStorage.getItem("token");
if (token) headers.Authorization = `Bearer ${token}`;
const response = await fetch(`/api/v1${path}`, { headers });
if (response.status === 401) {
clearSession();
if (location.pathname !== "/login") location.assign("/login");
throw new Error("登录已失效");
}
if (!response.ok) {
const text = await response.text();
const data = text ? JSON.parse(text) : null;
throw new Error(messageOf(data) || "下载失败");
}
const blob = await response.blob();
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = filename;
link.click();
URL.revokeObjectURL(url);
}
function messageOf(data) {
if (!data) return "";
if (typeof data.detail === "string") return data.detail;