diff --git a/src/components/KUNGalgameTopBar.vue b/src/components/KUNGalgameTopBar.vue
index ec81d9c8..b76b62b1 100644
--- a/src/components/KUNGalgameTopBar.vue
+++ b/src/components/KUNGalgameTopBar.vue
@@ -1,17 +1,10 @@
@@ -111,7 +104,8 @@ const handleClose = () => {
-
+
+
diff --git a/src/components/setting-panel/components/Background.vue b/src/components/setting-panel/components/Background.vue
index a73c7426..d828731b 100644
--- a/src/components/setting-panel/components/Background.vue
+++ b/src/components/setting-panel/components/Background.vue
@@ -11,7 +11,7 @@ import { restoreBackground } from '@/hooks/useBackgroundPicture'
// 使用设置面板的 store
const settingsStore = useKUNGalgameSettingsStore()
-const { showKUNGalgameBackground, showCustomBackground } =
+const { showKUNGalgameBackground, showKUNGalgameCustomBackground } =
storeToRefs(settingsStore)
// 更改背景图片
@@ -36,7 +36,7 @@ const handelChangeImage = (index: number) => {
const url = ref('')
const handleCustomBackground = () => {
if (url.value) {
- showCustomBackground.value = url.value
+ showKUNGalgameCustomBackground.value = url.value
showKUNGalgameBackground.value = '1007'
url.value = ''
} else {
diff --git a/src/hooks/useBackgroundPicture.ts b/src/hooks/useBackgroundPicture.ts
index 025774d6..0fa62210 100644
--- a/src/hooks/useBackgroundPicture.ts
+++ b/src/hooks/useBackgroundPicture.ts
@@ -5,7 +5,7 @@ import { computed } from 'vue'
// 使用设置面板的 store
const settingsStore = useKUNGalgameSettingsStore()
-const { showKUNGalgameBackground, showCustomBackground } =
+const { showKUNGalgameBackground, showKUNGalgameCustomBackground } =
storeToRefs(settingsStore)
// 恢复空白背景
@@ -20,11 +20,9 @@ export const currBackground = computed(() => {
) {
return 'none'
} else if (showKUNGalgameBackground.value === '1007') {
- return `url(${showCustomBackground.value})`
+ return `url(${showKUNGalgameCustomBackground.value})`
} else {
// TODO: 替换为后端接口
return `url(src/assets/images/bg/bg${showKUNGalgameBackground.value}.png)`
}
})
-
-console.log(currBackground.value)
diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts
index b52210d1..a495ae5c 100644
--- a/src/store/modules/settings.ts
+++ b/src/store/modules/settings.ts
@@ -12,17 +12,28 @@ interface KUNGalgameSettings {
// 背景图
showKUNGalgameBackground: string
// 自定义背景图
- showCustomBackground: string
+ showKUNGalgameCustomBackground: string
}
export const useKUNGalgameSettingsStore = defineStore({
id: 'KUNGalgame-settings',
persist: true,
+ // 默认值
state: (): KUNGalgameSettings => ({
showKUNGalgamePanel: false,
showKUNGalgameLanguage: 'en',
showKUNGalgameMainPageWidth: '61.8',
showKUNGalgameBackground: 'none',
- showCustomBackground: '',
+ showKUNGalgameCustomBackground: '',
}),
+ actions: {
+ // 恢复出厂设置()
+ restoreSettings() {
+ this.showKUNGalgamePanel = false
+ this.showKUNGalgameLanguage = 'en'
+ this.showKUNGalgameMainPageWidth = '61.8'
+ this.showKUNGalgameBackground = 'none'
+ this.showKUNGalgameCustomBackground = ''
+ },
+ },
})