mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
优化webdav相关
This commit is contained in:
@@ -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: '',
|
||||
|
||||
Reference in New Issue
Block a user