优化webdav相关

This commit is contained in:
谦君
2025-12-27 01:37:35 +08:00
parent 66783f896c
commit 49753566c3
5 changed files with 25 additions and 52 deletions

View File

@@ -81,6 +81,7 @@
<script setup lang="ts">
import { ref, computed, watch } from 'vue'
import { useI18n } from '@/composables/useI18n'
import { useGameStore } from '@/stores/gameStore'
import {
Dialog,
DialogContent,
@@ -95,13 +96,11 @@ import { Label } from '@/components/ui/label'
import { Loader2 } from 'lucide-vue-next'
import {
type WebDAVConfig,
getWebDAVConfig,
saveWebDAVConfig,
clearWebDAVConfig,
testWebDAVConnection
} from '@/services/webdavService'
const { t } = useI18n()
const gameStore = useGameStore()
const isOpen = defineModel<boolean>('open', { default: false })
@@ -130,7 +129,7 @@ const isConfigValid = computed(() => {
// 加载已保存的配置
watch(isOpen, (open) => {
if (open) {
const saved = getWebDAVConfig()
const saved = gameStore.webdavConfig
if (saved) {
config.value = { ...saved }
hasExistingConfig.value = true
@@ -163,14 +162,14 @@ const handleTest = async () => {
}
const handleSave = () => {
saveWebDAVConfig(config.value)
gameStore.webdavConfig = { ...config.value }
hasExistingConfig.value = true
emit('saved', config.value)
isOpen.value = false
}
const handleClear = () => {
clearWebDAVConfig()
gameStore.webdavConfig = null
hasExistingConfig.value = false
config.value = {
serverUrl: '',