feat: 增加视频清单搜索,并在开发期缓存剧目清单
This commit is contained in:
+36
-7
@@ -81,7 +81,17 @@ const error = ref("");
|
||||
const token = ref("");
|
||||
const profile = ref<Profile | null>(null);
|
||||
const page = ref<"download" | "profile">("download");
|
||||
const downloadRef = ref<{ reload: () => void; busy: boolean } | null>(null);
|
||||
const downloadRef = ref<{
|
||||
reload: (refresh?: boolean) => void;
|
||||
busy: boolean;
|
||||
find: (keyword?: string) => void;
|
||||
searchHint: string;
|
||||
clearSearch: () => void;
|
||||
} | null>(null);
|
||||
const catalogQuery = ref("");
|
||||
watch(catalogQuery, (value) => {
|
||||
if (!String(value ?? "").trim()) downloadRef.value?.clearSearch();
|
||||
});
|
||||
let profileTimer = 0;
|
||||
let profilePulling = false;
|
||||
const builtinDevice = ref<DeviceProfile>({
|
||||
@@ -531,8 +541,19 @@ onUnmounted(stopProfileWatch);
|
||||
<n-layout class="main-pane">
|
||||
<n-layout-header bordered class="bar">
|
||||
<n-text strong>{{ page === "download" ? "视频清单" : "个人信息" }}</n-text>
|
||||
<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">
|
||||
<n-button v-if="page === 'download'" secondary :loading="downloadRef?.busy" @click="downloadRef?.reload()">刷新</n-button>
|
||||
<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">
|
||||
@@ -571,9 +592,6 @@ onUnmounted(stopProfileWatch);
|
||||
</n-layout>
|
||||
</n-layout>
|
||||
<n-layout v-else class="shell" position="absolute">
|
||||
<n-layout-header bordered class="bar">
|
||||
<n-text strong>RaptDrama</n-text>
|
||||
</n-layout-header>
|
||||
<n-layout-content content-style="padding: 28px 20px">
|
||||
<div class="card">
|
||||
<n-tabs v-model:value="method" type="segment" size="small">
|
||||
@@ -811,11 +829,22 @@ html, body, #app { height: 100%; margin: 0; }
|
||||
stroke-linejoin: round;
|
||||
}
|
||||
.bar {
|
||||
position: sticky; top: 0; z-index: 2;
|
||||
position: relative;
|
||||
display: flex; align-items: center; justify-content: space-between;
|
||||
height: auto; padding: 12px 20px;
|
||||
}
|
||||
.bar-actions { display: flex; gap: 8px; }
|
||||
.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; }
|
||||
.catalog-query { width: 220px; }
|
||||
.card { max-width: 560px; margin: 0 auto; }
|
||||
.card .n-tabs { margin-bottom: 16px; }
|
||||
.card .n-form-item { margin-bottom: 16px; }
|
||||
|
||||
Reference in New Issue
Block a user