更新 .gitignore,添加 .claude/ 目录;新增 MY_REQUIREMENTS.md 文件,记录个人需求清单;优化小键盘组件,调整布局并添加删除按钮;修改路由配置,禁用某些页面的动画效果;全局样式中调整过渡时长。

This commit is contained in:
2026-04-05 16:31:02 +08:00
parent 97fb73ad43
commit 285fef6eba
6 changed files with 261 additions and 14 deletions
+2
View File
@@ -161,3 +161,5 @@ package/
data/ data/
storage/ storage/
log/ log/
.claude/
+172
View File
@@ -0,0 +1,172 @@
# ezBookkeeping 个人需求清单
> 基于 fork 版本的定制开发需求,持续更新。
> 标注:✅ 易实现 | ⚠️ 中等难度 | ❌ 难/暂缓 | ❓ 待确认 | 🟢 已完成
---
## 一、UI / 主题
### 1. ⚠️ 自选主题色
**描述:** 在设置页面增加主题色选择器,用户可自由选择应用主色调。
**现状:** 主题色当前硬编码为 `#c67e48`,仅支持亮色/暗色切换。
**实现思路:**
- 在设置页新增颜色选择器组件
- 将所选颜色保存至 `localStorage`
- 启动时读取颜色并注入 CSS 变量(Framework7 支持动态 primary color
- 涉及文件:`MobileApp.vue``src/lib/settings.ts`、设置页面
---
## 二、账户功能
### 2. ⚠️ 信用卡账户:额度与剩余额度
**描述:** 为信用卡类型账户新增「信用额度」字段,在账户列表和详情中展示「已用额度」和「剩余额度」。
**实现思路:**
- 后端:账户数据库表新增 `credit_limit` 字段,修改 API
- 前端:账户编辑页增加额度输入,账户列表/详情显示剩余额度(= 额度 - 欠款)
- 涉及文件:后端 `pkg/models/account.go`、前端 `EditPage.vue``ListPage.vue`
### 8. ⚠️ 账户交易列表顶部显示账户信息
**描述:** 在按账户筛选的交易列表页面顶部,显示账户名称、余额(或信用卡欠款+额度)等信息卡片。
**实现思路:**
- 检测当前是否为单账户筛选状态
- 顶部插入账户信息卡片组件
- 若多账户筛选则显示多张卡片
- 涉及文件:`src/views/mobile/transactions/ListPage.vue`
### 9. ✅ 允许直接修改账户余额(自动插入调整记录)
**描述:** 在账户详情提供「调整余额」入口,输入目标余额后,自动计算差值并插入一条「余额调整」类型交易记录。
**现状:** 代码中已存在 `ModifyBalance` 交易类型,可能已有后端支持,仅需确认前端入口是否存在。
**实现思路:**
- 确认 `ModifyBalance` 交易类型的前端入口
- 若无,在账户详情页增加「调整余额」按钮,跳转至记账页并预填该类型
---
## 三、记账页面
### 3. ✅ 记账页显示当前账户余额 / 欠款+额度
**描述:** 在记账页面选择账户后,在账户名称旁或下方显示该账户的当前余额(普通账户)或欠款+额度(信用卡)。
**实现思路:**
- 纯前端改动,从 account store 读取余额信息
- 在账户选择区域旁增加余额展示
- 涉及文件:`src/views/mobile/transactions/EditPage.vue`
### 11. ✅ 记录上次选择的账户
**描述:** 新建交易时,默认选中上次使用的账户,而非每次重置为默认账户。
**实现思路:**
- 保存账户 ID 到 `localStorage`
- 打开记账页时读取并预选
- 涉及文件:`src/views/mobile/transactions/EditPage.vue``src/lib/settings.ts`
---
## 四、小键盘
### 6. 🟢 小键盘布局调整
**描述:** 调整数字键盘布局。
**已完成:**
```
[数值显示区 ] [ ⌫ ] ← ⌫ 在显示区右侧,左边有竖线与右列对齐
7 8 9 ×
4 5 6
1 2 3 +
C 0 . OK
```
- ⌫ 位于数值显示区右侧,宽度 20% 与运算符列对齐,单击退格,长按清除
- 左下角 C:单击清除全部
- . 在 OK 左侧
- × 保留
- 涉及文件:`src/components/mobile/NumberPadSheet.vue`
---
## 五、交易详情
### 7. 🟢 交易详情菜单增加「编辑」和「删除」
**描述:** 交易详情页三点菜单中增加编辑和删除操作。
**已完成:**
- 三点菜单展开后,第一项为「Edit」(跳转编辑页)
- 最后一项为红色「Delete」(确认后删除并返回)
- 从详情编辑返回后自动刷新数据
- 涉及文件:`src/views/mobile/transactions/EditPage.vue`
---
## 六、分类选择
### 10. ✅ 分类选择默认全部展开
**描述:** 在记账页面选择分类时,默认将所有一级分类展开显示子分类,或在设置中可配置哪些分类默认展开。
**实现思路:**
- 修改 `TreeViewSelectionSheet.vue` 中展开状态的初始值
- 可选:在设置中增加「分类默认展开」开关
- 涉及文件:`src/components/mobile/TreeViewSelectionSheet.vue`
---
## 七、性能与动画
### 12. 🟢 底部 Tab 切换无动画 + 全局动画加速
**描述:** 底部 5 个主 Tab 切换无动画,其余动画加速。
**已完成:**
- 5 个主 Tab(首页、交易列表、账户、统计、设置)路由加 `animate: false`
- 全局动画时长从 300ms 加快至 150ms(页面跳转、Sheet、ActionSheet、Popup、Dialog、Popover
- 涉及文件:`src/router/mobile.ts``src/styles/mobile/global.scss`
### 4. 🟢 点击响应卡顿优化
**描述:** 点击按钮有延迟感,点不上的问题。
**已完成:**
- `tapHoldDelay` 从默认 750ms 降至 500ms,减少长按判定等待
- 涉及文件:`src/MobileApp.vue`
**未完成(已放弃):**
- HomePage 预加载 tags 数据(用户已 revert
---
## 八、离线 / 缓存
### 5. ❌ 本地优先 / 离线数据缓存(暂缓)
**描述:** 交易数据缓存至本地,优先展示缓存数据,后台静默拉取最新数据并更新。
**现状:** Service Worker 已实现静态资源缓存(图片、字体、地图瓦片),但**交易业务数据**目前不做本地缓存。
**为何难:**
- 需引入 IndexedDB 存储交易/账户/分类数据
- 需处理本地与服务端的数据同步、冲突解决
- 属于架构级改动,工作量较大
**建议:** 先完成其他需求,此项作为后期规划。
---
## 进度总览
| # | 需求 | 状态 |
|---|------|------|
| 1 | 自选主题色 | ⚠️ 待做 |
| 2 | 信用卡额度 | ⚠️ 待做(需改后端) |
| 3 | 记账页显示余额 | ✅ 待做 |
| 4 | 点击卡顿优化 | 🟢 部分完成 |
| 5 | 离线缓存 | ❌ 暂缓 |
| 6 | 小键盘布局 | 🟢 已完成 |
| 7 | 详情编辑/删除 | 🟢 已完成 |
| 8 | 账户信息卡片 | ⚠️ 待做 |
| 9 | 调整余额入口 | ✅ 待做 |
| 10 | 分类默认展开 | ✅ 待做 |
| 11 | 记住上次账户 | ✅ 待做 |
| 12 | Tab 无动画 + 加速 | 🟢 已完成 |
+30 -10
View File
@@ -6,8 +6,11 @@
<div class="margin-top padding-horizontal" v-if="hint"> <div class="margin-top padding-horizontal" v-if="hint">
<span>{{ hint }}</span> <span>{{ hint }}</span>
</div> </div>
<div class="numpad-values" @click="onDisplayValueClick"> <div class="numpad-values">
<span id="numpad-value" class="numpad-value" :class="currentDisplayNumClass">{{ currentDisplay }}</span> <span id="numpad-value" class="numpad-value" :class="currentDisplayNumClass" @click="onDisplayValueClick">{{ currentDisplay }}</span>
<f7-button class="numpad-backspace-button" @click="backspace" @taphold="clear()">
<f7-icon class="icon-with-direction" f7="delete_left"></f7-icon>
</f7-button>
</div> </div>
<f7-popover class="numpad-paste-popover" target-el="#numpad-value" <f7-popover class="numpad-paste-popover" target-el="#numpad-value"
@@ -54,20 +57,18 @@
<f7-button class="numpad-button numpad-button-function no-right-border" @click="setSymbol('+')"> <f7-button class="numpad-button numpad-button-function no-right-border" @click="setSymbol('+')">
<span class="numpad-button-text numpad-button-text-normal">&plus;</span> <span class="numpad-button-text numpad-button-text-normal">&plus;</span>
</f7-button> </f7-button>
<f7-button class="numpad-button numpad-button-num" @click="clear()">
<span class="numpad-button-text numpad-button-text-normal">C</span>
</f7-button>
<f7-button class="numpad-button numpad-button-num" @click="inputNum(0)">
<span class="numpad-button-text numpad-button-text-normal">{{ digits[0] }}</span>
</f7-button>
<f7-button class="numpad-button numpad-button-num" v-if="supportDecimalSeparator" @click="inputDecimalSeparator()"> <f7-button class="numpad-button numpad-button-num" v-if="supportDecimalSeparator" @click="inputDecimalSeparator()">
<span class="numpad-button-text numpad-button-text-normal">{{ decimalSeparator }}</span> <span class="numpad-button-text numpad-button-text-normal">{{ decimalSeparator }}</span>
</f7-button> </f7-button>
<f7-button class="numpad-button numpad-button-num" v-if="!supportDecimalSeparator" @click="inputDoubleNum(0)"> <f7-button class="numpad-button numpad-button-num" v-if="!supportDecimalSeparator" @click="inputDoubleNum(0)">
<span class="numpad-button-text numpad-button-text-normal">{{ `${digits[0]}${digits[0]}` }}</span> <span class="numpad-button-text numpad-button-text-normal">{{ `${digits[0]}${digits[0]}` }}</span>
</f7-button> </f7-button>
<f7-button class="numpad-button numpad-button-num" @click="inputNum(0)">
<span class="numpad-button-text numpad-button-text-normal">{{ digits[0] }}</span>
</f7-button>
<f7-button class="numpad-button numpad-button-num" @click="backspace" @taphold="clear()">
<span class="numpad-button-text numpad-button-text-normal">
<f7-icon class="icon-with-direction" f7="delete_left"></f7-icon>
</span>
</f7-button>
<f7-button class="numpad-button numpad-button-confirm no-right-border no-bottom-border" fill @click="confirm()"> <f7-button class="numpad-button numpad-button-confirm no-right-border no-bottom-border" fill @click="confirm()">
<span :class="{ 'numpad-button-text': true, 'numpad-button-text-confirm': !currentSymbol }">{{ confirmText }}</span> <span :class="{ 'numpad-button-text': true, 'numpad-button-text-confirm': !currentSymbol }">{{ confirmText }}</span>
</f7-button> </f7-button>
@@ -467,12 +468,15 @@ watch(() => props.flipNegative, (newValue) => {
} }
.numpad-values { .numpad-values {
display: flex;
align-items: center;
border-bottom: 1px solid var(--f7-page-bg-color); border-bottom: 1px solid var(--f7-page-bg-color);
} }
.numpad-value { .numpad-value {
display: flex; display: flex;
position: relative; position: relative;
flex: 1;
padding-inline-start: 16px; padding-inline-start: 16px;
line-height: 1; line-height: 1;
height: var(--ebk-numpad-value-height); height: var(--ebk-numpad-value-height);
@@ -481,6 +485,22 @@ watch(() => props.flipNegative, (newValue) => {
user-select: none; user-select: none;
} }
.numpad-backspace-button {
display: flex;
align-items: center;
justify-content: center;
width: 20%;
height: var(--ebk-numpad-value-height);
font-size: 22px;
color: var(--f7-color-black);
flex-shrink: 0;
border-left: 1px solid var(--f7-page-bg-color);
}
.dark .numpad-backspace-button {
color: var(--f7-color-white);
}
.numpad-value-small { .numpad-value-small {
font-size: var(--ebk-numpad-value-small-font-size); font-size: var(--ebk-numpad-value-small-font-size);
} }
+8 -4
View File
@@ -159,7 +159,8 @@ const routes: Router.RouteParameters[] = [
{ {
path: '/transaction/list', path: '/transaction/list',
async: asyncResolve(TransactionListPage), async: asyncResolve(TransactionListPage),
beforeEnter: [checkLogin] beforeEnter: [checkLogin],
options: { animate: false }
}, },
{ {
path: '/transaction/filter/amount', path: '/transaction/filter/amount',
@@ -184,7 +185,8 @@ const routes: Router.RouteParameters[] = [
{ {
path: '/account/list', path: '/account/list',
async: asyncResolve(AccountListPage), async: asyncResolve(AccountListPage),
beforeEnter: [checkLogin] beforeEnter: [checkLogin],
options: { animate: false }
}, },
{ {
path: '/account/add', path: '/account/add',
@@ -209,7 +211,8 @@ const routes: Router.RouteParameters[] = [
{ {
path: '/statistic/transaction', path: '/statistic/transaction',
async: asyncResolve(StatisticsTransactionPage), async: asyncResolve(StatisticsTransactionPage),
beforeEnter: [checkLogin] beforeEnter: [checkLogin],
options: { animate: false }
}, },
{ {
path: '/statistic/settings', path: '/statistic/settings',
@@ -259,7 +262,8 @@ const routes: Router.RouteParameters[] = [
{ {
path: '/settings', path: '/settings',
async: asyncResolve(SettingsPage), async: asyncResolve(SettingsPage),
beforeEnter: [checkLogin] beforeEnter: [checkLogin],
options: { animate: false }
}, },
{ {
path: '/app_lock', path: '/app_lock',
+9
View File
@@ -3,6 +3,15 @@ html, body {
position: fixed; position: fixed;
} }
:root {
--f7-page-transition-duration: 150ms;
--f7-sheet-transition-duration: 150ms;
--f7-actions-transition-duration: 150ms;
--f7-popup-transition-duration: 150ms;
--f7-dialog-transition-duration: 150ms;
--f7-popover-transition-duration: 150ms;
}
body { body {
-ms-user-select: none; -ms-user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
@@ -459,10 +459,12 @@
<f7-actions-button @click="showTransactionPictures = true">{{ tt('Add Picture') }}</f7-actions-button> <f7-actions-button @click="showTransactionPictures = true">{{ tt('Add Picture') }}</f7-actions-button>
</f7-actions-group> </f7-actions-group>
<f7-actions-group v-if="pageTypeAndMode?.type === TransactionEditPageType.Transaction && mode === TransactionEditPageMode.View && transaction.type !== TransactionType.ModifyBalance"> <f7-actions-group v-if="pageTypeAndMode?.type === TransactionEditPageType.Transaction && mode === TransactionEditPageMode.View && transaction.type !== TransactionType.ModifyBalance">
<f7-actions-button @click="navigateToEdit()">{{ tt('Edit') }}</f7-actions-button>
<f7-actions-button @click="duplicate(false, false)">{{ tt('Duplicate') }}</f7-actions-button> <f7-actions-button @click="duplicate(false, false)">{{ tt('Duplicate') }}</f7-actions-button>
<f7-actions-button @click="duplicate(true, false)">{{ tt('Duplicate (With Time)') }}</f7-actions-button> <f7-actions-button @click="duplicate(true, false)">{{ tt('Duplicate (With Time)') }}</f7-actions-button>
<f7-actions-button @click="duplicate(false, true)" v-if="transaction.geoLocation">{{ tt('Duplicate (With Geographic Location)') }}</f7-actions-button> <f7-actions-button @click="duplicate(false, true)" v-if="transaction.geoLocation">{{ tt('Duplicate (With Geographic Location)') }}</f7-actions-button>
<f7-actions-button @click="duplicate(true, true)" v-if="transaction.geoLocation">{{ tt('Duplicate (With Time and Geographic Location)') }}</f7-actions-button> <f7-actions-button @click="duplicate(true, true)" v-if="transaction.geoLocation">{{ tt('Duplicate (With Time and Geographic Location)') }}</f7-actions-button>
<f7-actions-button color="red" @click="remove()">{{ tt('Delete') }}</f7-actions-button>
</f7-actions-group> </f7-actions-group>
<f7-actions-group> <f7-actions-group>
<f7-actions-button bold close>{{ tt('Cancel') }}</f7-actions-button> <f7-actions-button bold close>{{ tt('Cancel') }}</f7-actions-button>
@@ -640,6 +642,7 @@ const pictureInput = useTemplateRef<HTMLInputElement>('pictureInput');
const isSupportClipboard = !!navigator.clipboard; const isSupportClipboard = !!navigator.clipboard;
const loadingError = ref<unknown | null>(null); const loadingError = ref<unknown | null>(null);
const isFirstEntry = ref<boolean>(true);
const removingPictureId = ref<string | null>(null); const removingPictureId = ref<string | null>(null);
const transactionDateTimeSheetMode = ref<string>('time'); const transactionDateTimeSheetMode = ref<string>('time');
const showTimeInDefaultTimezone = ref<boolean>(false); const showTimeInDefaultTimezone = ref<boolean>(false);
@@ -1319,6 +1322,28 @@ function duplicate(withTime?: boolean, withGeoLocation?: boolean): void {
props.f7router.navigate(`/transaction/add?id=${transaction.value.id}&type=${transaction.value.type}&withTime=${withTime ?? false}&withGeoLocation=${withGeoLocation ?? false}`); props.f7router.navigate(`/transaction/add?id=${transaction.value.id}&type=${transaction.value.type}&withTime=${withTime ?? false}&withGeoLocation=${withGeoLocation ?? false}`);
} }
function navigateToEdit(): void {
props.f7router.navigate(`/transaction/edit?id=${transaction.value.id}&type=${transaction.value.type}`);
}
function remove(): void {
showConfirm('Are you sure you want to delete this transaction?', () => {
showLoading();
transactionsStore.deleteTransaction({
transaction: transaction.value,
defaultCurrency: defaultCurrency.value
}).then(() => {
hideLoading();
props.f7router.back();
}).catch(error => {
hideLoading();
if (!error.processed) {
showToast(error.message || error);
}
});
});
}
function onPageAfterIn(): void { function onPageAfterIn(): void {
routeBackOnError(props.f7router, loadingError); routeBackOnError(props.f7router, loadingError);
@@ -1326,6 +1351,21 @@ function onPageAfterIn(): void {
&& !geoLocationStatus.value && !transaction.value.geoLocation) { && !geoLocationStatus.value && !transaction.value.geoLocation) {
updateGeoLocation(false); updateGeoLocation(false);
} }
if (isFirstEntry.value) {
isFirstEntry.value = false;
return;
}
if (mode.value === TransactionEditPageMode.View && query['id']) {
transactionsStore.getTransaction({ transactionId: query['id'], withPictures: true }).then(t => {
setTransactionModel(t, {}, true);
}).catch(error => {
if (!error.processed) {
showToast(error.message || error);
}
});
}
} }
function onPageBeforeOut(): void { function onPageBeforeOut(): void {