diff --git a/src/views/account-setting/AccountSettingSystem.vue b/src/views/account-setting/AccountSettingSystem.vue index 59331b6d..312700d2 100644 --- a/src/views/account-setting/AccountSettingSystem.vue +++ b/src/views/account-setting/AccountSettingSystem.vue @@ -12,6 +12,15 @@ const selectedSites = ref([]); // 所有站点 const allSites = ref([]); +// 种子优先规则下拉框 +const TorrentPriorityItems = [ + { title: "站点优先", value: 'site' }, + { title: "做种数优先", value: 'seeder' }, +]; + +// 种子优先规则 +const selectedTorrentPriority = ref('seeder'); + // 查询所有站点 const querySites = async () => { try { @@ -32,6 +41,16 @@ const querySelectedSites = async () => { } }; +// 查询种子优先规则 +const queryTorrentPriority = async () => { + try { + const result: { [key: string]: any } = await api.get("system/setting/TorrentsPriority"); + selectedTorrentPriority.value = result.data?.value; + } catch (error) { + console.log(error); + } +}; + // 保存用户选中的站点 const saveSelectedSites = async () => { try { @@ -50,32 +69,59 @@ const saveSelectedSites = async () => { } }; +// 保存种子优先规则 +const saveTorrentPriority = async () => { + try { + // 用户名密码 + const result: { [key: string]: any } = await api.post( + "system/setting/TorrentsPriority", + selectedTorrentPriority.value + ); + if (result.success) { + $toast.success("优先规则保存成功"); + } else { + $toast.error("优先规则保存失败!"); + } + } catch (error) { + console.log(error); + } +}; + onMounted(() => { querySites(); querySelectedSites(); + queryTorrentPriority(); });