From 72728cf7acd614025446c719090d38c7971906bf Mon Sep 17 00:00:00 2001 From: Yuhang Wu Date: Fri, 21 Aug 2026 11:55:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=98=85=E8=AF=BB?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2=E4=B8=8E=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E9=98=85=E8=AF=BB=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增阅读设置页面,支持调整字体大小、颜色、背景色和窗口大小 2. 新增全局设置store,持久化保存外观和阅读配置 3. 为窗口添加阴影和尺寸设置的权限与功能 4. 重构外观设置页面样式,统一配置项布局 5. 适配阅读页面样式,使用配置动态控制阅读样式 --- src-tauri/capabilities/default.json | 2 + src/assets/global.css | 3 + src/router/index.ts | 9 ++ src/stores/setting.ts | 20 +++ src/types/components.d.ts | 3 + src/views/Home.vue | 7 +- src/views/Reader.vue | 45 +++++-- src/views/Setting.vue | 1 + src/views/setting/Appearance.vue | 136 +++++++------------- src/views/setting/ReaderSetting.vue | 191 ++++++++++++++++++++++++++++ 10 files changed, 310 insertions(+), 107 deletions(-) create mode 100644 src/stores/setting.ts create mode 100644 src/views/setting/ReaderSetting.vue diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 40fdd66..18a9c9d 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -9,6 +9,8 @@ "core:window:allow-start-dragging", "core:window:allow-close", "core:window:allow-minimize", + "core:window:allow-set-shadow", + "core:window:allow-set-size", "opener:default", "dialog:default", "dialog:allow-open" diff --git a/src/assets/global.css b/src/assets/global.css index d4a3624..d84c341 100644 --- a/src/assets/global.css +++ b/src/assets/global.css @@ -28,4 +28,7 @@ /* 尺寸 */ --titlebar-height: 38px; + + --set-item-title-size: 14px; + --set-item-desc-size: 12px; } \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 03a535f..65fb592 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -45,6 +45,15 @@ const routes = [ title: "外观设置", }, }, + { + path: "/setting/reader-setting", + name: "ReaderSetting", + component: () => import("@/views/setting/ReaderSetting.vue"), + meta: { + isCache: true, + title: "阅读设置", + }, + }, { path: "/setting/shortcut", name: "Shortcut", diff --git a/src/stores/setting.ts b/src/stores/setting.ts new file mode 100644 index 0000000..a3073f9 --- /dev/null +++ b/src/stores/setting.ts @@ -0,0 +1,20 @@ +import { defineStore } from "pinia" + +export const useSettingStore = defineStore("setting", { + state: () => ({ + appearance: { + theme: "light", + showShadow: false, + }, + reader: { + fontSize: 12, + showShadow: false, + fontColor: "#000000", + backgroundColor: "#ffffff", + windowWidth: 300, + windowHeight: 400, + } + }), + + persist: true, +}) diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 77d7ef0..588ee17 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -16,6 +16,7 @@ declare module 'vue' { NAnchor: typeof import('naive-ui')['NAnchor'] NAnchorLink: typeof import('naive-ui')['NAnchorLink'] NButton: typeof import('naive-ui')['NButton'] + NColorPicker: typeof import('naive-ui')['NColorPicker'] NConfigProvider: typeof import('naive-ui')['NConfigProvider'] NDescriptions: typeof import('naive-ui')['NDescriptions'] NDescriptionsItem: typeof import('naive-ui')['NDescriptionsItem'] @@ -29,6 +30,7 @@ declare module 'vue' { NGrid: typeof import('naive-ui')['NGrid'] NIcon: typeof import('naive-ui')['NIcon'] NInput: typeof import('naive-ui')['NInput'] + NInputNumber: typeof import('naive-ui')['NInputNumber'] NLayout: typeof import('naive-ui')['NLayout'] NLayoutContent: typeof import('naive-ui')['NLayoutContent'] NLayoutHeader: typeof import('naive-ui')['NLayoutHeader'] @@ -42,6 +44,7 @@ declare module 'vue' { NSpace: typeof import('naive-ui')['NSpace'] NSpin: typeof import('naive-ui')['NSpin'] NSwitch: typeof import('naive-ui')['NSwitch'] + NText: typeof import('naive-ui')['NText'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] } diff --git a/src/views/Home.vue b/src/views/Home.vue index 6b5117e..8e684d5 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -118,7 +118,7 @@ diff --git a/src/views/Reader.vue b/src/views/Reader.vue index 721f1bd..a78905a 100644 --- a/src/views/Reader.vue +++ b/src/views/Reader.vue @@ -1,5 +1,5 @@ diff --git a/src/views/setting/ReaderSetting.vue b/src/views/setting/ReaderSetting.vue new file mode 100644 index 0000000..b78b6c9 --- /dev/null +++ b/src/views/setting/ReaderSetting.vue @@ -0,0 +1,191 @@ + + + + +