2023-05-27 10:52:54 +00:00
|
|
|
// 导入设置面板 store
|
2023-05-29 09:18:38 +00:00
|
|
|
import { useKUNGalgameSettingsStore } from '@/store/modules/settings'
|
2023-05-27 10:52:54 +00:00
|
|
|
import { storeToRefs } from 'pinia'
|
2023-05-30 14:06:30 +00:00
|
|
|
import { computed } from 'vue'
|
2023-05-27 10:52:54 +00:00
|
|
|
|
|
|
|
// 使用设置面板的 store
|
2023-05-29 09:18:38 +00:00
|
|
|
const settingsStore = useKUNGalgameSettingsStore()
|
2023-05-30 14:25:42 +00:00
|
|
|
const { showKUNGalgameBackground, showKUNGalgameCustomBackground } =
|
2023-05-30 14:06:30 +00:00
|
|
|
storeToRefs(settingsStore)
|
2023-05-27 10:52:54 +00:00
|
|
|
|
|
|
|
// 恢复空白背景
|
|
|
|
export const restoreBackground = () => {
|
|
|
|
showKUNGalgameBackground.value = '0'
|
|
|
|
}
|
|
|
|
|
|
|
|
export const currBackground = computed(() => {
|
2023-05-28 06:29:31 +00:00
|
|
|
if (
|
|
|
|
showKUNGalgameBackground.value === '0' ||
|
|
|
|
showKUNGalgameBackground.value === 'none'
|
|
|
|
) {
|
2023-05-27 10:52:54 +00:00
|
|
|
return 'none'
|
2023-05-30 14:06:30 +00:00
|
|
|
} else if (showKUNGalgameBackground.value === '1007') {
|
2023-06-02 13:53:58 +00:00
|
|
|
return `/url(${showKUNGalgameCustomBackground.value})`
|
2023-05-27 10:52:54 +00:00
|
|
|
} else {
|
2023-05-29 09:18:38 +00:00
|
|
|
// TODO: 替换为后端接口
|
2023-06-02 13:53:58 +00:00
|
|
|
return `url(/src/assets/images/bg/bg${showKUNGalgameBackground.value}.png)`
|
2023-05-27 10:52:54 +00:00
|
|
|
}
|
|
|
|
})
|