This commit is contained in:
2026-03-12 15:01:48 +08:00
commit f27996dde0
20 changed files with 5450 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,33 @@
export function getApiBase() {
const envBase = import.meta.env.VITE_API_BASE;
if (envBase) {
return String(envBase).replace(/\/+$/, "");
}
// 默认走同源 /api更适合反向代理 + HTTPS
if (typeof window === "undefined") return "http://localhost:8080/api";
return `${window.location.origin}/api`;
}
export async function apiRequest(path, options = {}) {
const base = getApiBase();
const res = await fetch(`${base}${path}`, {
headers: {
"Content-Type": "application/json",
...(options.headers || {}),
},
...options,
});
let body = null;
try {
body = await res.json();
} catch {
body = null;
}
if (!res.ok) {
const message =
(body && body.error) || `请求失败 (${res.status} ${res.statusText})`;
throw new Error(message);
}
return body;
}

View File

@@ -0,0 +1,5 @@
import { createApp } from "vue";
import "@xterm/xterm/css/xterm.css";
import App from "./App.vue";
createApp(App).mount("#app");