From da4488dcccfaf75f9f160dec33ccb94a21e9fdeb Mon Sep 17 00:00:00 2001 From: zhangjf Date: Sun, 1 Mar 2026 22:17:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=A7=BB=E5=8A=A8=E7=AB=AF):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=94=AF=E5=87=BA=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 新增支出 (Add.vue): - 增加图片附件上传功能(限制为图片类型) - 支持最多上传 9 张图片 - 实现图片预览和删除功能 - 将图片转 base64 格式提交到后端 attachments 字段 2. 支出列表 (List.vue): - 重构卡片布局为 5 行展示: * 第一行:标题 + 支出时间(右侧对齐) * 第二行:支出类型(左)+ 支出金额(右,红色突出显示) * 第三行:收款单位 * 第四行:支付描述(可选,有内容时显示) * 第五行:查看附件按钮(有附件时显示,蓝色可点击) - 添加 formatDateTime 函数格式化日期时间 - 添加 getAttachmentCount 函数计算附件数量 - 添加 previewAttachments 函数实现图片预览 - 优化样式:分隔线、图标、标签等细节美化 技术实现: - 使用 Vant 的 van-uploader 组件上传图片 - 使用 ImagePreview 组件预览图片 - 附件以 base64 逗号分隔字符串形式存储 - 响应式布局适配移动端 --- fund-mobile/components.d.ts | 1 + fund-mobile/src/views/expense/Add.vue | 60 +++++++- fund-mobile/src/views/expense/List.vue | 191 ++++++++++++++++++------- 3 files changed, 199 insertions(+), 53 deletions(-) diff --git a/fund-mobile/components.d.ts b/fund-mobile/components.d.ts index 3239f8d..15f714e 100644 --- a/fund-mobile/components.d.ts +++ b/fund-mobile/components.d.ts @@ -24,5 +24,6 @@ declare module 'vue' { VanPullRefresh: typeof import('vant/es')['PullRefresh'] VanSearch: typeof import('vant/es')['Search'] VanTag: typeof import('vant/es')['Tag'] + VanUploader: typeof import('vant/es')['Uploader'] } } diff --git a/fund-mobile/src/views/expense/Add.vue b/fund-mobile/src/views/expense/Add.vue index 2bcf271..3ae272e 100644 --- a/fund-mobile/src/views/expense/Add.vue +++ b/fund-mobile/src/views/expense/Add.vue @@ -51,6 +51,18 @@ + +
+ + +
@@ -74,13 +86,15 @@