From b82533233ebfc1b388fcb99ada0c2f1465350383 Mon Sep 17 00:00:00 2001 From: Zhengchen Tao Date: Mon, 6 Apr 2026 14:06:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=86=E7=B1=BB=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=8A=9F=E8=83=BD=EF=BC=9A=E6=96=B0=E5=A2=9E=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=B1=95=E5=BC=80=E5=88=86=E7=B1=BB=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8C=E6=9B=B4=E6=96=B0=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E4=BB=A5=E6=94=AF=E6=8C=81=E6=AD=A4=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MY_REQUIREMENTS.md | 30 ++++++++++--------- .../mobile/TreeViewSelectionSheet.vue | 3 +- src/core/setting.ts | 2 ++ src/locales/en.json | 1 + src/locales/zh_Hans.json | 1 + src/locales/zh_Hant.json | 1 + src/stores/setting.ts | 6 ++++ src/views/mobile/SettingsPage.vue | 17 ++++++++++- src/views/mobile/transactions/EditPage.vue | 3 ++ 9 files changed, 48 insertions(+), 16 deletions(-) diff --git a/MY_REQUIREMENTS.md b/MY_REQUIREMENTS.md index 812f582a..4ce03425 100644 --- a/MY_REQUIREMENTS.md +++ b/MY_REQUIREMENTS.md @@ -7,16 +7,15 @@ ## 一、UI / 主题 -### 1. ⚠️ 自选主题色 +### 1. ❌ 自选主题色(已实现后 revert) **描述:** 在设置页面增加主题色选择器,用户可自由选择应用主色调。 -**现状:** 主题色当前硬编码为 `#c67e48`,仅支持亮色/暗色切换。 +**现状:** 实现后效果不佳,已全部 revert。主题色仍为硬编码 `#c67e48`。 -**实现思路:** -- 在设置页新增颜色选择器组件 -- 将所选颜色保存至 `localStorage` -- 启动时读取颜色并注入 CSS 变量(Framework7 支持动态 primary color) -- 涉及文件:`src/MobileApp.vue`、`src/lib/settings.ts`、设置页面 +**实现思路(留存备查):** +- 存 localStorage + 云同步,启动时注入 `--ebk-theme-color` CSS 变量 +- 移动端 f7params / 桌面端 Vuetify theme 从设置读取 +- 预设颜色复用账户 14 色调板 --- @@ -126,12 +125,15 @@ ## 七、分类选择 -### 10. ❓ 分类选择默认全部展开(待定) -**描述:** 在记账页选择分类时,默认展开所有一级分类。 +### 10. 🟢 分类选择默认全部展开(仅移动端) +**描述:** 在移动端记账页选择分类时,默认展开所有一级分类。PC 端使用不同的分类选择组件,无需此设置。 -**实现思路:** -- 修改 `TreeViewSelectionSheet.vue` 中展开状态的初始值 -- 涉及文件:`src/components/mobile/TreeViewSelectionSheet.vue` +**已完成:** +- 设置存 localStorage(字段 `expandCategoryTreeByDefault`,默认 `false`),即时生效无需 reload +- `TreeViewSelectionSheet` 新增可选 prop `defaultExpanded`,`:opened` 改为 `props.defaultExpanded || isPrimaryItemHasSecondaryValue(item)` +- 移动端 EditPage 三个分类 sheet(支出/收入/转账)均传入 `:default-expanded` +- 设置仅在移动端设置页显示,PC 端无对应入口 +- 涉及文件:`src/components/mobile/TreeViewSelectionSheet.vue`、`src/views/mobile/transactions/EditPage.vue`、`src/views/mobile/SettingsPage.vue` --- @@ -170,7 +172,7 @@ | # | 需求 | 状态 | |---|------|------| -| 1 | 自选主题色 | ⚠️ 待做 | +| 1 | 自选主题色 | ❌ 已 revert | | 2 | 信用卡额度 | 🟢 已完成 | | 3 | 账户信息卡片 | 🟢 已完成 | | 4 | 调整余额入口 | 🟢 已完成 | @@ -179,7 +181,7 @@ | 7 | 小键盘布局 | 🟢 已完成 | | 8 | 详情编辑/删除 | 🟢 已完成 | | 9 | 点击时间默认日期选择器 | 🟢 已完成 | -| 10 | 分类默认展开 | ❓ 待定 | +| 10 | 分类默认展开 | 🟢 已完成 | | 11 | 全局动画加速 | 🟢 已完成 | | 12 | 点击卡顿优化 | 🔍 暂调查 | | 13 | 离线缓存 | ❌ 暂缓 | diff --git a/src/components/mobile/TreeViewSelectionSheet.vue b/src/components/mobile/TreeViewSelectionSheet.vue index fb054c87..a3a75973 100644 --- a/src/components/mobile/TreeViewSelectionSheet.vue +++ b/src/components/mobile/TreeViewSelectionSheet.vue @@ -21,7 +21,7 @@ @@ -59,6 +59,7 @@ import { type Framework7Dom, scrollSheetToTop } from '@/lib/ui/mobile.ts'; interface MobileTwoLevelItemSelectionBaseProps extends TwoLevelItemSelectionBaseProps { show: boolean; + defaultExpanded?: boolean; } const props = defineProps(); diff --git a/src/core/setting.ts b/src/core/setting.ts index 03645dbe..79ca031c 100644 --- a/src/core/setting.ts +++ b/src/core/setting.ts @@ -36,6 +36,7 @@ export interface ApplicationSettings extends BaseApplicationSetting { showAccountBalance: boolean; swipeBack: boolean; animate: boolean; + expandCategoryTreeByDefault: boolean; // Application Lock applicationLock: boolean; applicationLockWebAuthn: boolean; @@ -174,6 +175,7 @@ export const DEFAULT_APPLICATION_SETTINGS: ApplicationSettings = { showAccountBalance: true, swipeBack: true, animate: true, + expandCategoryTreeByDefault: false, // Application Lock applicationLock: false, applicationLockWebAuthn: false, diff --git a/src/locales/en.json b/src/locales/en.json index 71398223..88fad91c 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -2282,6 +2282,7 @@ "Exchange Rate": "Exchange Rate", "Enable Swipe Back": "Enable Swipe Back", "Enable Animation": "Enable Animation", + "Expand Category List By Default": "Expand Category List By Default", "Basic Information": "Basic Information", "User Information": "User Information", "Already have an account?": "Already have an account?", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index 8da91b57..00f96b1d 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -2282,6 +2282,7 @@ "Exchange Rate": "汇率", "Enable Swipe Back": "启用侧滑返回", "Enable Animation": "启用动画", + "Expand Category List By Default": "默认展开分类列表", "Basic Information": "基本信息", "User Information": "用户信息", "Already have an account?": "已经有账号?", diff --git a/src/locales/zh_Hant.json b/src/locales/zh_Hant.json index cd1665a0..93c37502 100644 --- a/src/locales/zh_Hant.json +++ b/src/locales/zh_Hant.json @@ -2282,6 +2282,7 @@ "Exchange Rate": "匯率", "Enable Swipe Back": "啟用滑動返回", "Enable Animation": "啟用動畫", + "Expand Category List By Default": "預設展開分類列表", "Basic Information": "基本資訊", "User Information": "使用者資訊", "Already have an account?": "已經有帳號?", diff --git a/src/stores/setting.ts b/src/stores/setting.ts index f4243ea0..d057b0b5 100644 --- a/src/stores/setting.ts +++ b/src/stores/setting.ts @@ -171,6 +171,11 @@ export const useSettingsStore = defineStore('settings', () => { appSettings.value.animate = value; } + function setExpandCategoryTreeByDefault(value: boolean): void { + updateApplicationSettingsValue('expandCategoryTreeByDefault', value); + appSettings.value.expandCategoryTreeByDefault = value; + } + // Application Lock function setEnableApplicationLock(value: boolean): void { updateApplicationSettingsValue('applicationLock', value); @@ -528,6 +533,7 @@ export const useSettingsStore = defineStore('settings', () => { setShowAccountBalance, setEnableSwipeBack, setEnableAnimate, + setExpandCategoryTreeByDefault, // -- Application Lock setEnableApplicationLock, setEnableApplicationLockWebAuthn, diff --git a/src/views/mobile/SettingsPage.vue b/src/views/mobile/SettingsPage.vue index 9918e8e9..efab8469 100644 --- a/src/views/mobile/SettingsPage.vue +++ b/src/views/mobile/SettingsPage.vue @@ -108,6 +108,15 @@ + + + + + @@ -153,7 +162,6 @@ const version = `${getClientDisplayVersion()}`; const logouting = ref(false); const showThemePopup = ref(false); const showTimezonePopup = ref(false); - const currentNickName = computed(() => userStore.currentUserNickname || tt('User')); const currentTheme = computed({ @@ -176,6 +184,13 @@ const currentTimezoneName = computed(() => { return ''; }); +const expandCategoryTreeByDefault = computed({ + get: () => settingsStore.appSettings.expandCategoryTreeByDefault, + set: value => { + settingsStore.setExpandCategoryTreeByDefault(value); + } +}); + const isEnableSwipeBack = computed({ get: () => settingsStore.appSettings.swipeBack, set: value => { diff --git a/src/views/mobile/transactions/EditPage.vue b/src/views/mobile/transactions/EditPage.vue index b4b8a920..c1496798 100644 --- a/src/views/mobile/transactions/EditPage.vue +++ b/src/views/mobile/transactions/EditPage.vue @@ -119,6 +119,7 @@ secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-hidden-field="hidden" :enable-filter="true" :filter-placeholder="tt('Find category')" :filter-no-items-text="tt('No available category')" + :default-expanded="settingsStore.appSettings.expandCategoryTreeByDefault" :items="allCategories[CategoryType.Expense]" v-model:show="showCategorySheet" v-model="transaction.expenseCategoryId"> @@ -151,6 +152,7 @@ secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-hidden-field="hidden" :enable-filter="true" :filter-placeholder="tt('Find category')" :filter-no-items-text="tt('No available category')" + :default-expanded="settingsStore.appSettings.expandCategoryTreeByDefault" :items="allCategories[CategoryType.Income]" v-model:show="showCategorySheet" v-model="transaction.incomeCategoryId"> @@ -183,6 +185,7 @@ secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color" secondary-hidden-field="hidden" :enable-filter="true" :filter-placeholder="tt('Find category')" :filter-no-items-text="tt('No available category')" + :default-expanded="settingsStore.appSettings.expandCategoryTreeByDefault" :items="allCategories[CategoryType.Transfer]" v-model:show="showCategorySheet" v-model="transaction.transferCategoryId">