fix restore BUG, fix edit page alert BUG

This commit is contained in:
KUN1007 2023-06-18 00:03:03 +08:00
parent 733bd6dc1c
commit c4e8070b3d
5 changed files with 10 additions and 29 deletions

View file

@ -16,7 +16,7 @@
"moemoe",
"moemoepoint",
"non-moe",
"nprogress",
"persistedstate",
"Pinia",
"shinnku",

View file

@ -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()

View file

@ -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>

View file

@ -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'

View file

@ -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>