diff --git a/src/views/setting/AccountSettingSite.vue b/src/views/setting/AccountSettingSite.vue index debe89c5..fdcbd063 100644 --- a/src/views/setting/AccountSettingSite.vue +++ b/src/views/setting/AccountSettingSite.vue @@ -2,9 +2,6 @@ import { useToast } from 'vue-toast-notification' import api from '@/api' -// 从 provide 中获取全局设置 -const globalSettings: any = inject('globalSettings') - // 提示框 const $toast = useToast() @@ -18,7 +15,7 @@ const resetSitesText = ref('重置站点数据') const resetSitesDisabled = ref(false) // CookieCloud设置项 -const cookieCloudSetting = ref({ +const siteSetting = ref({ COOKIECLOUD_HOST: '', COOKIECLOUD_KEY: '', COOKIECLOUD_PASSWORD: '', @@ -26,6 +23,7 @@ const cookieCloudSetting = ref({ USER_AGENT: '', COOKIECLOUD_ENABLE_LOCAL: '', COOKIECLOUD_BLACKLIST: '', + SITEDATA_REFRESH_INTERVAL: 0, }) // 同步间隔下拉框 @@ -39,6 +37,16 @@ const CookieCloudIntervalItems = [ { title: '永不', value: 0 }, ] +// 站点数据刷新间隔 +const SiteDataRefreshIntervalItems = [ + { title: '每小时', value: 1 }, + { title: '每6小时', value: 6 }, + { title: '每12小时', value: 12 }, + { title: '每天', value: 24 }, + { title: '每周', value: 168 }, + { title: '永不', value: 0 }, +] + // 重置站点 async function resetSites() { try { @@ -56,8 +64,8 @@ async function resetSites() { } } -// 加载CookieCloud设置 -async function loadCookieCloudSettings() { +// 加载站点设置 +async function loadSiteSettings() { try { const result: { [key: string]: any } = await api.get('system/env') if (result.success) { @@ -69,8 +77,9 @@ async function loadCookieCloudSettings() { USER_AGENT, COOKIECLOUD_ENABLE_LOCAL, COOKIECLOUD_BLACKLIST, + SITEDATA_REFRESH_INTERVAL, } = result.data - cookieCloudSetting.value = { + siteSetting.value = { COOKIECLOUD_HOST, COOKIECLOUD_KEY, COOKIECLOUD_PASSWORD, @@ -78,6 +87,7 @@ async function loadCookieCloudSettings() { USER_AGENT, COOKIECLOUD_ENABLE_LOCAL, COOKIECLOUD_BLACKLIST, + SITEDATA_REFRESH_INTERVAL, } } } catch (error) { @@ -86,12 +96,12 @@ async function loadCookieCloudSettings() { } // 调用API保存CookieCloud设置 -async function saveCookieCloudetting() { +async function saveSiteSetting() { try { - const result: { [key: string]: any } = await api.post('system/env', cookieCloudSetting.value) + const result: { [key: string]: any } = await api.post('system/env', siteSetting.value) - if (result.success) $toast.success('保存站点同步设置成功') - else $toast.error('保存站点同步设置失败!') + if (result.success) $toast.success('保存站点设置成功') + else $toast.error('保存站点设置失败!') } catch (error) { console.log(error) } @@ -99,7 +109,7 @@ async function saveCookieCloudetting() { // 加载数据 onMounted(() => { - loadCookieCloudSettings() + loadSiteSettings() }) @@ -116,7 +126,7 @@ onMounted(() => { { { { { { { - 保存 + 保存 + + + + + + + + + + + + + + + + + 保存