feat: 补全短剧全量清单并接入 DramaBox 官网登录

This commit is contained in:
Nixevol
2026-10-22 02:20:16 +08:00
parent 39774ad9cc
commit 00e78661a7
22 changed files with 894 additions and 194 deletions
+43 -6
View File
@@ -42,6 +42,7 @@ const flashSerial = ref(0);
const directory = ref("");
const starting = ref(false);
const footError = ref("");
const coverStatus = ref<Record<string, "ready" | "failed">>({});
const emit = defineEmits<{ started: []; play: [Drama] }>();
const scrollEl = ref<HTMLElement | null>(null);
@@ -52,6 +53,19 @@ function coverOf(image: string) {
return `https://apis.raptdrama.com${image.startsWith("/") ? image : `/${image}`}`;
}
function coverState(image: string): "empty" | "loading" | "ready" | "failed" {
const src = coverOf(image);
if (!src) return "empty";
const status = coverStatus.value[src];
if (status === "ready" || status === "failed") return status;
return "loading";
}
function markCover(src: string, ok: boolean) {
if (!src || coverStatus.value[src]) return;
coverStatus.value = { ...coverStatus.value, [src]: ok ? "ready" : "failed" };
}
function isExpanded(key: string) {
return expanded.value.includes(key);
}
@@ -441,10 +455,17 @@ async function startDownload() {
:data-card="cardKey(section.key, item.id)"
@click="toggleDrama(item.id, !selected.has(dramaKey(item.id)))"
>
<div class="cover">
<img v-if="item.image" :src="coverOf(item.image)" :alt="item.title" />
<div class="cover" :class="coverState(item.image)">
<span v-if="coverState(item.image) === 'loading'" class="cover-spin" aria-hidden="true"></span>
<img
v-if="coverOf(item.image)"
:src="coverOf(item.image)"
:alt="item.title"
@load="markCover(coverOf(item.image), true)"
@error="markCover(coverOf(item.image), false)"
/>
<span v-if="item.corner || item.locked || item.limitedFree" class="cover-tag">{{ item.corner || (item.limitedFree ? "限免" : item.payType || "付费") }}</span>
<div class="cover-play-layer">
<div v-if="coverState(item.image) !== 'loading'" class="cover-play-layer">
<n-tooltip placement="top">
<template #trigger>
<button type="button" class="cover-play" aria-label="播放" @click.stop="emit('play', item)">
@@ -551,7 +572,22 @@ async function startDownload() {
background: rgba(255, 255, 255, 0.04);
cursor: pointer;
}
.cover { position: relative; background: #2a2a2a; }
.cover {
position: relative;
display: flex;
align-items: center;
justify-content: center;
aspect-ratio: 3 / 4;
background: transparent;
}
.cover-spin {
width: 28px;
height: 28px;
border-radius: 50%;
border: 2px solid rgba(99, 226, 183, 0.28);
border-top-color: #63e2b7;
animation: category-spin 0.7s linear infinite;
}
.cover-tag {
position: absolute;
left: 6px;
@@ -568,8 +604,9 @@ async function startDownload() {
text-overflow: ellipsis;
white-space: nowrap;
}
.cover img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.cover:not(:has(img)) { aspect-ratio: 3 / 4; }
.cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover.loading img,
.cover.failed img { position: absolute; width: 0; height: 0; opacity: 0; }
.cover-play-layer {
position: absolute;
inset: 0;