mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
docs: 新增西班牙语和日语README并优化多语言文档
新增README-ES.md(西班牙语)和README-JA.md(日语)文档,完善多语言README互链。优化各语言README徽章、技术栈、外链格式及语言切换区,提升文档一致性与可读性。
This commit is contained in:
@@ -38,6 +38,34 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- WebDAV 云同步 -->
|
||||
<div class="flex flex-col gap-3 p-4 border rounded-lg border-blue-500/30 bg-blue-500/5">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="space-y-1">
|
||||
<h3 class="font-medium flex items-center gap-2">
|
||||
<Cloud class="h-4 w-4 text-blue-500" />
|
||||
{{ t('settings.webdav.title') }}
|
||||
</h3>
|
||||
<p class="text-sm text-muted-foreground">{{ t('settings.webdav.desc') }}</p>
|
||||
</div>
|
||||
<Button @click="showWebDAVConfig = true" variant="outline" size="sm">
|
||||
<Settings2 class="mr-2 h-4 w-4" />
|
||||
{{ t('settings.webdav.config') }}
|
||||
</Button>
|
||||
</div>
|
||||
<div v-if="webdavConfig" class="flex gap-2 pt-2 border-t">
|
||||
<Button @click="handleWebDAVUpload" :disabled="isWebDAVUploading" class="flex-1" variant="outline">
|
||||
<CloudUpload class="mr-2 h-4 w-4" />
|
||||
{{ isWebDAVUploading ? t('settings.webdav.uploading') : t('settings.webdav.upload') }}
|
||||
</Button>
|
||||
<Button @click="showWebDAVFiles = true" class="flex-1" variant="outline">
|
||||
<CloudDownload class="mr-2 h-4 w-4" />
|
||||
{{ t('settings.webdav.download') }}
|
||||
</Button>
|
||||
</div>
|
||||
<p v-else class="text-xs text-muted-foreground">{{ t('settings.webdav.notConfigured') }}</p>
|
||||
</div>
|
||||
|
||||
<!-- 清除数据 -->
|
||||
<div class="flex items-center justify-between p-4 border rounded-lg border-destructive/50">
|
||||
<div class="space-y-1">
|
||||
@@ -97,7 +125,7 @@
|
||||
</CardHeader>
|
||||
<CardContent class="space-y-4">
|
||||
<!-- 浏览器通知 -->
|
||||
<div class="flex flex-col gap-4 p-4 border rounded-lg">
|
||||
<div class="flex flex-col gap-4 p-4 border rounded-lg" v-if="!Capacitor.isNativePlatform()">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="space-y-1">
|
||||
<h3 class="font-medium">{{ t('settings.browserNotifications') }}</h3>
|
||||
@@ -304,6 +332,12 @@
|
||||
|
||||
<!-- 隐私协议弹窗 -->
|
||||
<PrivacyDialog v-model:open="showPrivacyDialog" />
|
||||
|
||||
<!-- WebDAV 配置对话框 -->
|
||||
<WebDAVConfigDialog v-model:open="showWebDAVConfig" @saved="onWebDAVConfigSaved" />
|
||||
|
||||
<!-- WebDAV 文件列表对话框 -->
|
||||
<WebDAVFileListDialog v-model:open="showWebDAVFiles" :config="webdavConfig" @select="handleWebDAVDownload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -337,7 +371,11 @@
|
||||
ChevronDown,
|
||||
ChevronUp,
|
||||
RotateCcw,
|
||||
Shield
|
||||
Shield,
|
||||
Cloud,
|
||||
CloudUpload,
|
||||
CloudDownload,
|
||||
Settings2
|
||||
} from 'lucide-vue-next'
|
||||
import { saveAs } from 'file-saver'
|
||||
import { toast } from 'vue-sonner'
|
||||
@@ -348,7 +386,15 @@
|
||||
import type { VersionInfo } from '@/utils/versionCheck'
|
||||
import UpdateDialog from '@/components/dialogs/UpdateDialog.vue'
|
||||
import PrivacyDialog from '@/components/dialogs/PrivacyDialog.vue'
|
||||
import WebDAVConfigDialog from '@/components/settings/WebDAVConfigDialog.vue'
|
||||
import WebDAVFileListDialog from '@/components/settings/WebDAVFileListDialog.vue'
|
||||
import { useHints } from '@/composables/useHints'
|
||||
import {
|
||||
type WebDAVConfig,
|
||||
getWebDAVConfig,
|
||||
uploadToWebDAV,
|
||||
downloadFromWebDAV
|
||||
} from '@/services/webdavService'
|
||||
|
||||
const { t } = useI18n()
|
||||
const { hintsEnabled, setHintsEnabled, resetHints } = useHints()
|
||||
@@ -366,6 +412,12 @@
|
||||
|
||||
const isTypesExpanded = ref(false)
|
||||
|
||||
// WebDAV 相关状态
|
||||
const showWebDAVConfig = ref(false)
|
||||
const showWebDAVFiles = ref(false)
|
||||
const webdavConfig = ref<WebDAVConfig | null>(getWebDAVConfig())
|
||||
const isWebDAVUploading = ref(false)
|
||||
|
||||
// 确保通知设置存在
|
||||
if (!gameStore.notificationSettings) {
|
||||
gameStore.notificationSettings = {
|
||||
@@ -705,4 +757,98 @@
|
||||
const updateBackgroundSetting = (val: boolean) => {
|
||||
gameStore.player.backgroundEnabled = val
|
||||
}
|
||||
|
||||
// WebDAV 配置保存回调
|
||||
const onWebDAVConfigSaved = () => {
|
||||
webdavConfig.value = getWebDAVConfig()
|
||||
}
|
||||
|
||||
// WebDAV 上传
|
||||
const handleWebDAVUpload = async () => {
|
||||
if (!webdavConfig.value) return
|
||||
|
||||
isWebDAVUploading.value = true
|
||||
try {
|
||||
// 获取游戏数据
|
||||
const gameData = localStorage.getItem(pkg.name)
|
||||
const universeData = localStorage.getItem(`${pkg.name}-universe`)
|
||||
const npcData = localStorage.getItem(`${pkg.name}-npcs`)
|
||||
|
||||
if (!gameData) {
|
||||
toast.error(t('settings.exportFailed'))
|
||||
return
|
||||
}
|
||||
|
||||
// 合并数据
|
||||
const exportData = {
|
||||
game: gameData,
|
||||
npcs: npcData,
|
||||
universe: universeData || null
|
||||
}
|
||||
|
||||
const jsonString = JSON.stringify(exportData, null, 2)
|
||||
const result = await uploadToWebDAV(webdavConfig.value, jsonString)
|
||||
|
||||
if (result.success) {
|
||||
toast.success(t('settings.webdav.uploadSuccess'))
|
||||
} else {
|
||||
toast.error(result.message || t('settings.webdav.uploadFailed'))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('WebDAV upload failed:', error)
|
||||
toast.error(t('settings.webdav.uploadFailed'))
|
||||
} finally {
|
||||
isWebDAVUploading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// WebDAV 下载
|
||||
const handleWebDAVDownload = async (fileName: string) => {
|
||||
if (!webdavConfig.value) return
|
||||
|
||||
try {
|
||||
const result = await downloadFromWebDAV(webdavConfig.value, fileName)
|
||||
|
||||
if (!result.success || !result.data) {
|
||||
toast.error(result.message || t('settings.webdav.downloadFailed'))
|
||||
return
|
||||
}
|
||||
|
||||
// 确认导入
|
||||
confirmTitle.value = t('settings.importConfirmTitle')
|
||||
confirmMessage.value = t('settings.importConfirmMessage')
|
||||
showConfirmDialog.value = true
|
||||
gameStore.isPaused = true
|
||||
|
||||
confirmCallback = () => {
|
||||
try {
|
||||
const importData = JSON.parse(result.data!)
|
||||
|
||||
// 兼容旧版本格式
|
||||
if (typeof importData === 'string' || !importData.game) {
|
||||
localStorage.setItem(pkg.name, result.data!)
|
||||
} else {
|
||||
if (importData.game) {
|
||||
localStorage.setItem(pkg.name, importData.game)
|
||||
}
|
||||
if (importData.universe) {
|
||||
localStorage.setItem(`${pkg.name}-universe`, importData.universe)
|
||||
}
|
||||
if (importData.npcs) {
|
||||
localStorage.setItem(`${pkg.name}-npcs`, importData.npcs)
|
||||
}
|
||||
}
|
||||
|
||||
toast.success(t('settings.importSuccess'))
|
||||
setTimeout(() => window.location.reload(), 1000)
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error)
|
||||
toast.error(t('settings.importFailed') + ': ' + message)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('WebDAV download failed:', error)
|
||||
toast.error(t('settings.webdav.downloadFailed'))
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user