From 5d45ba47311167829a8a4c30bff035bf9e77dc77 Mon Sep 17 00:00:00 2001 From: Jafeng <2998840497@qq.com> Date: Thu, 12 Mar 2026 15:36:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=A1=B5=E9=9D=A2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/AddEntryView.vue | 34 +++++++++++++---- src/views/AnalysisView.vue | 50 +++++++++++-------------- src/views/HomeView.vue | 75 +++++++++++++++++++------------------- src/views/ListView.vue | 18 ++++----- src/views/SettingsView.vue | 2 +- 5 files changed, 95 insertions(+), 84 deletions(-) diff --git a/src/views/AddEntryView.vue b/src/views/AddEntryView.vue index d39e896..da42c5e 100644 --- a/src/views/AddEntryView.vue +++ b/src/views/AddEntryView.vue @@ -3,7 +3,7 @@ import { computed, reactive, ref, watch } from 'vue' import { DEFAULT_TRANSACTION_CATEGORY, TRANSACTION_CATEGORIES, - getCategoryLabel, + getCategoryMeta, } from '../config/transactionCategories.js' import { useTransactionStore } from '../stores/transactions' import { useUiStore } from '../stores/ui' @@ -19,7 +19,11 @@ const dragStartY = ref(0) const dragging = ref(false) const dragOffset = ref(0) -const categories = TRANSACTION_CATEGORIES +const categories = computed(() => + TRANSACTION_CATEGORIES.filter((category) => + form.type === 'income' ? ['Income', 'Uncategorized'].includes(category.value) : category.value !== 'Income', + ), +) const toDatetimeLocal = (value) => { const date = value ? new Date(value) : new Date() @@ -65,6 +69,19 @@ const hydrateForm = () => { watch(editingId, hydrateForm, { immediate: true }) +watch( + () => form.type, + (nextType) => { + if (nextType === 'income' && form.category !== 'Income') { + form.category = 'Income' + return + } + if (nextType === 'expense' && form.category === 'Income') { + form.category = DEFAULT_TRANSACTION_CATEGORY + } + }, +) + const closePanel = () => { uiStore.closeAddEntry() } @@ -181,9 +198,9 @@ const sheetStyle = computed(() => { -
+
diff --git a/src/views/AnalysisView.vue b/src/views/AnalysisView.vue index 2e7ccf9..ce6e75c 100644 --- a/src/views/AnalysisView.vue +++ b/src/views/AnalysisView.vue @@ -113,38 +113,17 @@ const handleKeydown = (event) => { -
-
-

账本样本

-

{{ sortedTransactions.length }}

-

聊天时会带上最近 80 条记录摘要

-
-
-

AI 状态

-

- {{ aiReady ? '已连接' : '待配置' }} -

-

- {{ aiReady ? '使用设置页里的 DeepSeek Key 直接调用。' : '先去设置页填写 DeepSeek API Key。' }} -

-
-
- -
- -
-
当前还没有账本记录。聊天功能可以使用,但回答只会提示你先开始记账。
+
+ 先去设置页填写 DeepSeek API Key,这里才能真正发送提问。 +
+
{
-
+
+
+ +
+ +