feat: enhance download manager with folder notes and improved worker settings

This commit is contained in:
Nixevol
2026-09-27 15:30:48 +08:00
parent fdb1f73968
commit 68d27a5caf
5 changed files with 184 additions and 35 deletions
+4 -4
View File
@@ -170,7 +170,7 @@ const settings = ref({
adbMode: "device" as "device" | "settings",
custom: { ...builtinDevice.value },
proxy: emptyProxy(),
workers: 2,
workers: 6,
directory: "",
defaultDirectory: "",
});
@@ -241,7 +241,7 @@ async function loadDeviceDefaults() {
function normalizeWorkers(value: unknown) {
const count = Number(value);
if (!Number.isInteger(count) || count < 1 || count > 8) return 2;
if (!Number.isInteger(count) || count < 1) return 6;
return count;
}
@@ -302,7 +302,7 @@ async function saveSettings() {
const workers = normalizeWorkers(draft.value.workers);
if (workers !== Number(draft.value.workers)) {
settingsTab.value = "download";
settingsError.value = "同时下载数量需要在 1 到 8 之间";
settingsError.value = "同时下载数量至少为 1";
return;
}
const directory = draft.value.directory.trim();
@@ -365,7 +365,7 @@ function restoreCurrent() {
draft.value.proxy = emptyProxy();
return;
}
draft.value.workers = 2;
draft.value.workers = 6;
draft.value.directory = draft.value.defaultDirectory || settings.value.defaultDirectory;
}
+2 -2
View File
@@ -150,11 +150,11 @@ function setDraftField(key: keyof DeviceProfile, value: string | boolean) {
<template #trigger>
<span class="help-dot" tabindex="0">?</span>
</template>
同时进行的下载任务数,范围 1 到 8,默认 2。调低后,多出来的任务会在当前这部下完后停下来。
同时进行的下载任务数,至少 1 个,默认 6。调低后,多出来的任务会在当前这部下完后停下来。
</n-tooltip>
</span>
</template>
<n-input-number v-model:value="draft.workers" class="worker-input" button-placement="both" :min="1" :max="8" :precision="0" />
<n-input-number v-model:value="draft.workers" class="worker-input" button-placement="both" :min="1" :precision="0" />
</n-form-item>
</n-form>
</n-tab-pane>
+9 -1
View File
@@ -84,6 +84,10 @@ function toggleSection(section: Section, checked: boolean) {
selected.value = next;
}
function clearSelection() {
selected.value = new Set();
}
function pruneSelection() {
const ids = new Set(sections.value.flatMap((section) => section.items.map((item) => item.id)));
selected.value = new Set([...selected.value].filter((id) => ids.has(id)));
@@ -417,7 +421,10 @@ async function startDownload() {
</div>
</div>
<footer class="download-foot">
<n-text>已选 {{ selected.size }} 部</n-text>
<div class="foot-selected">
<n-text>已选 {{ selected.size }} 部</n-text>
<n-button secondary size="small" :disabled="selected.size === 0" @click="clearSelection">取消选择</n-button>
</div>
<div class="foot-actions">
<n-text class="foot-dir" depth="3" :title="directory">{{ directory || "未设置下载目录" }}</n-text>
<n-button secondary size="small" @click="chooseDirectory">选择</n-button>
@@ -445,6 +452,7 @@ async function startDownload() {
background: #18181c;
}
.foot-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.foot-selected { display: flex; align-items: center; gap: 8px; flex: none; }
.foot-dir { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-error { display: block; padding: 0 20px 8px; text-align: right; }
.catalog-error { margin: 8px 20px 12px; }