feat(subscribe): 添加下载器选项到订阅设置

This commit is contained in:
jxxghp
2024-11-16 08:59:49 +08:00
parent 58fbaaa8f4
commit 414fb8afd1
3 changed files with 49 additions and 13 deletions
+2
View File
@@ -72,6 +72,8 @@ export interface Subscribe {
media_category?: string media_category?: string
// 过滤规则组 // 过滤规则组
filter_groups?: string[] filter_groups?: string[]
// 下载器
downloader?: string
} }
// 订阅分享 // 订阅分享
+7 -4
View File
@@ -67,10 +67,13 @@ async function loadDownloaderSetting() {
try { try {
const result: { [key: string]: any } = await api.get('system/setting/Downloaders') const result: { [key: string]: any } = await api.get('system/setting/Downloaders')
const downloaders = result.data?.value ?? [] const downloaders = result.data?.value ?? []
downloaderOptions.value = [{ title: '默认下载器', value: null }, ...downloaders.map((item: { name: any }) => ({ downloaderOptions.value = [
title: item.name, { title: '默认', value: null },
value: item.name, ...downloaders.map((item: { name: any }) => ({
}))] title: item.name,
value: item.name,
})),
]
} catch (error) { } catch (error) {
console.error('加载下载器设置失败:', error) console.error('加载下载器设置失败:', error)
} }
+40 -9
View File
@@ -57,6 +57,25 @@ const subscribeForm = ref<Subscribe>({
// 提示框 // 提示框
const $toast = useToast() const $toast = useToast()
// 下载器选项
const downloaderOptions = ref<{ title: string; value: string }[]>([])
async function loadDownloaderSetting() {
try {
const result: { [key: string]: any } = await api.get('system/setting/Downloaders')
const downloaders = result.data?.value ?? []
downloaderOptions.value = [
{ title: '默认', value: null },
...downloaders.map((item: { name: any }) => ({
title: item.name,
value: item.name,
})),
]
} catch (error) {
console.error('加载下载器设置失败:', error)
}
}
// 加载规则组 // 加载规则组
async function queryFilterRuleGroups() { async function queryFilterRuleGroups() {
try { try {
@@ -292,6 +311,7 @@ onMounted(() => {
queryFilterRuleGroups() queryFilterRuleGroups()
loadDownloadDirectories() loadDownloadDirectories()
getSiteList() getSiteList()
loadDownloaderSetting()
if (props.subid) getSubscribeInfo() if (props.subid) getSubscribeInfo()
if (props.default) queryDefaultSubscribeConfig() if (props.default) queryDefaultSubscribeConfig()
}) })
@@ -392,6 +412,26 @@ onMounted(() => {
/> />
</VCol> </VCol>
</VRow> </VRow>
<VRow>
<VCol cols="12" md="6">
<VSelect
v-model="subscribeForm.downloader"
:items="downloaderOptions"
label="下载器"
hint="指定该订阅使用的下载器,留空自动使用默认下载器"
persistent-hint
/>
</VCol>
<VCol cols="12" md="6">
<VCombobox
v-model="subscribeForm.save_path"
:items="targetDirectories"
label="保存路径"
hint="指定该订阅的下载保存路径,留空自动使用设定的下载目录"
persistent-hint
/>
</VCol>
</VRow>
<VRow> <VRow>
<VCol cols="12" md="4"> <VCol cols="12" md="4">
<VSwitch <VSwitch
@@ -461,15 +501,6 @@ onMounted(() => {
persistent-hint persistent-hint
/> />
</VCol> </VCol>
<VCol cols="12" md="6">
<VCombobox
v-model="subscribeForm.save_path"
:items="targetDirectories"
label="自定义保存路径"
hint="指定该订阅的下载保存路径,留空自动使用设定的下载目录"
persistent-hint
/>
</VCol>
</VRow> </VRow>
<VRow v-if="!props.default"> <VRow v-if="!props.default">
<VCol cols="12"> <VCol cols="12">