fix: 多选同步弹窗复用站点同步表单缓存

- 抽取站点地址与 Token 的 24 小时缓存工具
- 存储页与多选同步弹窗共用 pichost.site-sync-form
- 弹窗打开时读取最新缓存,修改后写回
- 增加缓存读取与过期测试
This commit is contained in:
tianmo committed 2026-10-19 16:10:48 +08:00
1 parent 58424fe55d
commit 366b8a4272
4 files changed
+122 -31

No files matched your search

@@ -1,4 +1,6 @@
<script setup lang="ts">
import { loadSiteSyncForm, saveSiteSyncForm } from '~/utils/site-sync-form'
const props = defineProps<{
open: boolean
keys: string[]
@@ -17,6 +19,19 @@ const token = ref('')
const conflictMode = ref<'skip' | 'overwrite'>('skip')
const busy = ref(false)
watch(() => props.open, (open) => {
if (!open) return
const saved = loadSiteSyncForm()
if (saved) {
targetBaseUrl.value = saved.targetBaseUrl
token.value = saved.token
}
}, { immediate: true })
watch([targetBaseUrl, token], () => {
saveSiteSyncForm(targetBaseUrl.value, token.value)
})
const canSubmit = computed(() =>
!busy.value
&& props.keys.length > 0