mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-08-27 11:10:12 +08:00
feat:下载器多选
This commit is contained in:
@@ -8,6 +8,9 @@ import { requiredValidator } from '@/@validators'
|
|||||||
// 选中的媒体服务器
|
// 选中的媒体服务器
|
||||||
const selectedMediaServers = ref([])
|
const selectedMediaServers = ref([])
|
||||||
|
|
||||||
|
// 选中的下载器
|
||||||
|
const selectedDownloaders = ref([])
|
||||||
|
|
||||||
// 下载器选中标签页
|
// 下载器选中标签页
|
||||||
const downloaderTab = ref('qbittorrent')
|
const downloaderTab = ref('qbittorrent')
|
||||||
|
|
||||||
@@ -33,7 +36,6 @@ const mediaSettings = ref({
|
|||||||
|
|
||||||
// 下载器设置项
|
// 下载器设置项
|
||||||
const downloaderSettings = ref({
|
const downloaderSettings = ref({
|
||||||
DOWNLOADER: '',
|
|
||||||
DOWNLOADER_MONITOR: true,
|
DOWNLOADER_MONITOR: true,
|
||||||
TORRENT_TAG: '',
|
TORRENT_TAG: '',
|
||||||
QB_HOST: '',
|
QB_HOST: '',
|
||||||
@@ -184,10 +186,12 @@ async function saveMediaSetting() {
|
|||||||
// 调用API查询下载器设置
|
// 调用API查询下载器设置
|
||||||
async function loadDownladerSetting() {
|
async function loadDownladerSetting() {
|
||||||
try {
|
try {
|
||||||
const result: { [key: string]: any } = await api.get('system/env')
|
const result1: { [key: string]: any } = await api.get('system/setting/DOWNLOADER')
|
||||||
if (result.success) {
|
if (result1.success)
|
||||||
|
selectedDownloaders.value = result1.data?.value?.split(',')
|
||||||
|
const result2: { [key: string]: any } = await api.get('system/env')
|
||||||
|
if (result2.success) {
|
||||||
const {
|
const {
|
||||||
DOWNLOADER,
|
|
||||||
DOWNLOADER_MONITOR,
|
DOWNLOADER_MONITOR,
|
||||||
TORRENT_TAG,
|
TORRENT_TAG,
|
||||||
QB_HOST,
|
QB_HOST,
|
||||||
@@ -201,7 +205,6 @@ async function loadDownladerSetting() {
|
|||||||
TR_PASSWORD,
|
TR_PASSWORD,
|
||||||
} = result.data
|
} = result.data
|
||||||
downloaderSettings.value = {
|
downloaderSettings.value = {
|
||||||
DOWNLOADER,
|
|
||||||
DOWNLOADER_MONITOR,
|
DOWNLOADER_MONITOR,
|
||||||
TORRENT_TAG,
|
TORRENT_TAG,
|
||||||
QB_HOST,
|
QB_HOST,
|
||||||
@@ -214,7 +217,6 @@ async function loadDownladerSetting() {
|
|||||||
TR_USER,
|
TR_USER,
|
||||||
TR_PASSWORD,
|
TR_PASSWORD,
|
||||||
}
|
}
|
||||||
downloaderTab.value = DOWNLOADER === 'qbittorrent' ? 'qbittorrent' : 'transmission'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@@ -225,12 +227,16 @@ async function loadDownladerSetting() {
|
|||||||
// 调用API保存下载器设置
|
// 调用API保存下载器设置
|
||||||
async function saveDownloaderSetting() {
|
async function saveDownloaderSetting() {
|
||||||
try {
|
try {
|
||||||
const result: { [key: string]: any } = await api.post(
|
const result1: { [key: string]: any } = await api.post(
|
||||||
|
'system/setting/DOWNLOADER',
|
||||||
|
selectedDownloaders.value.join(','),
|
||||||
|
)
|
||||||
|
const result2: { [key: string]: any } = await api.post(
|
||||||
'system/env',
|
'system/env',
|
||||||
downloaderSettings.value,
|
downloaderSettings.value,
|
||||||
)
|
)
|
||||||
|
|
||||||
if (result.success) {
|
if (result1.success && result2.success) {
|
||||||
$toast.success('保存下载器设置成功')
|
$toast.success('保存下载器设置成功')
|
||||||
reloadModule()
|
reloadModule()
|
||||||
}
|
}
|
||||||
@@ -333,13 +339,15 @@ onMounted(() => {
|
|||||||
<VRow>
|
<VRow>
|
||||||
<VCol cols="12">
|
<VCol cols="12">
|
||||||
<VCard title="下载器">
|
<VCard title="下载器">
|
||||||
<VCardSubtitle>只有选中的下载器才会被默认使用。</VCardSubtitle>
|
<VCardSubtitle>只有选中的第1个下载器才会被默认使用。</VCardSubtitle>
|
||||||
<VCardText>
|
<VCardText>
|
||||||
<VForm>
|
<VForm>
|
||||||
<VRow>
|
<VRow>
|
||||||
<VCol cols="12" md="6">
|
<VCol cols="12" md="6">
|
||||||
<VSelect
|
<VSelect
|
||||||
v-model="downloaderSettings.DOWNLOADER"
|
v-model="selectedDownloaders"
|
||||||
|
multiple
|
||||||
|
chips
|
||||||
:items="Downloaders"
|
:items="Downloaders"
|
||||||
label="当前使用下载器"
|
label="当前使用下载器"
|
||||||
/>
|
/>
|
||||||
@@ -355,7 +363,7 @@ onMounted(() => {
|
|||||||
<VCol cols="12" md="6">
|
<VCol cols="12" md="6">
|
||||||
<VSwitch
|
<VSwitch
|
||||||
v-model="downloaderSettings.DOWNLOADER_MONITOR"
|
v-model="downloaderSettings.DOWNLOADER_MONITOR"
|
||||||
label="监控下载器"
|
label="监控默认下载器"
|
||||||
/>
|
/>
|
||||||
</VCol>
|
</VCol>
|
||||||
</VRow>
|
</VRow>
|
||||||
|
|||||||
Reference in New Issue
Block a user