From 852503ec0bc8572cc6d2e2c885d204e24a9e0103 Mon Sep 17 00:00:00 2001 From: KUN1007 Date: Sat, 9 Sep 2023 23:42:55 +0800 Subject: [PATCH] feat: multiple page width settings --- .vscode/settings.json | 1 + src/components/quill-editor/EditorFooter.vue | 4 +- .../setting-panel/KUNGalgameSettingPanel.vue | 46 ++-------- .../setting-panel/components/PageWidth.vue | 86 +++++++++++++++++++ src/components/top-bar/KUNGalgameTopBar.vue | 2 +- src/language/en.ts | 7 +- src/language/zh.ts | 7 +- src/router/modules/home.ts | 2 +- src/store/modules/settings.ts | 13 ++- src/views/Home/content/MainPageContent.vue | 8 +- src/views/bylaw/Bylaw.vue | 14 ++- src/views/edit/Edit.vue | 13 ++- src/views/kungalgame/KUNGalgame.vue | 14 ++- src/views/pool/Pool.vue | 14 ++- src/views/technique/Technique.vue | 14 ++- src/views/thanks-list/ThanksList.vue | 14 ++- src/views/topic/KUNGalgameTopicPage.vue | 42 +++++---- src/views/topic/content/components/Tags.vue | 2 +- 18 files changed, 227 insertions(+), 76 deletions(-) create mode 100644 src/components/setting-panel/components/PageWidth.vue diff --git a/.vscode/settings.json b/.vscode/settings.json index 4ba03f03..9e8cee6d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,6 +24,7 @@ "Licence", "loli", "majesticons", + "mingcute", "mockjs", "moemoe", "moemoepoint", diff --git a/src/components/quill-editor/EditorFooter.vue b/src/components/quill-editor/EditorFooter.vue index b0da3da4..c6c9812a 100644 --- a/src/components/quill-editor/EditorFooter.vue +++ b/src/components/quill-editor/EditorFooter.vue @@ -79,8 +79,9 @@ const handelClickSettings = () => {
  • {{ $tm('edit.help1') }}
  • {{ $tm('edit.help2') }}
  • {{ $tm('edit.help3') }}
  • +
  • {{ $tm('edit.help4') }}
  • - {{ $tm('edit.help4') }} + {{ $tm('edit.help5') }} {{ $tm('edit.contact') }} @@ -138,7 +139,6 @@ const handelClickSettings = () => { ul { display: flex; flex-direction: column; - border: 1px solid var(--kungalgame-blue-1); background-color: var(--kungalgame-white); padding: 5px; border-radius: 5px; diff --git a/src/components/setting-panel/KUNGalgameSettingPanel.vue b/src/components/setting-panel/KUNGalgameSettingPanel.vue index 7e963dd5..c0b507b4 100644 --- a/src/components/setting-panel/KUNGalgameSettingPanel.vue +++ b/src/components/setting-panel/KUNGalgameSettingPanel.vue @@ -8,15 +8,15 @@ import Loli from './components/Loli.vue' import Mode from './components/Mode.vue' // 导入语言切换组件 import SwitchLanguage from './components/SwitchLanguage.vue' +// 页面宽度调整组件 +import PageWidth from './components/PageWidth.vue' // 引入背景设置组件 import Background from './components/Background.vue' // 导入设置面板 store import { useKUNGalgameSettingsStore } from '@/store/modules/settings' -import { storeToRefs } from 'pinia' // 使用设置面板的 store const settingsStore = useKUNGalgameSettingsStore() -const { showKUNGalgameMainPageWidth } = storeToRefs(settingsStore) const emits = defineEmits(['close']) @@ -46,24 +46,11 @@ const handelCloseSettingsPanel = () => { -
    - -
    - {{ $tm('header.settings.width') }} - {{ showKUNGalgameMainPageWidth }}% -
    -
    - 50%90% -
    -
    + + + + +
    @@ -128,24 +115,6 @@ const handelCloseSettingsPanel = () => { } } -.page-width { - font-size: 15px; - display: flex; - span { - margin-top: 15px; - } -} -/* 主页页面宽度滑动条 */ -.main { - width: 100%; - height: 10px; - margin: 20px 0; -} - -.width-container { - display: flex; - justify-content: space-between; -} .reset { font-size: 15px; cursor: pointer; @@ -168,6 +137,7 @@ const handelCloseSettingsPanel = () => { margin: 20px; cursor: pointer; } + @media (max-width: 1000px) { .root { display: none; diff --git a/src/components/setting-panel/components/PageWidth.vue b/src/components/setting-panel/components/PageWidth.vue new file mode 100644 index 00000000..551d782b --- /dev/null +++ b/src/components/setting-panel/components/PageWidth.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/src/components/top-bar/KUNGalgameTopBar.vue b/src/components/top-bar/KUNGalgameTopBar.vue index e367da52..f50f057d 100644 --- a/src/components/top-bar/KUNGalgameTopBar.vue +++ b/src/components/top-bar/KUNGalgameTopBar.vue @@ -92,7 +92,7 @@ onBeforeRouteLeave(() => { enter-active-class="animate__animated animate__jackInTheBox animate__faster" leave-active-class="animate__animated animate__fadeOutRight animate__faster" > - + import('@/views/Home/KUNGalgameMainPage.vue'), meta: { diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index 870faed4..9ab59d7e 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -11,7 +11,7 @@ interface KUNGalgameSettings { // 网站显示语言 showKUNGalgameLanguage: string // 主页宽度 - showKUNGalgameMainPageWidth: string + showKUNGalgamePageWidth: Record // 背景图 showKUNGalgameBackground: string // 自定义背景图 @@ -25,7 +25,16 @@ export const useKUNGalgameSettingsStore = defineStore({ state: (): KUNGalgameSettings => ({ showKUNGalgameMode: mode, showKUNGalgameLanguage: KUNGalgameLanguage, - showKUNGalgameMainPageWidth: '61.8', + showKUNGalgamePageWidth: { + KUN: 61.8, + Topic: 90, + Edit: 90, + KUNGalgame: 90, + Pool: 90, + Bylaw: 90, + Technique: 90, + ThanksList: 90, + }, showKUNGalgameBackground: 'none', showKUNGalgameCustomBackground: '', }), diff --git a/src/views/Home/content/MainPageContent.vue b/src/views/Home/content/MainPageContent.vue index 661e45a4..f536accc 100644 --- a/src/views/Home/content/MainPageContent.vue +++ b/src/views/Home/content/MainPageContent.vue @@ -7,9 +7,9 @@ import { storeToRefs } from 'pinia' import { computed } from 'vue' // 使用设置面板的 store const settingsStore = useKUNGalgameSettingsStore() -const { showKUNGalgameMainPageWidth } = storeToRefs(settingsStore) -const width = computed(() => { - return showKUNGalgameMainPageWidth.value + '%' +const { showKUNGalgamePageWidth } = storeToRefs(settingsStore) +const mainPageWidth = computed(() => { + return showKUNGalgamePageWidth.value.KUN + '%' }) @@ -41,7 +41,7 @@ const width = computed(() => { } /* 可视内容部分宽度 */ .content-container { - width: v-bind(width); + width: v-bind(mainPageWidth); transition: all 0.2s; height: 100%; margin: 0 auto; diff --git a/src/views/bylaw/Bylaw.vue b/src/views/bylaw/Bylaw.vue index f815364c..f814639e 100644 --- a/src/views/bylaw/Bylaw.vue +++ b/src/views/bylaw/Bylaw.vue @@ -1,5 +1,16 @@