From ddb35ebb329089b389f78b7353895ed3db55ba49 Mon Sep 17 00:00:00 2001 From: 12975 <1297598740@qq.com> Date: Mon, 2 Feb 2026 01:41:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=EF=BC=8C=E9=87=87=E7=94=A8=E7=8E=BB=E7=92=83?= =?UTF-8?q?=E6=8B=9F=E6=80=81=E8=AE=BE=E8=AE=A1=E5=B9=B6=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=88=86=E9=85=8D=E8=A7=84=E5=88=99=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AllocationRuleForm/AllocationRuleForm.tsx | 23 +++++++++++++++++++ src/pages/Settings/Settings.css | 23 +++++++++++++++++++ src/pages/Settings/Settings.tsx | 16 +++++++++++++ src/services/allocationRuleService.ts | 4 ++++ src/types/index.ts | 3 +++ 5 files changed, 69 insertions(+) diff --git a/src/components/budget/AllocationRuleForm/AllocationRuleForm.tsx b/src/components/budget/AllocationRuleForm/AllocationRuleForm.tsx index f4e0fc4..5e12ad2 100644 --- a/src/components/budget/AllocationRuleForm/AllocationRuleForm.tsx +++ b/src/components/budget/AllocationRuleForm/AllocationRuleForm.tsx @@ -37,6 +37,7 @@ export const AllocationRuleForm: React.FC = ({ triggerType: 'income', sourceAccountId: undefined, isActive: true, + autoExecute: true, targets: [], }); @@ -50,6 +51,7 @@ export const AllocationRuleForm: React.FC = ({ triggerType: allocationRule.triggerType as 'income' | 'manual', sourceAccountId: allocationRule.sourceAccountId, isActive: allocationRule.isActive, + autoExecute: allocationRule.autoExecute, targets: allocationRule.targets.map((target) => ({ targetType: target.targetType, targetId: target.targetId, @@ -309,6 +311,27 @@ export const AllocationRuleForm: React.FC = ({ + {/* Auto Execute */} +
+ +
+ {/* Allocation Targets */}
diff --git a/src/pages/Settings/Settings.css b/src/pages/Settings/Settings.css index c9d24eb..ca6b5d8 100644 --- a/src/pages/Settings/Settings.css +++ b/src/pages/Settings/Settings.css @@ -705,4 +705,27 @@ width: 20px; height: 20px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3)); +} + +.settings-input-container { + min-width: 200px; + max-width: 50%; +} + +.settings-text-input { + width: 100%; + padding: var(--spacing-md); + border: 1px solid var(--glass-border); + border-radius: var(--radius-lg); + background: var(--glass-bg); + color: var(--color-text); + font-size: var(--font-base); + transition: all 0.2s ease; +} + +.settings-text-input:focus { + outline: none; + border-color: var(--color-primary); + box-shadow: 0 0 0 3px var(--color-primary-lighter); + background: rgba(255, 255, 255, 0.9); } \ No newline at end of file diff --git a/src/pages/Settings/Settings.tsx b/src/pages/Settings/Settings.tsx index 430f646..cc8483e 100644 --- a/src/pages/Settings/Settings.tsx +++ b/src/pages/Settings/Settings.tsx @@ -439,6 +439,22 @@ function Settings() {
+ +
+
+ +

用于接收短信通知(自动记账等)

+
+
+ handleUserSettingChange('phone', e.target.value)} + /> +
+
diff --git a/src/services/allocationRuleService.ts b/src/services/allocationRuleService.ts index 77f36d1..0d685d2 100644 --- a/src/services/allocationRuleService.ts +++ b/src/services/allocationRuleService.ts @@ -17,6 +17,7 @@ function transformAllocationRule(data: Record): AllocationRule sourceAccountId: (data.source_account_id ?? data.sourceAccountId) as number | undefined, sourceAccount: data.source_account ? transformSourceAccount(data.source_account as Record) : undefined, isActive: (data.is_active ?? data.isActive) as boolean, + autoExecute: (data.auto_execute ?? data.autoExecute) as boolean | undefined, targets: ((data.targets as Record[]) || []).map(transformAllocationTarget), createdAt: (data.created_at ?? data.createdAt) as string, }; @@ -58,6 +59,7 @@ export interface AllocationRuleFormInput { triggerType: 'income' | 'manual'; sourceAccountId?: number; isActive: boolean; + autoExecute?: boolean; targets: AllocationTargetInput[]; } @@ -143,6 +145,7 @@ export const createAllocationRule = async ( trigger_type: data.triggerType, source_account_id: data.sourceAccountId, is_active: data.isActive, + auto_execute: data.autoExecute, targets: data.targets.map(t => ({ target_type: t.targetType, target_id: t.targetId, @@ -170,6 +173,7 @@ export const updateAllocationRule = async ( trigger_type: data.triggerType, source_account_id: data.sourceAccountId, is_active: data.isActive, + auto_execute: data.autoExecute, targets: data.targets.map(t => ({ target_type: t.targetType, target_id: t.targetId, diff --git a/src/types/index.ts b/src/types/index.ts index 60382fa..aae9aa5 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -76,7 +76,9 @@ export interface UserSettings { defaultExpenseAccountId?: number | null; defaultIncomeAccountId?: number | null; defaultExpenseAccount?: Account | null; + defaultExpenseAccount?: Account | null; defaultIncomeAccount?: Account | null; + phone?: string; } // Tag Interface @@ -222,6 +224,7 @@ export interface AllocationRule { sourceAccountId?: number; sourceAccount?: Account; isActive: boolean; + autoExecute?: boolean; targets: AllocationTarget[]; createdAt: string; }