2023-05-14 16:30:24 +00:00
|
|
|
|
<!-- 设置面板组件,展示整个论坛的设置面板 -->
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<script setup lang="ts">
|
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-16 19:22:28 +00:00
|
|
|
|
// 导入看板娘 hook
|
|
|
|
|
import { useFixedLoli } from '@/hooks/useFixedLoli'
|
2023-05-19 18:23:25 +00:00
|
|
|
|
// 导入语言 hook
|
|
|
|
|
import { useLang } from '@/hooks/useLang'
|
|
|
|
|
// 引入 i18n
|
|
|
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
|
import { ref } from 'vue'
|
2023-05-14 07:16:28 +00:00
|
|
|
|
|
2023-05-19 18:23:25 +00:00
|
|
|
|
// 全局切换语言
|
|
|
|
|
const { kungalgameLang, setLang, initLang } = useLang()
|
|
|
|
|
const { t, locale } = useI18n({ useScope: 'global' })
|
|
|
|
|
|
|
|
|
|
// 初始化语言
|
|
|
|
|
initLang()
|
|
|
|
|
|
|
|
|
|
// 用户切换网站语言
|
|
|
|
|
const changeLang = () => {
|
|
|
|
|
if (kungalgameLang.value === 'en') {
|
|
|
|
|
setLang('en')
|
|
|
|
|
locale.value = 'en'
|
|
|
|
|
kungalgameLang.value = 'zh'
|
|
|
|
|
} else {
|
|
|
|
|
setLang('zh')
|
|
|
|
|
locale.value = 'zh'
|
|
|
|
|
kungalgameLang.value = 'en'
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-05-16 19:22:28 +00:00
|
|
|
|
|
|
|
|
|
// 使用全局固定看板娘的 hook
|
2023-05-17 15:56:47 +00:00
|
|
|
|
const { kungalgameLoliStatus, setLoli, initLoli, setLoliX, setLoliY } =
|
|
|
|
|
useFixedLoli()
|
2023-05-16 19:22:28 +00:00
|
|
|
|
|
|
|
|
|
// 初始化看板娘
|
|
|
|
|
initLoli()
|
|
|
|
|
|
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-14 16:30:24 +00:00
|
|
|
|
|
2023-05-17 15:56:47 +00:00
|
|
|
|
// 点击按钮的选中状态
|
2023-05-16 19:22:28 +00:00
|
|
|
|
let checked = kungalgameLoliStatus.value === 'true'
|
|
|
|
|
|
2023-05-14 16:30:24 +00:00
|
|
|
|
// 用户点击固定看板娘
|
2023-05-14 18:14:02 +00:00
|
|
|
|
const handleClick = () => {
|
2023-05-17 05:41:58 +00:00
|
|
|
|
if (!checked) {
|
|
|
|
|
setLoli('true')
|
2023-05-16 19:22:28 +00:00
|
|
|
|
} else {
|
2023-05-17 05:41:58 +00:00
|
|
|
|
setLoli('false')
|
2023-05-17 15:56:47 +00:00
|
|
|
|
setLoliX('120')
|
|
|
|
|
setLoliY('-250')
|
2023-05-16 19:22:28 +00:00
|
|
|
|
}
|
2023-05-14 18:14:02 +00:00
|
|
|
|
}
|
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="change-lang"
|
|
|
|
|
icon="mdi:spoken-language"
|
|
|
|
|
@click="changeLang"
|
|
|
|
|
/></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>
|
|
|
|
|
<div>
|
2023-05-14 16:30:24 +00:00
|
|
|
|
<!-- 设置主页的宽度 -->
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<span>主页页面宽度设置</span>
|
|
|
|
|
<div class="page-width">
|
|
|
|
|
<span>61.8%</span><input class="main" type="range" value="0" /><span
|
|
|
|
|
>90%</span
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 背景设置组件 -->
|
|
|
|
|
<Background />
|
2023-05-14 16:30:24 +00:00
|
|
|
|
<div class="fix-loli">
|
2023-05-14 18:14:02 +00:00
|
|
|
|
<!-- 处理固定看板娘按钮点击事件,点击切换是否固定看板娘 -->
|
2023-05-16 19:22:28 +00:00
|
|
|
|
<span>是否固定看板娘</span>
|
|
|
|
|
<input
|
|
|
|
|
class="switch-input"
|
|
|
|
|
type="checkbox"
|
|
|
|
|
id="switch"
|
|
|
|
|
v-model="checked"
|
|
|
|
|
/><label class="switch-label" @click="handleClick" for="switch"></label>
|
2023-05-14 16:30:24 +00:00
|
|
|
|
</div>
|
2023-05-13 06:05:05 +00:00
|
|
|
|
<div><button class="reset">恢复所有设置为默认</button></div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 看板娘组件 -->
|
2023-05-14 18:14:02 +00:00
|
|
|
|
<!-- 此处使用 Teleport,如果固定看板娘,则将看板娘传送到根组件,传送的状态使用全局 store 中的 showFixedLoli -->
|
2023-05-16 19:22:28 +00:00
|
|
|
|
<Teleport to="body" :disabled="kungalgameLoliStatus === 'false'">
|
2023-05-17 15:56:47 +00:00
|
|
|
|
<!-- 绑定看板娘组件的样式(位置),给其传递信息获取它现在的位置,给它传递状态(是否允许拖动) -->
|
|
|
|
|
<Loli class="loli" />
|
2023-05-14 16:30:24 +00:00
|
|
|
|
</Teleport>
|
2023-05-13 10:56:56 +00:00
|
|
|
|
<!-- 关闭面板 -->
|
2023-05-17 15:56:47 +00:00
|
|
|
|
<div class="close" v-if="kungalgameLoliStatus === 'false'">
|
|
|
|
|
<Icon @click="handleClose" icon="line-md:close" />
|
|
|
|
|
</div>
|
2023-05-13 06:05:05 +00:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
/* 根容器 */
|
|
|
|
|
.root {
|
|
|
|
|
top: 65px;
|
|
|
|
|
right: 0;
|
2023-05-14 17:47:25 +00:00
|
|
|
|
position: absolute;
|
2023-05-13 06:05:05 +00:00
|
|
|
|
background-color: @kungalgame-trans-white-5;
|
|
|
|
|
backdrop-filter: blur(5px);
|
2023-05-17 15:56:47 +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;
|
|
|
|
|
&:nth-child(2) {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
}
|
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) {
|
|
|
|
|
color: @kungalgame-red-4;
|
|
|
|
|
}
|
|
|
|
|
li:nth-child(2) {
|
|
|
|
|
color: @kungalgame-blue-4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.page-width {
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
display: flex;
|
|
|
|
|
span {
|
|
|
|
|
margin-top: 15px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* 主页页面宽度滑动条 */
|
|
|
|
|
.main {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 10px;
|
|
|
|
|
margin: 20px 0;
|
|
|
|
|
}
|
|
|
|
|
/* 固定看板娘 */
|
|
|
|
|
.fix-loli {
|
|
|
|
|
margin-top: 50px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
2023-05-16 19:22:28 +00:00
|
|
|
|
.switch-input {
|
|
|
|
|
height: 0;
|
|
|
|
|
width: 0;
|
|
|
|
|
visibility: hidden;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.switch-label {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
text-indent: -9999px;
|
|
|
|
|
width: 50px;
|
|
|
|
|
height: 27px;
|
|
|
|
|
background: @kungalgame-trans-blue-2;
|
|
|
|
|
display: block;
|
|
|
|
|
border-radius: 100px;
|
|
|
|
|
position: relative;
|
|
|
|
|
&:after {
|
|
|
|
|
content: '';
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 2px;
|
|
|
|
|
left: 2px;
|
|
|
|
|
width: 23px;
|
|
|
|
|
height: 23px;
|
|
|
|
|
background: @kungalgame-white;
|
|
|
|
|
border-radius: 15px;
|
|
|
|
|
transition: 0.3s;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.switch-input:checked + .switch-label {
|
|
|
|
|
background: @kungalgame-blue-4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.switch-input:checked + .switch-label:after {
|
|
|
|
|
left: calc(100% - 2px);
|
|
|
|
|
transform: translateX(-100%);
|
|
|
|
|
}
|
2023-05-13 06:05:05 +00:00
|
|
|
|
.reset {
|
|
|
|
|
font-size: 15px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
border: 1px solid @kungalgame-red-4;
|
|
|
|
|
background-color: @kungalgame-trans-red-1;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 30px;
|
|
|
|
|
&:hover {
|
|
|
|
|
background-color: @kungalgame-red-3;
|
|
|
|
|
color: @kungalgame-white;
|
|
|
|
|
}
|
|
|
|
|
}
|
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>
|