2023-05-14 16:30:24 +00:00
|
|
|
|
<!-- 设置面板组件,展示整个论坛的设置面板 -->
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<script setup lang="ts">
|
2023-05-20 16:16:15 +00:00
|
|
|
|
// 引入 vue 函数
|
|
|
|
|
import { ref, watch, onMounted } from 'vue'
|
2023-05-14 16:30:24 +00:00
|
|
|
|
// 引入图标字体
|
2023-05-13 06:05:05 +00:00
|
|
|
|
import { Icon } from '@iconify/vue'
|
2023-05-14 16:30:24 +00:00
|
|
|
|
// 引入看板娘组件
|
2023-05-13 06:05:05 +00:00
|
|
|
|
import Loli from './components/Loli.vue'
|
2023-05-14 16:30:24 +00:00
|
|
|
|
// 引入背景设置组件
|
2023-05-13 06:05:05 +00:00
|
|
|
|
import Background from './components/Background.vue'
|
2023-05-14 07:16:28 +00:00
|
|
|
|
// 导入设置面板 store
|
|
|
|
|
import { useSettingsPanelStore } from '@/store/modules/settings'
|
|
|
|
|
import { storeToRefs } from 'pinia'
|
2023-05-20 16:16:15 +00:00
|
|
|
|
// 导入 i18n
|
2023-05-19 18:23:25 +00:00
|
|
|
|
import { useI18n } from 'vue-i18n'
|
2023-05-14 07:16:28 +00:00
|
|
|
|
|
2023-05-22 15:42:21 +00:00
|
|
|
|
/*
|
|
|
|
|
* 网站的语言设置
|
|
|
|
|
*/
|
|
|
|
|
const { locale } = useI18n({ useScope: 'global' })
|
2023-05-20 16:16:15 +00:00
|
|
|
|
const selectedLocale = ref(locale.value)
|
2023-05-19 18:23:25 +00:00
|
|
|
|
|
2023-05-20 16:16:15 +00:00
|
|
|
|
// 监听selectedLocale的变化,并更新Vue I18n的locale
|
|
|
|
|
watch(selectedLocale, (newVal) => {
|
|
|
|
|
locale.value = newVal
|
|
|
|
|
})
|
2023-05-19 18:23:25 +00:00
|
|
|
|
|
2023-05-20 16:16:15 +00:00
|
|
|
|
// 在页面加载时从localStorage中读取保存的语言设置
|
|
|
|
|
onMounted(() => {
|
2023-05-22 15:42:21 +00:00
|
|
|
|
const savedLocale = localStorage.getItem('KUNGalgame-locale')
|
2023-05-20 16:16:15 +00:00
|
|
|
|
if (savedLocale) {
|
|
|
|
|
selectedLocale.value = savedLocale
|
2023-05-19 18:23:25 +00:00
|
|
|
|
}
|
2023-05-20 16:16:15 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
// 监听语言变化,并将语言设置保存到localStorage
|
|
|
|
|
watch(locale, (newVal) => {
|
2023-05-22 15:42:21 +00:00
|
|
|
|
localStorage.setItem('KUNGalgame-locale', newVal)
|
2023-05-20 16:16:15 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const changeLanguage = () => {
|
|
|
|
|
locale.value = selectedLocale.value
|
2023-05-19 18:23:25 +00:00
|
|
|
|
}
|
2023-05-16 19:22:28 +00:00
|
|
|
|
|
2023-05-22 15:42:21 +00:00
|
|
|
|
/*
|
|
|
|
|
* 设置面板显示切换
|
|
|
|
|
*/
|
2023-05-19 18:23:25 +00:00
|
|
|
|
// 使用设置面板的 store
|
|
|
|
|
const settingsStore = useSettingsPanelStore()
|
|
|
|
|
const { showSettings } = storeToRefs(settingsStore)
|
|
|
|
|
|
|
|
|
|
// 展示设置面板
|
2023-05-14 07:16:28 +00:00
|
|
|
|
const handleClose = () => {
|
|
|
|
|
showSettings.value = false
|
|
|
|
|
}
|
2023-05-13 06:05:05 +00:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2023-05-14 16:30:24 +00:00
|
|
|
|
<!-- 根元素 -->
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<div class="root">
|
|
|
|
|
<div class="container">
|
|
|
|
|
<div class="title">
|
2023-05-19 18:23:25 +00:00
|
|
|
|
<span>设置面板</span>
|
|
|
|
|
<span><Icon class="settings-icon" icon="uiw:setting-o" /></span>
|
2023-05-13 06:05:05 +00:00
|
|
|
|
</div>
|
|
|
|
|
<div class="mode">
|
2023-05-14 16:30:24 +00:00
|
|
|
|
<!-- 白天 / 黑夜模式切换 -->
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<span>模式切换</span>
|
|
|
|
|
<div class="mode-container">
|
|
|
|
|
<li>
|
|
|
|
|
<Icon
|
|
|
|
|
class="sun"
|
|
|
|
|
icon="line-md:moon-filled-alt-to-sunny-filled-loop-transition"
|
|
|
|
|
/>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Icon
|
|
|
|
|
class="moon"
|
|
|
|
|
icon="line-md:sunny-outline-to-moon-loop-transition"
|
2023-05-14 17:47:25 +00:00
|
|
|
|
/>
|
2023-05-13 06:05:05 +00:00
|
|
|
|
</li>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-05-20 16:16:15 +00:00
|
|
|
|
<div class="set-lang">
|
|
|
|
|
<span>网站语言设置</span>
|
|
|
|
|
<select
|
|
|
|
|
class="select"
|
|
|
|
|
v-model="selectedLocale"
|
2023-05-25 13:43:42 +00:00
|
|
|
|
@change="changeLanguage"
|
2023-05-20 16:16:15 +00:00
|
|
|
|
>
|
|
|
|
|
<option value="en">English</option>
|
|
|
|
|
<option value="zh">中文</option>
|
|
|
|
|
</select>
|
2023-05-20 15:17:46 +00:00
|
|
|
|
</div>
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<div>
|
2023-05-14 16:30:24 +00:00
|
|
|
|
<!-- 设置主页的宽度 -->
|
2023-05-20 16:16:15 +00:00
|
|
|
|
<div class="width-container">
|
|
|
|
|
<span>主页页面宽度设置</span>
|
|
|
|
|
<span>61.8%</span>
|
|
|
|
|
</div>
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<div class="page-width">
|
|
|
|
|
<span>61.8%</span><input class="main" type="range" value="0" /><span
|
|
|
|
|
>90%</span
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 背景设置组件 -->
|
|
|
|
|
<Background />
|
2023-05-20 15:17:46 +00:00
|
|
|
|
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<div><button class="reset">恢复所有设置为默认</button></div>
|
|
|
|
|
</div>
|
2023-05-20 14:59:41 +00:00
|
|
|
|
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<!-- 看板娘组件 -->
|
2023-05-20 14:59:41 +00:00
|
|
|
|
<Loli class="loli" />
|
|
|
|
|
|
2023-05-13 10:56:56 +00:00
|
|
|
|
<!-- 关闭面板 -->
|
2023-05-20 14:59:41 +00:00
|
|
|
|
<div class="close">
|
2023-05-25 13:43:42 +00:00
|
|
|
|
<Icon @click="handleClose" icon="line-md:close" />
|
2023-05-17 15:56:47 +00:00
|
|
|
|
</div>
|
2023-05-13 06:05:05 +00:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2023-05-25 07:55:30 +00:00
|
|
|
|
<style lang="scss" scoped>
|
2023-05-13 06:05:05 +00:00
|
|
|
|
/* 根容器 */
|
|
|
|
|
.root {
|
|
|
|
|
top: 65px;
|
|
|
|
|
right: 0;
|
2023-05-14 17:47:25 +00:00
|
|
|
|
position: absolute;
|
2023-05-25 07:55:30 +00:00
|
|
|
|
background-color: $kungalgame-trans-white-5;
|
2023-05-13 06:05:05 +00:00
|
|
|
|
backdrop-filter: blur(5px);
|
2023-05-25 07:55:30 +00:00
|
|
|
|
box-shadow: $shadow;
|
2023-05-13 06:05:05 +00:00
|
|
|
|
border-radius: 10px;
|
|
|
|
|
z-index: 1007;
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
.container {
|
|
|
|
|
position: relative;
|
|
|
|
|
margin: 20px;
|
|
|
|
|
font-size: 17px;
|
|
|
|
|
}
|
|
|
|
|
.title {
|
|
|
|
|
font-size: 23px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
2023-05-19 18:23:25 +00:00
|
|
|
|
span {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2023-05-13 06:05:05 +00:00
|
|
|
|
}
|
2023-05-20 16:16:15 +00:00
|
|
|
|
// 使设置按钮保持旋转
|
2023-05-13 06:05:05 +00:00
|
|
|
|
.settings-icon {
|
|
|
|
|
animation: settings 3s linear infinite;
|
|
|
|
|
}
|
|
|
|
|
@keyframes settings {
|
|
|
|
|
0% {
|
|
|
|
|
transform: rotate(0deg);
|
|
|
|
|
}
|
|
|
|
|
100% {
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.mode {
|
|
|
|
|
margin: 20px 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
.mode-container {
|
|
|
|
|
font-size: 25px;
|
|
|
|
|
width: 60%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-around;
|
2023-05-14 07:16:28 +00:00
|
|
|
|
li {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
2023-05-13 06:05:05 +00:00
|
|
|
|
li:nth-child(1) {
|
2023-05-25 07:55:30 +00:00
|
|
|
|
color: $kungalgame-red-4;
|
2023-05-13 06:05:05 +00:00
|
|
|
|
}
|
|
|
|
|
li:nth-child(2) {
|
2023-05-25 07:55:30 +00:00
|
|
|
|
color: $kungalgame-blue-4;
|
2023-05-13 06:05:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-20 16:16:15 +00:00
|
|
|
|
// 语言设置
|
|
|
|
|
.set-lang {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
// 语言的选择框
|
|
|
|
|
.select {
|
|
|
|
|
width: 100px;
|
|
|
|
|
font-size: 16px;
|
2023-05-25 07:55:30 +00:00
|
|
|
|
border: 1px solid $kungalgame-blue-4;
|
|
|
|
|
background-color: $kungalgame-trans-white-9;
|
2023-05-20 16:16:15 +00:00
|
|
|
|
option {
|
2023-05-25 07:55:30 +00:00
|
|
|
|
background-color: $kungalgame-trans-white-9;
|
2023-05-20 16:16:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-13 06:05:05 +00:00
|
|
|
|
.page-width {
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
display: flex;
|
|
|
|
|
span {
|
|
|
|
|
margin-top: 15px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* 主页页面宽度滑动条 */
|
|
|
|
|
.main {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 10px;
|
|
|
|
|
margin: 20px 0;
|
|
|
|
|
}
|
|
|
|
|
/* 固定看板娘 */
|
2023-05-20 16:16:15 +00:00
|
|
|
|
.set-lang {
|
2023-05-20 15:17:46 +00:00
|
|
|
|
margin-bottom: 20px;
|
2023-05-20 16:16:15 +00:00
|
|
|
|
}
|
|
|
|
|
.width-container {
|
2023-05-13 06:05:05 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
.reset {
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
margin-top: 20px;
|
2023-05-25 07:55:30 +00:00
|
|
|
|
border: 1px solid $kungalgame-red-4;
|
|
|
|
|
background-color: $kungalgame-trans-red-1;
|
2023-05-13 06:05:05 +00:00
|
|
|
|
width: 100%;
|
|
|
|
|
height: 30px;
|
|
|
|
|
&:hover {
|
2023-05-25 07:55:30 +00:00
|
|
|
|
background-color: $kungalgame-red-3;
|
|
|
|
|
color: $kungalgame-white;
|
2023-05-13 06:05:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-13 10:56:56 +00:00
|
|
|
|
.close {
|
|
|
|
|
font-size: 25px;
|
2023-05-17 15:56:47 +00:00
|
|
|
|
width: 270px;
|
2023-05-13 10:56:56 +00:00
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: end;
|
|
|
|
|
margin: 20px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
@media (max-width: 700px) {
|
|
|
|
|
.loli {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
.root {
|
|
|
|
|
width: 300px;
|
|
|
|
|
transition: 0.3s;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@media (max-height: 600px) {
|
|
|
|
|
.root {
|
|
|
|
|
right: -600px;
|
|
|
|
|
transition: 0.5s;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-13 06:05:05 +00:00
|
|
|
|
</style>
|