mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
feat(settings): AccountSettingSearch
- 增加防抖。
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
import { useToast } from 'vue-toast-notification'
|
import { useToast } from 'vue-toast-notification'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import type { FilterRuleGroup, Site } from '@/api/types'
|
import type { FilterRuleGroup, Site } from '@/api/types'
|
||||||
|
import debounce from 'lodash/debounce'
|
||||||
|
|
||||||
|
// 防抖时间
|
||||||
|
const debounceTime = 500
|
||||||
|
|
||||||
// 提示框
|
// 提示框
|
||||||
const $toast = useToast()
|
const $toast = useToast()
|
||||||
@@ -79,7 +83,7 @@ async function querySelectedSites() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 保存用户选中的站点
|
// 保存用户选中的站点
|
||||||
async function saveSelectedSites() {
|
const saveSelectedSites = debounce(async () => {
|
||||||
try {
|
try {
|
||||||
// 用户名密码
|
// 用户名密码
|
||||||
const result: { [key: string]: any } = await api.post('system/setting/IndexerSites', selectedSites.value)
|
const result: { [key: string]: any } = await api.post('system/setting/IndexerSites', selectedSites.value)
|
||||||
@@ -89,7 +93,7 @@ async function saveSelectedSites() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
}
|
}, debounceTime)
|
||||||
|
|
||||||
// 调用API查询下载器设置
|
// 调用API查询下载器设置
|
||||||
async function loadSearchSetting() {
|
async function loadSearchSetting() {
|
||||||
@@ -104,7 +108,7 @@ async function loadSearchSetting() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 调用API保存设置
|
// 调用API保存设置
|
||||||
async function saveSearchSetting() {
|
const saveSearchSetting = debounce(async () => {
|
||||||
try {
|
try {
|
||||||
const result1: { [key: string]: any } = await api.post(
|
const result1: { [key: string]: any } = await api.post(
|
||||||
'system/setting/SEARCH_SOURCE',
|
'system/setting/SEARCH_SOURCE',
|
||||||
@@ -124,7 +128,7 @@ async function saveSearchSetting() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
}
|
}, debounceTime)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
querySites()
|
querySites()
|
||||||
|
|||||||
Reference in New Issue
Block a user