fix restore BUG, fix edit page alert BUG
This commit is contained in:
parent
733bd6dc1c
commit
c4e8070b3d
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -16,7 +16,7 @@
|
|||
"moemoe",
|
||||
"moemoepoint",
|
||||
"non-moe",
|
||||
"nprogress",
|
||||
|
||||
"persistedstate",
|
||||
"Pinia",
|
||||
"shinnku",
|
||||
|
|
|
@ -13,25 +13,13 @@ import Background from './components/Background.vue'
|
|||
// 导入设置面板 store
|
||||
import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
|
||||
import { storeToRefs } from 'pinia'
|
||||
// 导入 i18n
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
// 使用设置面板的 store
|
||||
const settingsStore = useKUNGalgameSettingsStore()
|
||||
const { showKUNGalgameMainPageWidth, showKUNGalgameLanguage } =
|
||||
storeToRefs(settingsStore)
|
||||
const { showKUNGalgameMainPageWidth } = storeToRefs(settingsStore)
|
||||
|
||||
const emits = defineEmits(['close'])
|
||||
|
||||
/*
|
||||
* 网站的语言设置
|
||||
*/
|
||||
const { locale } = useI18n({ useScope: 'global' })
|
||||
|
||||
const handleChangeLanguage = () => {
|
||||
locale.value = showKUNGalgameLanguage.value
|
||||
}
|
||||
|
||||
/* 恢复所有设置为默认 */
|
||||
const handleRecover = () => {
|
||||
settingsStore.restoreSettings()
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// 导入设置面板 store
|
||||
import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { watch } from 'vue'
|
||||
// 导入 i18n
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
|
@ -14,19 +15,15 @@ const { showKUNGalgameLanguage } = storeToRefs(settingsStore)
|
|||
*/
|
||||
const { locale } = useI18n({ useScope: 'global' })
|
||||
|
||||
const handleChangeLanguage = () => {
|
||||
watch(showKUNGalgameLanguage, () => {
|
||||
locale.value = showKUNGalgameLanguage.value
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="set-lang">
|
||||
<span>{{ $t('header.settings.language') }}</span>
|
||||
<select
|
||||
class="select"
|
||||
v-model="showKUNGalgameLanguage"
|
||||
@change="handleChangeLanguage"
|
||||
>
|
||||
<select class="select" v-model="showKUNGalgameLanguage">
|
||||
<option value="en">English</option>
|
||||
<option value="zh">中文</option>
|
||||
</select>
|
||||
|
|
|
@ -6,8 +6,6 @@ import { lang, mode } from '@/utils/getDefaultEnv'
|
|||
|
||||
// 设置面板配置
|
||||
interface KUNGalgameSettings {
|
||||
// 是否显示设置面板
|
||||
showKUNGalgamePanel: boolean
|
||||
// 白天黑夜模式切换
|
||||
showKUNGalgameMode: string
|
||||
// 网站显示语言
|
||||
|
@ -25,7 +23,6 @@ export const useKUNGalgameSettingsStore = defineStore({
|
|||
persist: true,
|
||||
// 默认值
|
||||
state: (): KUNGalgameSettings => ({
|
||||
showKUNGalgamePanel: false,
|
||||
showKUNGalgameMode: mode,
|
||||
showKUNGalgameLanguage: lang,
|
||||
showKUNGalgameMainPageWidth: '61.8',
|
||||
|
@ -35,7 +32,6 @@ export const useKUNGalgameSettingsStore = defineStore({
|
|||
actions: {
|
||||
// 恢复出厂设置()
|
||||
restoreSettings() {
|
||||
this.showKUNGalgamePanel = false
|
||||
this.setKUNGalgameTheme('light')
|
||||
this.showKUNGalgameLanguage = 'en'
|
||||
this.showKUNGalgameMainPageWidth = '61.8'
|
||||
|
|
|
@ -10,20 +10,20 @@ import { ref } from 'vue'
|
|||
const buttonStatus = ref(false)
|
||||
|
||||
const handlePublish = async () => {
|
||||
const res = await info.alert('AlertInfo.publish', true)
|
||||
const res = await info.alert('AlertInfo.edit.publish', true)
|
||||
// TODO:
|
||||
// 这里实现用户的点击确认取消逻辑
|
||||
if (res) {
|
||||
info.info('AlertInfo.publishSuccess')
|
||||
info.info('AlertInfo.edit.publishSuccess')
|
||||
} else {
|
||||
info.info('AlertInfo.publishCancel')
|
||||
info.info('AlertInfo.edit.publishCancel')
|
||||
}
|
||||
}
|
||||
|
||||
const handleSave = () => {
|
||||
// TODO:
|
||||
// 这里实现用户的保存逻辑
|
||||
info.info('AlertInfo.draft')
|
||||
info.info('AlertInfo.edit.draft')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue