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