1300 lines
44 KiB
Vue
1300 lines
44 KiB
Vue
<script setup lang="ts">
|
||
import { darkTheme, dateZhCN, zhCN, type GlobalThemeOverrides } from "naive-ui";
|
||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||
import VideoListPage from "./views/VideoListPage.vue";
|
||
import DownloadProgressPage from "./views/DownloadProgressPage.vue";
|
||
import SettingsPanel from "./views/SettingsPanel.vue";
|
||
import PlayerPage from "./views/PlayerPage.vue";
|
||
|
||
type Method = "guest" | "password" | "adb";
|
||
type Platform = "rapt" | "huangdou";
|
||
|
||
interface Profile {
|
||
nickname?: string;
|
||
email?: string | null;
|
||
id?: string | number;
|
||
badge?: string;
|
||
vipday?: number;
|
||
score?: number;
|
||
watched?: number;
|
||
rewards?: number;
|
||
login_day?: number;
|
||
email_bind?: number;
|
||
mobile_bind?: number;
|
||
google_bind?: number;
|
||
apple_bind?: number;
|
||
avatarNumUrl?: string;
|
||
username?: string;
|
||
phone?: string;
|
||
group_name?: string;
|
||
balance?: string | number;
|
||
is_vip?: string | number;
|
||
has_login?: string;
|
||
}
|
||
|
||
interface Device {
|
||
serial: string;
|
||
model: string;
|
||
rooted: boolean;
|
||
state: string;
|
||
}
|
||
|
||
interface SavedAccount {
|
||
email: string;
|
||
password: string;
|
||
nickname: string;
|
||
uid: string;
|
||
}
|
||
|
||
interface DeviceProfile {
|
||
brand: string;
|
||
model: string;
|
||
os_version: string;
|
||
device_type: string;
|
||
physical: boolean;
|
||
device_id: string;
|
||
fingerprint: string;
|
||
app_version: string;
|
||
app_build: string;
|
||
language: string;
|
||
}
|
||
|
||
interface ProxySettings {
|
||
mode: "off" | "system" | "custom";
|
||
scheme: "http" | "socks5";
|
||
host: string;
|
||
port: string;
|
||
username: string;
|
||
password: string;
|
||
}
|
||
|
||
function emptyProxy(): ProxySettings {
|
||
return { mode: "off", scheme: "http", host: "", port: "", username: "", password: "" };
|
||
}
|
||
const DEVICE_KEY = "rapt-device-settings";
|
||
const SESSION_DEVICE_KEY = "rapt-device";
|
||
const ACCOUNTS_KEY = "rapt-accounts";
|
||
const PLATFORM_KEY = "rapt-platform";
|
||
|
||
const themeOverrides: GlobalThemeOverrides = {
|
||
Form: {
|
||
labelFontSizeLeftSmall: "14px",
|
||
},
|
||
};
|
||
|
||
const platforms: { key: Platform; label: string }[] = [
|
||
{ key: "rapt", label: "RaptDrama" },
|
||
{ key: "huangdou", label: "黄豆短剧" },
|
||
];
|
||
const platform = ref<Platform>(readPlatform());
|
||
const apiBase = computed(() => (platform.value === "huangdou" ? "/api/huangdou" : "/api"));
|
||
const platformLabel = computed(() => platforms.find((item) => item.key === platform.value)?.label || "RaptDrama");
|
||
const method = ref<Method>("guest");
|
||
const email = ref("");
|
||
const password = ref("");
|
||
const serial = ref<string | null>(null);
|
||
const devices = ref<Device[]>([]);
|
||
const devicesBusy = ref(false);
|
||
const busy = ref(false);
|
||
const error = ref("");
|
||
const token = ref("");
|
||
const profile = ref<Profile | null>(null);
|
||
const page = ref<"download" | "profile" | "progress" | "settings" | "play">("download");
|
||
const playing = ref<{ id: string | number; title: string; image: string } | null>(null);
|
||
const progressCount = ref(0);
|
||
interface LiveJob {
|
||
id: string;
|
||
title: string;
|
||
image: string;
|
||
status: string;
|
||
episode_count: number;
|
||
done_count: number;
|
||
progress: number;
|
||
speed: string;
|
||
stage: string;
|
||
completed_at: string;
|
||
error: string;
|
||
}
|
||
const downloadState = ref<{ active: LiveJob[]; done: LiveJob[]; active_count: number }>({
|
||
active: [],
|
||
done: [],
|
||
active_count: 0,
|
||
});
|
||
const downloadRef = ref<{
|
||
reload: (refresh?: boolean) => void;
|
||
busy: boolean;
|
||
find: (keyword?: string) => void;
|
||
searchHint: string;
|
||
clearSearch: () => void;
|
||
loadDirectory: () => Promise<void>;
|
||
} | null>(null);
|
||
const catalogQuery = ref("");
|
||
const mainMenu = computed(() => [
|
||
{ label: "视频清单", key: "download" },
|
||
{
|
||
key: "progress",
|
||
label: () =>
|
||
h("span", { class: "nav-label" }, [
|
||
"下载进度",
|
||
progressCount.value
|
||
? h("span", { class: "nav-badge" }, String(progressCount.value))
|
||
: null,
|
||
]),
|
||
},
|
||
{ label: "系统设置", key: "settings" },
|
||
]);
|
||
const pageTitle = computed(() => {
|
||
if (page.value === "play") return playing.value?.title || "播放";
|
||
if (page.value === "progress") return "下载进度";
|
||
if (page.value === "profile") return "个人信息";
|
||
if (page.value === "settings") return "系统设置";
|
||
return "视频清单";
|
||
});
|
||
const menuValue = computed(() => {
|
||
if (page.value === "profile") return null;
|
||
if (page.value === "play") return "download";
|
||
return page.value;
|
||
});
|
||
|
||
function readPlatform(): Platform {
|
||
try {
|
||
const value = localStorage.getItem(PLATFORM_KEY);
|
||
if (value === "huangdou" || value === "rapt") return value;
|
||
} catch {
|
||
// 沿用默认平台
|
||
}
|
||
return "rapt";
|
||
}
|
||
|
||
function selectPlatform(key: string) {
|
||
if (key !== "rapt" && key !== "huangdou") return;
|
||
platform.value = key;
|
||
localStorage.setItem(PLATFORM_KEY, key);
|
||
error.value = "";
|
||
}
|
||
|
||
function tokenKey() {
|
||
return platform.value === "huangdou" ? "huangdou-token" : "rapt-token";
|
||
}
|
||
|
||
function openPlay(drama: { id: string | number; title: string; image: string }) {
|
||
playing.value = drama;
|
||
page.value = "play";
|
||
}
|
||
|
||
function closePlay() {
|
||
page.value = "download";
|
||
playing.value = null;
|
||
}
|
||
watch(catalogQuery, (value) => {
|
||
if (!String(value ?? "").trim()) downloadRef.value?.clearSearch();
|
||
});
|
||
let liveSocket: WebSocket | null = null;
|
||
const builtinDevice = ref<DeviceProfile>({
|
||
brand: "Redmi",
|
||
model: "23113RKC6C",
|
||
os_version: "12",
|
||
device_type: "phone",
|
||
physical: true,
|
||
device_id: "rd_c9f0fa17a39f96aa",
|
||
fingerprint: "0a4e4b212cbb0a2434cf804c8e30ab58",
|
||
app_version: "1.1.81",
|
||
app_build: "139",
|
||
language: "en-US",
|
||
});
|
||
const settings = ref({
|
||
adbMode: "device" as "device" | "settings",
|
||
custom: { ...builtinDevice.value },
|
||
proxy: emptyProxy(),
|
||
workers: 6,
|
||
directory: "",
|
||
defaultDirectory: "",
|
||
});
|
||
const settingsError = ref("");
|
||
const settingsBusy = ref(false);
|
||
const settingsOpen = ref(false);
|
||
const settingsTab = ref<"device" | "proxy" | "download">("device");
|
||
const draft = ref(copySettings(settings.value));
|
||
const rememberPassword = ref(true);
|
||
const savedAccounts = ref<SavedAccount[]>([]);
|
||
const selectedAccount = ref<string | null>(null);
|
||
|
||
const methods: { id: Method; label: string }[] = [
|
||
{ id: "guest", label: "游客" },
|
||
{ id: "password", label: "账号密码" },
|
||
{ id: "adb", label: "ADB" },
|
||
];
|
||
|
||
const accountFields = computed(() =>
|
||
platform.value === "huangdou"
|
||
? [
|
||
{ key: "username" as const, label: "账号" },
|
||
{ key: "id" as const, label: "用户 ID" },
|
||
{ key: "group_name" as const, label: "身份" },
|
||
{ key: "email" as const, label: "邮箱" },
|
||
{ key: "phone" as const, label: "手机" },
|
||
]
|
||
: [
|
||
{ key: "email" as const, label: "邮箱" },
|
||
{ key: "id" as const, label: "用户 ID" },
|
||
],
|
||
);
|
||
|
||
const statFields = computed(() =>
|
||
platform.value === "huangdou"
|
||
? [
|
||
{ key: "vipday" as const, label: "VIP" },
|
||
{ key: "score" as const, label: "余额" },
|
||
{ key: "watched" as const, label: "观看" },
|
||
]
|
||
: [
|
||
{ key: "vipday" as const, label: "VIP" },
|
||
{ key: "score" as const, label: "积分" },
|
||
{ key: "watched" as const, label: "观看" },
|
||
{ key: "rewards" as const, label: "奖励" },
|
||
{ key: "login_day" as const, label: "登录" },
|
||
],
|
||
);
|
||
|
||
const bindFields: { key: keyof Profile; label: string }[] = [
|
||
{ key: "email_bind", label: "邮箱" },
|
||
{ key: "mobile_bind", label: "手机" },
|
||
{ key: "google_bind", label: "Google" },
|
||
{ key: "apple_bind", label: "Apple" },
|
||
];
|
||
|
||
function copySettings<T>(value: T): T {
|
||
return JSON.parse(JSON.stringify(value));
|
||
}
|
||
|
||
function loadSettings() {
|
||
try {
|
||
const data = JSON.parse(localStorage.getItem(DEVICE_KEY) || "");
|
||
if (data.adbMode === "device" || data.adbMode === "settings") settings.value.adbMode = data.adbMode;
|
||
if (data.mode === "default") {
|
||
settings.value.custom = { ...builtinDevice.value };
|
||
} else if (data.custom && typeof data.custom === "object") {
|
||
settings.value.custom = { ...builtinDevice.value, ...data.custom };
|
||
}
|
||
if (data.proxy && typeof data.proxy === "object") {
|
||
const proxy = { ...emptyProxy(), ...data.proxy };
|
||
if (proxy.mode !== "off" && proxy.mode !== "system" && proxy.mode !== "custom") proxy.mode = "off";
|
||
if (proxy.scheme !== "http" && proxy.scheme !== "socks5") proxy.scheme = "http";
|
||
settings.value.proxy = proxy;
|
||
}
|
||
} catch {
|
||
settings.value.custom = { ...builtinDevice.value };
|
||
}
|
||
}
|
||
|
||
async function loadDeviceDefaults() {
|
||
const response = await fetch("/api/device/defaults");
|
||
if (!response.ok) return;
|
||
builtinDevice.value = { ...builtinDevice.value, ...(await response.json()) };
|
||
}
|
||
|
||
function normalizeWorkers(value: unknown) {
|
||
const count = Number(value);
|
||
if (!Number.isInteger(count) || count < 1) return 6;
|
||
return count;
|
||
}
|
||
|
||
async function loadDownloadSettings() {
|
||
const response = await fetch(`${apiBase.value}/downloads/settings`);
|
||
if (!response.ok) return;
|
||
const payload = await response.json();
|
||
settings.value.workers = normalizeWorkers(payload.workers);
|
||
settings.value.directory = typeof payload.directory === "string" ? payload.directory : "";
|
||
settings.value.defaultDirectory = typeof payload.default_directory === "string" ? payload.default_directory : "";
|
||
}
|
||
|
||
async function enterSettings() {
|
||
settingsError.value = "";
|
||
if (platform.value === "huangdou" && settingsTab.value === "device") settingsTab.value = "download";
|
||
await loadDownloadSettings();
|
||
draft.value = copySettings(settings.value);
|
||
}
|
||
|
||
async function openSettings() {
|
||
settingsTab.value = platform.value === "huangdou" ? "download" : "device";
|
||
await enterSettings();
|
||
settingsOpen.value = true;
|
||
}
|
||
|
||
watch(page, (value) => {
|
||
if (value === "settings") void enterSettings();
|
||
});
|
||
|
||
// 打开页面时把本机保存的代理推给后端,避免进程重启后丢失。
|
||
async function applyProxy(proxy: ProxySettings) {
|
||
const response = await fetch("/api/proxy", {
|
||
method: "POST",
|
||
headers: { "Content-Type": "application/json" },
|
||
body: JSON.stringify(proxy),
|
||
});
|
||
const payload = await response.json().catch(() => ({}));
|
||
if (!response.ok) {
|
||
throw new Error(typeof payload.detail === "string" ? payload.detail : "代理设置失败");
|
||
}
|
||
}
|
||
|
||
async function saveSettings() {
|
||
settingsError.value = "";
|
||
const proxy = draft.value.proxy;
|
||
if (proxy.mode === "custom") {
|
||
if (!proxy.host.trim()) {
|
||
settingsTab.value = "proxy";
|
||
settingsError.value = "请填写代理地址";
|
||
return;
|
||
}
|
||
const port = Number(proxy.port);
|
||
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
||
settingsTab.value = "proxy";
|
||
settingsError.value = "请填写 1 到 65535 的端口";
|
||
return;
|
||
}
|
||
}
|
||
const workers = normalizeWorkers(draft.value.workers);
|
||
if (workers !== Number(draft.value.workers)) {
|
||
settingsTab.value = "download";
|
||
settingsError.value = "同时下载数量至少为 1";
|
||
return;
|
||
}
|
||
const directory = draft.value.directory.trim();
|
||
if (!directory) {
|
||
settingsTab.value = "download";
|
||
settingsError.value = "请选择下载目录";
|
||
return;
|
||
}
|
||
settingsBusy.value = true;
|
||
try {
|
||
await applyProxy(proxy);
|
||
const response = await fetch(`${apiBase.value}/downloads/settings`, {
|
||
method: "POST",
|
||
headers: { "Content-Type": "application/json" },
|
||
body: JSON.stringify({ directory, workers }),
|
||
});
|
||
const payload = await response.json().catch(() => ({}));
|
||
if (!response.ok) {
|
||
settingsTab.value = "download";
|
||
settingsError.value = typeof payload.detail === "string" ? payload.detail : "下载设置失败";
|
||
return;
|
||
}
|
||
draft.value.directory = payload.directory || directory;
|
||
draft.value.workers = normalizeWorkers(payload.workers);
|
||
draft.value.defaultDirectory = payload.default_directory || draft.value.defaultDirectory;
|
||
settings.value = copySettings(draft.value);
|
||
localStorage.setItem(DEVICE_KEY, JSON.stringify({
|
||
adbMode: settings.value.adbMode,
|
||
custom: settings.value.custom,
|
||
proxy: settings.value.proxy,
|
||
}));
|
||
await downloadRef.value?.loadDirectory();
|
||
settingsOpen.value = false;
|
||
} catch (exc) {
|
||
settingsError.value = exc instanceof Error ? exc.message : "设置保存失败";
|
||
} finally {
|
||
settingsBusy.value = false;
|
||
}
|
||
}
|
||
|
||
async function chooseDownloadDirectory() {
|
||
settingsError.value = "";
|
||
const response = await fetch(`${apiBase.value}/downloads/choose`, { method: "POST" });
|
||
const payload = await response.json().catch(() => ({}));
|
||
if (!response.ok) {
|
||
settingsError.value = typeof payload.detail === "string" ? payload.detail : "目录选择失败";
|
||
return;
|
||
}
|
||
if (typeof payload.directory === "string" && payload.directory) draft.value.directory = payload.directory;
|
||
}
|
||
|
||
function restoreCurrent() {
|
||
settingsError.value = "";
|
||
if (settingsTab.value === "device") {
|
||
draft.value.custom = { ...builtinDevice.value };
|
||
draft.value.adbMode = "device";
|
||
return;
|
||
}
|
||
if (settingsTab.value === "proxy") {
|
||
draft.value.proxy = emptyProxy();
|
||
return;
|
||
}
|
||
draft.value.workers = 6;
|
||
draft.value.directory = draft.value.defaultDirectory || settings.value.defaultDirectory;
|
||
}
|
||
|
||
function settingsDevice(): DeviceProfile {
|
||
return settings.value.custom;
|
||
}
|
||
|
||
function rememberSessionDevice(device: DeviceProfile | undefined) {
|
||
if (!device) return;
|
||
sessionStorage.setItem(SESSION_DEVICE_KEY, JSON.stringify(device));
|
||
}
|
||
|
||
function sessionDevice(): DeviceProfile | null {
|
||
try {
|
||
const raw = sessionStorage.getItem(SESSION_DEVICE_KEY);
|
||
return raw ? JSON.parse(raw) : settingsDevice();
|
||
} catch {
|
||
return settingsDevice();
|
||
}
|
||
}
|
||
|
||
const deviceOptions = computed(() =>
|
||
devices.value.map((item) => ({
|
||
label: deviceLabel(item),
|
||
value: item.serial,
|
||
disabled: item.state !== "device",
|
||
})),
|
||
);
|
||
|
||
const accountOptions = computed(() =>
|
||
savedAccounts.value.map((item) => ({
|
||
label: item.nickname ? `${item.nickname} · ${item.email}` : item.email,
|
||
value: item.email,
|
||
})),
|
||
);
|
||
|
||
function readList<T>(key: string): T[] {
|
||
try {
|
||
const data = JSON.parse(localStorage.getItem(key) || "[]");
|
||
return Array.isArray(data) ? data : [];
|
||
} catch {
|
||
return [];
|
||
}
|
||
}
|
||
|
||
function writeAccounts() {
|
||
localStorage.setItem(ACCOUNTS_KEY, JSON.stringify(savedAccounts.value));
|
||
}
|
||
|
||
function applyAccount(emailValue: string) {
|
||
const found = savedAccounts.value.find((item) => item.email === emailValue);
|
||
if (!found) return;
|
||
selectedAccount.value = found.email;
|
||
email.value = found.email;
|
||
password.value = found.password;
|
||
}
|
||
|
||
function removeAccount() {
|
||
if (!selectedAccount.value) return;
|
||
const removing = selectedAccount.value;
|
||
savedAccounts.value = savedAccounts.value.filter((item) => item.email !== removing);
|
||
writeAccounts();
|
||
if (email.value === removing) {
|
||
email.value = "";
|
||
password.value = "";
|
||
}
|
||
selectedAccount.value = savedAccounts.value[0]?.email ?? null;
|
||
if (selectedAccount.value) applyAccount(selectedAccount.value);
|
||
}
|
||
|
||
function saveAccount(info: Profile) {
|
||
const next: SavedAccount = {
|
||
email: email.value.trim(),
|
||
password: password.value,
|
||
nickname: info.nickname || "",
|
||
uid: info.id == null ? "" : String(info.id),
|
||
};
|
||
if (!next.email) return;
|
||
savedAccounts.value = [next, ...savedAccounts.value.filter((item) => item.email !== next.email)];
|
||
writeAccounts();
|
||
selectedAccount.value = next.email;
|
||
}
|
||
|
||
function profileText(key: keyof Profile) {
|
||
const value = profile.value?.[key];
|
||
if (value === undefined || value === null || value === "") return "—";
|
||
return String(value);
|
||
}
|
||
|
||
function profileNumber(key: keyof Profile) {
|
||
const value = Number(profile.value?.[key] ?? 0);
|
||
return Number.isFinite(value) ? String(value) : "0";
|
||
}
|
||
|
||
function profileBound(key: keyof Profile) {
|
||
return Number(profile.value?.[key] ?? 0) > 0;
|
||
}
|
||
|
||
function deviceLabel(item: Device) {
|
||
const mark =
|
||
item.state === "unauthorized" ? "未授权" : item.state === "offline" ? "离线" : item.rooted ? "已 root" : "未 root";
|
||
return `${item.model} · ${item.serial} · ${mark}`;
|
||
}
|
||
|
||
function applyDeviceList(list: Device[]) {
|
||
devices.value = list;
|
||
const stillThere = devices.value.some((item) => item.serial === serial.value && item.state === "device");
|
||
if (!stillThere) {
|
||
const ready = devices.value.filter((item) => item.state === "device");
|
||
serial.value = ready.length === 1 ? ready[0].serial : null;
|
||
}
|
||
}
|
||
|
||
async function loadDevices() {
|
||
error.value = "";
|
||
devicesBusy.value = true;
|
||
try {
|
||
const response = await fetch("/api/adb/devices");
|
||
const payload = await response.json();
|
||
if (!response.ok) {
|
||
throw new Error(payload.detail || "读取设备失败");
|
||
}
|
||
applyDeviceList(payload.devices || []);
|
||
} catch (exc) {
|
||
devices.value = [];
|
||
serial.value = null;
|
||
error.value = exc instanceof Error ? exc.message : "读取设备失败";
|
||
} finally {
|
||
devicesBusy.value = false;
|
||
}
|
||
}
|
||
|
||
async function probeMumu() {
|
||
error.value = "";
|
||
devicesBusy.value = true;
|
||
try {
|
||
const response = await fetch("/api/adb/probe-mumu", { method: "POST" });
|
||
const payload = await response.json();
|
||
if (!response.ok) {
|
||
throw new Error(payload.detail || "没有连上 MuMu");
|
||
}
|
||
applyDeviceList(payload.devices || []);
|
||
const ready = devices.value.filter((item) => item.state === "device");
|
||
if (!ready.length) {
|
||
const ports = Array.isArray(payload.ports) ? payload.ports.join("、") : "";
|
||
throw new Error(ports ? `已尝试连接 MuMu 端口 ${ports},但设备还不可用。请在模拟器里允许调试后再探测。` : "没有连上 MuMu");
|
||
}
|
||
} catch (exc) {
|
||
if (!devices.value.length) serial.value = null;
|
||
error.value = exc instanceof Error ? exc.message : "没有连上 MuMu";
|
||
} finally {
|
||
devicesBusy.value = false;
|
||
}
|
||
}
|
||
|
||
watch(method, (value) => {
|
||
error.value = "";
|
||
if (value === "adb") loadDevices();
|
||
});
|
||
|
||
async function loginHuangdou() {
|
||
error.value = "";
|
||
busy.value = true;
|
||
try {
|
||
const response = await fetch("/api/huangdou/login/device", { method: "POST" });
|
||
const payload = await response.json();
|
||
if (!response.ok) {
|
||
throw new Error(typeof payload.detail === "string" ? payload.detail : "登录失败");
|
||
}
|
||
token.value = payload.token;
|
||
profile.value = payload.profile;
|
||
sessionStorage.setItem(tokenKey(), payload.token);
|
||
page.value = "download";
|
||
startLive();
|
||
} catch (exc) {
|
||
error.value = exc instanceof Error ? exc.message : "登录失败";
|
||
} finally {
|
||
busy.value = false;
|
||
}
|
||
}
|
||
|
||
async function login() {
|
||
if (platform.value === "huangdou") {
|
||
await loginHuangdou();
|
||
return;
|
||
}
|
||
error.value = "";
|
||
busy.value = true;
|
||
try {
|
||
let path = "/api/login/guest";
|
||
let body: unknown = { device: settingsDevice() };
|
||
if (method.value === "password") {
|
||
path = "/api/login/password";
|
||
body = { email: email.value, password: password.value, device: settingsDevice() };
|
||
} else if (method.value === "adb") {
|
||
if (!serial.value) {
|
||
throw new Error("请选择设备");
|
||
}
|
||
path = "/api/login/adb";
|
||
const current = settings.value.custom;
|
||
body = {
|
||
serial: serial.value,
|
||
device_source: settings.value.adbMode,
|
||
device:
|
||
settings.value.adbMode === "device"
|
||
? { fingerprint: current.fingerprint, language: current.language }
|
||
: current,
|
||
};
|
||
}
|
||
const response = await fetch(path, {
|
||
method: "POST",
|
||
headers: { "Content-Type": "application/json" },
|
||
body: JSON.stringify(body),
|
||
});
|
||
const payload = await response.json();
|
||
if (!response.ok) {
|
||
throw new Error(typeof payload.detail === "string" ? payload.detail : "登录失败");
|
||
}
|
||
token.value = payload.token;
|
||
profile.value = payload.profile;
|
||
sessionStorage.setItem(tokenKey(), payload.token);
|
||
rememberSessionDevice(payload.device);
|
||
page.value = "download";
|
||
startLive();
|
||
if (method.value === "password" && rememberPassword.value) saveAccount(payload.profile || {});
|
||
} catch (exc) {
|
||
error.value = exc instanceof Error ? exc.message : "登录失败";
|
||
} finally {
|
||
busy.value = false;
|
||
}
|
||
}
|
||
|
||
const avatarSrc = computed(() => {
|
||
const image = profile.value?.avatarNumUrl || "";
|
||
if (!image) return undefined;
|
||
if (image.startsWith("http://") || image.startsWith("https://") || image.startsWith("/api/")) return image;
|
||
return `https://apis.raptdrama.com${image.startsWith("/") ? image : `/${image}`}`;
|
||
});
|
||
|
||
let liveRetry = 0;
|
||
|
||
function applyLive(payload: { downloads?: { active: LiveJob[]; done: LiveJob[]; active_count?: number }; profile?: Profile | null }) {
|
||
if (payload.downloads) {
|
||
downloadState.value = {
|
||
active: payload.downloads.active || [],
|
||
done: payload.downloads.done || [],
|
||
active_count: payload.downloads.active_count || 0,
|
||
};
|
||
progressCount.value = payload.downloads.active_count || 0;
|
||
}
|
||
if (payload.profile) profile.value = payload.profile;
|
||
}
|
||
|
||
function startLive() {
|
||
stopLive();
|
||
const protocol = location.protocol === "https:" ? "wss" : "ws";
|
||
const socket = new WebSocket(`${protocol}://${location.host}/api/live?platform=${platform.value}`);
|
||
liveSocket = socket;
|
||
socket.onmessage = (event) => {
|
||
applyLive(JSON.parse(event.data));
|
||
};
|
||
socket.onclose = () => {
|
||
if (liveSocket !== socket || !token.value) return;
|
||
liveRetry = window.setTimeout(() => startLive(), 1000);
|
||
};
|
||
}
|
||
|
||
function stopLive() {
|
||
if (liveRetry) window.clearTimeout(liveRetry);
|
||
liveRetry = 0;
|
||
if (liveSocket) {
|
||
liveSocket.onclose = null;
|
||
liveSocket.close();
|
||
liveSocket = null;
|
||
}
|
||
progressCount.value = 0;
|
||
}
|
||
|
||
async function logout() {
|
||
const current = token.value;
|
||
stopLive();
|
||
token.value = "";
|
||
profile.value = null;
|
||
page.value = "download";
|
||
sessionStorage.removeItem(tokenKey());
|
||
sessionStorage.removeItem(SESSION_DEVICE_KEY);
|
||
if (!current) return;
|
||
try {
|
||
await fetch(platform.value === "huangdou" ? "/api/huangdou/logout" : "/api/logout", {
|
||
method: "POST",
|
||
headers: { "Content-Type": "application/json" },
|
||
body: JSON.stringify({ token: current }),
|
||
});
|
||
} catch {
|
||
// 本地登录态已经清掉
|
||
}
|
||
}
|
||
|
||
const closeAsk = ref(false);
|
||
const closeCount = ref(0);
|
||
let allowClose = false;
|
||
|
||
function inTauri() {
|
||
return "__TAURI_INTERNALS__" in window;
|
||
}
|
||
|
||
async function watchClose() {
|
||
if (!inTauri()) return;
|
||
const win = getCurrentWindow();
|
||
await win.onCloseRequested((event) => {
|
||
if (allowClose) return;
|
||
event.preventDefault();
|
||
void askClose(win);
|
||
});
|
||
}
|
||
|
||
async function askClose(win: ReturnType<typeof getCurrentWindow>) {
|
||
try {
|
||
const [rapt, huangdou] = await Promise.all([
|
||
fetch("/api/downloads").then((item) => item.json()).catch(() => ({})),
|
||
fetch("/api/huangdou/downloads").then((item) => item.json()).catch(() => ({})),
|
||
]);
|
||
const count = Number(rapt.active_count || 0) + Number(huangdou.active_count || 0);
|
||
if (count > 0) {
|
||
closeCount.value = count;
|
||
closeAsk.value = true;
|
||
return;
|
||
}
|
||
} catch {
|
||
// 后台不可用时直接关闭
|
||
}
|
||
allowClose = true;
|
||
await win.destroy();
|
||
}
|
||
|
||
async function confirmQuit() {
|
||
closeAsk.value = false;
|
||
allowClose = true;
|
||
if (!inTauri()) return;
|
||
await getCurrentWindow().destroy();
|
||
}
|
||
|
||
onMounted(async () => {
|
||
document.title = "RaptDrama Download Tools";
|
||
void watchClose();
|
||
await loadDeviceDefaults();
|
||
loadSettings();
|
||
try {
|
||
await applyProxy(settings.value.proxy);
|
||
} catch {
|
||
error.value = "代理还没有生效,请重新打开设置并保存";
|
||
}
|
||
savedAccounts.value = readList<SavedAccount>(ACCOUNTS_KEY);
|
||
if (savedAccounts.value[0]) applyAccount(savedAccounts.value[0].email);
|
||
const saved = sessionStorage.getItem(tokenKey());
|
||
if (!saved) return;
|
||
const response = await fetch(platform.value === "huangdou" ? "/api/huangdou/me" : "/api/me", {
|
||
method: "POST",
|
||
headers: { "Content-Type": "application/json" },
|
||
body: JSON.stringify({ token: saved, device: sessionDevice() }),
|
||
});
|
||
if (!response.ok) {
|
||
sessionStorage.removeItem(tokenKey());
|
||
return;
|
||
}
|
||
const payload = await response.json();
|
||
token.value = payload.token;
|
||
profile.value = payload.profile;
|
||
rememberSessionDevice(payload.device);
|
||
page.value = "download";
|
||
startLive();
|
||
});
|
||
|
||
onUnmounted(stopLive);
|
||
</script>
|
||
|
||
<template>
|
||
<n-config-provider class="app" :theme="darkTheme" :theme-overrides="themeOverrides" :locale="zhCN" :date-locale="dateZhCN">
|
||
<n-layout v-if="profile" class="shell" has-sider position="absolute">
|
||
<n-layout-sider bordered :width="208" content-style="height: 100%; padding: 0">
|
||
<div class="sider">
|
||
<div class="platform-mark">{{ platformLabel }}</div>
|
||
<n-menu
|
||
:value="menuValue"
|
||
:options="mainMenu"
|
||
@update:value="page = $event"
|
||
/>
|
||
<div class="user-nav" :class="{ active: page === 'profile' }">
|
||
<button type="button" class="user-nav-main" @click="page = 'profile'">
|
||
<n-avatar round :size="28" :src="avatarSrc" />
|
||
<span class="user-nav-name">{{ profile.nickname || "个人信息" }}</span>
|
||
</button>
|
||
<n-tooltip placement="right">
|
||
<template #trigger>
|
||
<n-button quaternary circle size="small" aria-label="退出" @click="logout">
|
||
<template #icon>
|
||
<svg class="logout-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
||
<path d="M16 17l5-5-5-5" />
|
||
<path d="M21 12H9" />
|
||
</svg>
|
||
</template>
|
||
</n-button>
|
||
</template>
|
||
退出
|
||
</n-tooltip>
|
||
</div>
|
||
</div>
|
||
</n-layout-sider>
|
||
<n-layout class="main-pane">
|
||
<n-layout-header bordered class="bar">
|
||
<div class="bar-title">
|
||
<n-button v-if="page === 'play'" quaternary size="small" @click="closePlay">返回</n-button>
|
||
<n-text strong class="bar-title-text">{{ pageTitle }}</n-text>
|
||
</div>
|
||
<div v-if="page === 'download'" class="bar-search">
|
||
<n-input
|
||
v-model:value="catalogQuery"
|
||
class="catalog-query"
|
||
placeholder="搜索名称"
|
||
clearable
|
||
@keyup.enter="downloadRef?.find(catalogQuery)"
|
||
/>
|
||
<n-button secondary @click="downloadRef?.find(catalogQuery)">搜索</n-button>
|
||
<n-text v-if="downloadRef?.searchHint" class="search-hint" depth="3">{{ downloadRef.searchHint }}</n-text>
|
||
</div>
|
||
<div class="bar-actions">
|
||
<template v-if="page === 'settings'">
|
||
<n-button secondary :disabled="settingsBusy" @click="restoreCurrent">还原设置</n-button>
|
||
<n-button type="primary" :loading="settingsBusy" @click="saveSettings">保存</n-button>
|
||
</template>
|
||
<n-button v-if="page === 'download'" secondary :loading="downloadRef?.busy" @click="downloadRef?.reload(true)">刷新</n-button>
|
||
</div>
|
||
</n-layout-header>
|
||
<n-layout-content content-style="height: 100%; padding: 0">
|
||
<VideoListPage
|
||
v-show="page === 'download'"
|
||
ref="downloadRef"
|
||
:token="token"
|
||
:device="sessionDevice()"
|
||
:api-base="apiBase"
|
||
:remote-search="platform === 'huangdou'"
|
||
@started="page = 'progress'"
|
||
@play="openPlay"
|
||
/>
|
||
<PlayerPage
|
||
v-if="page === 'play' && playing"
|
||
:token="token"
|
||
:device="sessionDevice()"
|
||
:drama-id="playing.id"
|
||
:api-base="apiBase"
|
||
/>
|
||
<DownloadProgressPage v-show="page === 'progress'" :api-base="apiBase" :active="downloadState.active" :done="downloadState.done" />
|
||
<div v-show="page === 'settings'" class="settings-page">
|
||
<n-alert v-if="settingsError" class="hint" type="error" :show-icon="false">{{ settingsError }}</n-alert>
|
||
<SettingsPanel v-model:tab="settingsTab" :draft="draft" :hide-device="platform === 'huangdou'" @choose="chooseDownloadDirectory" />
|
||
</div>
|
||
<div v-show="page === 'profile'" class="profile-page">
|
||
<div class="profile-sheet">
|
||
<div class="profile-head">
|
||
<n-avatar round :size="64" :src="avatarSrc" />
|
||
<div class="profile-id">
|
||
<div class="profile-name-row">
|
||
<span class="profile-name">{{ profile.nickname || "未命名" }}</span>
|
||
<n-tag v-if="profile.badge" size="small" :bordered="false" type="success">{{ profile.badge }}</n-tag>
|
||
</div>
|
||
<span class="profile-sub">{{ profile.email || "未绑定邮箱" }}</span>
|
||
</div>
|
||
<n-tooltip placement="bottom">
|
||
<template #trigger>
|
||
<n-button quaternary circle aria-label="退出" @click="logout">
|
||
<template #icon>
|
||
<svg class="logout-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" />
|
||
<path d="M16 17l5-5-5-5" />
|
||
<path d="M21 12H9" />
|
||
</svg>
|
||
</template>
|
||
</n-button>
|
||
</template>
|
||
退出
|
||
</n-tooltip>
|
||
</div>
|
||
<div class="profile-stats" :style="{ gridTemplateColumns: `repeat(${statFields.length}, minmax(0, 1fr))` }">
|
||
<div v-for="item in statFields" :key="item.key" class="profile-stat">
|
||
<span class="profile-stat-value">{{ profileNumber(item.key) }}</span>
|
||
<span class="profile-stat-label">{{ item.label }}</span>
|
||
</div>
|
||
</div>
|
||
<div class="profile-block">
|
||
<div class="profile-block-title">账号</div>
|
||
<div v-for="item in accountFields" :key="item.key" class="profile-row">
|
||
<span class="profile-row-label">{{ item.label }}</span>
|
||
<span class="profile-row-value">{{ profileText(item.key) }}</span>
|
||
</div>
|
||
</div>
|
||
<div v-if="platform === 'rapt'" class="profile-block">
|
||
<div class="profile-block-title">绑定</div>
|
||
<div class="profile-binds">
|
||
<span v-for="item in bindFields" :key="item.key" class="profile-bind" :class="{ on: profileBound(item.key) }">{{ item.label }}</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</n-layout-content>
|
||
</n-layout>
|
||
</n-layout>
|
||
<n-layout v-else class="shell login-shell" has-sider position="absolute">
|
||
<n-layout-sider bordered :width="208" content-style="height: 100%; padding: 0">
|
||
<div class="sider">
|
||
<n-menu
|
||
:value="platform"
|
||
:options="platforms.map((item) => ({ label: item.label, key: item.key }))"
|
||
@update:value="selectPlatform"
|
||
/>
|
||
</div>
|
||
</n-layout-sider>
|
||
<n-layout-content>
|
||
<div class="login-center">
|
||
<div class="card">
|
||
<n-tabs v-if="platform === 'rapt'" v-model:value="method" type="segment" size="small">
|
||
<n-tab v-for="item in methods" :key="item.id" :name="item.id">{{ item.label }}</n-tab>
|
||
</n-tabs>
|
||
<n-form label-placement="left" label-width="96" size="small" :show-feedback="false" @submit.prevent="login">
|
||
<template v-if="platform === 'rapt' && method === 'password'">
|
||
<n-form-item v-if="savedAccounts.length" label="已保存">
|
||
<div class="device-line">
|
||
<n-select
|
||
:value="selectedAccount"
|
||
:options="accountOptions"
|
||
placeholder="选择已保存的账号"
|
||
@update:value="applyAccount"
|
||
/>
|
||
<n-button :disabled="!selectedAccount" @click="removeAccount">删除</n-button>
|
||
</div>
|
||
</n-form-item>
|
||
<n-form-item label="邮箱">
|
||
<n-input v-model:value="email" type="text" placeholder="邮箱" autocomplete="username" />
|
||
</n-form-item>
|
||
<n-form-item label="密码">
|
||
<n-input v-model:value="password" type="password" show-password-on="click" placeholder="密码" autocomplete="current-password" />
|
||
</n-form-item>
|
||
<n-form-item label="记住">
|
||
<n-checkbox v-model:checked="rememberPassword">记住账号密码</n-checkbox>
|
||
</n-form-item>
|
||
</template>
|
||
<n-form-item v-else-if="platform === 'rapt' && method === 'adb'" label="设备">
|
||
<div class="device-line">
|
||
<n-select
|
||
v-model:value="serial"
|
||
:options="deviceOptions"
|
||
:loading="devicesBusy"
|
||
placeholder="请选择设备"
|
||
/>
|
||
<n-button :loading="devicesBusy" @click="loadDevices">刷新</n-button>
|
||
<n-button :loading="devicesBusy" @click="probeMumu">探测 MuMu</n-button>
|
||
</div>
|
||
</n-form-item>
|
||
<n-text v-if="platform === 'rapt' && method === 'guest'" class="hint" depth="3">将注册一个新的游客账号,并读取它的个人信息。</n-text>
|
||
<n-text v-if="platform === 'rapt' && method === 'adb' && !devicesBusy && devices.length === 0" class="hint" depth="3">没有检测到已连接的设备。</n-text>
|
||
<n-text v-if="platform === 'rapt' && method === 'adb'" class="hint" depth="3">从已 root 的设备读取当前登录账号。未 root 的设备无法获取登录信息。默认同时读取这台设备的品牌、型号和系统版本,可在右下角设置里修改。</n-text>
|
||
<n-alert v-if="error" class="hint" type="error" :show-icon="false">{{ error }}</n-alert>
|
||
<div class="login-actions">
|
||
<n-button type="primary" attr-type="submit" :loading="busy">{{ platform === "huangdou" ? "进入" : "登录" }}</n-button>
|
||
</div>
|
||
</n-form>
|
||
</div>
|
||
</div>
|
||
</n-layout-content>
|
||
</n-layout>
|
||
<n-tooltip v-if="!profile" placement="left">
|
||
<template #trigger>
|
||
<n-button class="settings-button" secondary circle aria-label="设置" @click="openSettings">
|
||
<template #icon>
|
||
<svg class="gear-icon" viewBox="0 0 24 24" aria-hidden="true">
|
||
<path
|
||
fill="currentColor"
|
||
d="M19.14 12.94c.04-.31.06-.63.06-.94s-.02-.63-.06-.94l2.03-1.58a.5.5 0 0 0 .12-.64l-1.92-3.32a.5.5 0 0 0-.6-.22l-2.39.96a7.2 7.2 0 0 0-1.63-.94l-.36-2.54a.5.5 0 0 0-.5-.42h-3.84a.5.5 0 0 0-.5.42l-.36 2.54c-.58.22-1.12.54-1.63.94l-2.39-.96a.5.5 0 0 0-.6.22L2.71 8.84a.5.5 0 0 0 .12.64l2.03 1.58c-.04.31-.06.63-.06.94s.02.63.06.94l-2.03 1.58a.5.5 0 0 0-.12.64l1.92 3.32c.13.22.39.31.6.22l2.39-.96c.51.4 1.05.72 1.63.94l.36 2.54c.05.24.26.42.5.42h3.84c.24 0 .45-.18.5-.42l.36-2.54c.58-.22 1.12-.54 1.63-.94l2.39.96c.22.09.47 0 .6-.22l1.92-3.32a.5.5 0 0 0-.12-.64l-2.03-1.58zM12 15.5A3.5 3.5 0 1 1 12 8a3.5 3.5 0 0 1 0 7.5z"
|
||
/>
|
||
</svg>
|
||
</template>
|
||
</n-button>
|
||
</template>
|
||
设置
|
||
</n-tooltip>
|
||
<n-modal v-model:show="settingsOpen" preset="card" title="设置" style="width: 640px">
|
||
<div class="settings-modal-body">
|
||
<n-alert v-if="settingsError" class="hint" type="error" :show-icon="false">{{ settingsError }}</n-alert>
|
||
<SettingsPanel v-model:tab="settingsTab" :draft="draft" :hide-device="platform === 'huangdou'" @choose="chooseDownloadDirectory" />
|
||
</div>
|
||
<template #footer>
|
||
<div class="modal-actions">
|
||
<n-button :disabled="settingsBusy" @click="restoreCurrent">还原设置</n-button>
|
||
<span class="modal-spacer"></span>
|
||
<n-button :disabled="settingsBusy" @click="settingsOpen = false">取消</n-button>
|
||
<n-button type="primary" :loading="settingsBusy" @click="saveSettings">保存</n-button>
|
||
</div>
|
||
</template>
|
||
</n-modal>
|
||
<n-modal
|
||
v-model:show="closeAsk"
|
||
preset="dialog"
|
||
title="关闭程序"
|
||
positive-text="确定"
|
||
negative-text="取消"
|
||
:mask-closable="false"
|
||
@positive-click="confirmQuit"
|
||
>
|
||
还有 {{ closeCount }} 个未完成的下载,关闭后会中断。确定要关闭吗?
|
||
</n-modal>
|
||
</n-config-provider>
|
||
</template>
|
||
|
||
<style>
|
||
html, body, #app { height: 100%; margin: 0; }
|
||
html { color-scheme: dark; }
|
||
* {
|
||
scrollbar-width: thin;
|
||
scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
|
||
}
|
||
*::-webkit-scrollbar { width: 8px; height: 8px; }
|
||
*::-webkit-scrollbar-track { background: transparent; }
|
||
*::-webkit-scrollbar-thumb {
|
||
background: rgba(255, 255, 255, 0.22);
|
||
border-radius: 4px;
|
||
}
|
||
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.36); }
|
||
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
|
||
*::-webkit-scrollbar-corner { background: transparent; }
|
||
.app { height: 100%; position: relative; }
|
||
.shell .n-layout-scroll-container { overflow-y: auto; }
|
||
.shell .main-pane { height: 100%; min-height: 0; }
|
||
.shell .main-pane > .n-layout-scroll-container {
|
||
height: 100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow: hidden;
|
||
}
|
||
.shell .main-pane > .n-layout-scroll-container > .n-layout-content {
|
||
flex: 1;
|
||
min-height: 0;
|
||
}
|
||
.shell .main-pane .n-layout-content > .n-layout-scroll-container {
|
||
height: 100%;
|
||
overflow: hidden;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
.shell .main-pane .n-layout-content > .n-layout-scroll-container > * {
|
||
flex: 1 1 auto;
|
||
min-height: 0;
|
||
}
|
||
.sider { height: 100%; min-height: 100%; display: flex; flex-direction: column; box-sizing: border-box; padding: 12px 8px; }
|
||
.platform-mark {
|
||
padding: 2px 12px 10px;
|
||
color: rgba(255, 255, 255, 0.55);
|
||
font-size: 13px;
|
||
line-height: 1.2;
|
||
}
|
||
.user-nav {
|
||
margin-top: auto;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 2px;
|
||
min-height: 48px;
|
||
padding: 4px 2px 4px 10px;
|
||
border-radius: 6px;
|
||
}
|
||
.user-nav.active { background: rgba(99, 226, 183, 0.16); }
|
||
.user-nav-main {
|
||
flex: 1;
|
||
min-width: 0;
|
||
height: 36px;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10px;
|
||
margin: 0;
|
||
padding: 0;
|
||
border: 0;
|
||
background: transparent;
|
||
color: inherit;
|
||
font: inherit;
|
||
cursor: pointer;
|
||
text-align: left;
|
||
}
|
||
.user-nav-name {
|
||
flex: 1;
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
line-height: 1.2;
|
||
}
|
||
.user-nav .n-avatar,
|
||
.profile-head .n-avatar {
|
||
flex: none;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
.user-nav .n-avatar img,
|
||
.profile-head .n-avatar img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
object-position: center;
|
||
}
|
||
.profile-page { height: 100%; overflow: auto; box-sizing: border-box; padding: 20px; }
|
||
.profile-sheet {
|
||
max-width: 640px;
|
||
margin: 0 auto;
|
||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||
border-radius: 8px;
|
||
background: rgba(255, 255, 255, 0.03);
|
||
overflow: hidden;
|
||
}
|
||
.profile-head { display: flex; align-items: center; gap: 16px; padding: 20px 16px 16px; }
|
||
.profile-id { flex: 1; min-width: 0; }
|
||
.profile-name-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
||
.profile-name {
|
||
min-width: 0;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
font-size: 18px;
|
||
font-weight: 600;
|
||
line-height: 1.2;
|
||
}
|
||
.profile-sub {
|
||
display: block;
|
||
margin-top: 6px;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
color: rgba(255, 255, 255, 0.45);
|
||
font-size: 13px;
|
||
}
|
||
.profile-stats {
|
||
display: grid;
|
||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
||
}
|
||
.profile-stat {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
gap: 4px;
|
||
padding: 14px 4px;
|
||
}
|
||
.profile-stat + .profile-stat { border-left: 1px solid rgba(255, 255, 255, 0.08); }
|
||
.profile-stat-value { font-size: 18px; font-weight: 600; line-height: 1.2; }
|
||
.profile-stat-label { font-size: 12px; color: rgba(255, 255, 255, 0.45); }
|
||
.profile-block { border-top: 1px solid rgba(255, 255, 255, 0.08); }
|
||
.profile-block-title { padding: 12px 16px 0; font-size: 13px; color: rgba(255, 255, 255, 0.45); }
|
||
.profile-row { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 16px; }
|
||
.profile-row-label { width: 72px; flex: none; color: rgba(255, 255, 255, 0.72); }
|
||
.profile-row-value {
|
||
flex: 1;
|
||
min-width: 0;
|
||
text-align: right;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
.profile-binds { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 16px; }
|
||
.profile-bind {
|
||
min-width: 72px;
|
||
height: 28px;
|
||
padding: 0 10px;
|
||
border-radius: 6px;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background: rgba(255, 255, 255, 0.06);
|
||
color: rgba(255, 255, 255, 0.45);
|
||
font-size: 13px;
|
||
}
|
||
.profile-bind.on { background: rgba(99, 226, 183, 0.16); color: #63e2b7; }
|
||
.logout-icon {
|
||
width: 18px;
|
||
height: 18px;
|
||
display: block;
|
||
fill: none;
|
||
stroke: currentColor;
|
||
stroke-width: 2;
|
||
stroke-linecap: round;
|
||
stroke-linejoin: round;
|
||
}
|
||
.bar {
|
||
position: relative;
|
||
display: flex; align-items: center; justify-content: space-between;
|
||
height: auto; padding: 12px 20px;
|
||
}
|
||
.bar-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
||
.bar-title-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||
.bar-search {
|
||
position: absolute;
|
||
left: 50%;
|
||
top: 50%;
|
||
transform: translate(-50%, -50%);
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 8px;
|
||
}
|
||
.search-hint { min-width: 2.5em; }
|
||
.bar-actions { display: flex; align-items: center; gap: 8px; }
|
||
.nav-label { display: inline-flex; align-items: center; gap: 8px; }
|
||
.nav-badge {
|
||
min-width: 18px;
|
||
height: 18px;
|
||
padding: 0 5px;
|
||
border-radius: 9px;
|
||
background: #63e2b7;
|
||
color: #101014;
|
||
font-size: 12px;
|
||
line-height: 18px;
|
||
text-align: center;
|
||
}
|
||
.login-shell,
|
||
.login-shell > .n-layout-scroll-container,
|
||
.login-shell .n-layout-content,
|
||
.login-shell .n-layout-content > .n-layout-scroll-container { height: 100%; }
|
||
.login-shell .n-layout-sider,
|
||
.login-shell .n-layout-sider > .n-layout-sider-scroll-container { height: 100%; }
|
||
.login-center {
|
||
height: 100%;
|
||
display: flex;
|
||
align-items: safe center;
|
||
justify-content: center;
|
||
box-sizing: border-box;
|
||
padding: 28px 20px;
|
||
}
|
||
.card { width: 100%; max-width: 560px; }
|
||
.login-actions { display: flex; justify-content: center; margin-top: 16px; }
|
||
.login-actions .n-button { min-width: 180px; }
|
||
.settings-button { position: fixed; right: 20px; bottom: 20px; z-index: 5; }
|
||
.gear-icon { width: 18px; height: 18px; display: block; }
|
||
.settings-modal-body { max-height: min(58vh, 520px); overflow: auto; padding-right: 4px; }
|
||
.modal-actions { display: flex; align-items: center; gap: 8px; }
|
||
.modal-spacer { flex: 1; }
|
||
.card .n-tabs { margin-bottom: 16px; }
|
||
.card .n-form-item { margin-bottom: 16px; }
|
||
.card .n-avatar { margin-bottom: 16px; }
|
||
.device-line { display: flex; gap: 8px; width: 100%; align-items: center; }
|
||
.device-line .n-select,
|
||
.device-line .n-input { flex: 1; min-width: 0; }
|
||
.hint { display: block; margin: 8px 0; }
|
||
.settings-page {
|
||
height: 100%;
|
||
min-height: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
box-sizing: border-box;
|
||
padding: 8px 20px 20px;
|
||
}
|
||
.settings-page > .n-tabs { flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
||
.settings-page .n-tabs-pane-wrapper { flex: 1; min-height: 0; overflow: auto; }
|
||
.settings-form { max-width: 640px; padding-top: 8px; }
|
||
.settings-form .n-form-item { margin-bottom: 16px; }
|
||
.field-label { display: inline-flex; align-items: center; gap: 6px; }
|
||
.worker-input { width: 148px; }
|
||
.worker-input .n-input__input-el { text-align: center; }
|
||
.help-dot {
|
||
width: 16px;
|
||
height: 16px;
|
||
border-radius: 50%;
|
||
border: 1px solid rgba(255, 255, 255, 0.28);
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 11px;
|
||
line-height: 1;
|
||
color: rgba(255, 255, 255, 0.65);
|
||
cursor: help;
|
||
}
|
||
</style>
|