From 10b02df6e28e446a3fd8e85857af782056b097e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=AF=9A?= Date: Tue, 6 Jan 2026 13:45:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B6=88=E6=81=AF=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=9E=9A=E4=B8=BE=E5=92=8C=E7=9B=B8=E5=85=B3=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E4=BC=98=E5=8C=96=E6=B6=88=E6=81=AF=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E6=9C=8D=E5=8A=A1=E7=9A=84=E6=B7=BB=E5=8A=A0=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E6=9B=B4=E6=96=B0=E5=A4=9A=E4=B8=AA=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E4=BB=A5=E6=94=AF=E6=8C=81=E6=96=B0=E5=A2=9E=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E5=AF=B9=E8=AF=9D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity/MessageRecord.cs | 24 +++++++++ Service/MessageRecordService.cs | 5 +- Web/src/components/AddClassifyDialog.vue | 43 ++++++++++++++++ Web/src/components/Bill/BillForm.vue | 64 ++++-------------------- Web/src/components/PopupContainer.vue | 12 +++++ Web/src/components/ReasonGroupList.vue | 63 ++++++++++++----------- Web/src/components/TransactionDetail.vue | 52 ++++++++----------- Web/src/views/ClassificationSmart.vue | 2 + Web/src/views/MessageView.vue | 19 +++++-- Web/src/views/PeriodicRecord.vue | 43 ++++++---------- 10 files changed, 178 insertions(+), 149 deletions(-) create mode 100644 Web/src/components/AddClassifyDialog.vue diff --git a/Entity/MessageRecord.cs b/Entity/MessageRecord.cs index 4e72739..66cc2de 100644 --- a/Entity/MessageRecord.cs +++ b/Entity/MessageRecord.cs @@ -1,5 +1,24 @@ namespace Entity; +/// +/// 消息类型 +/// +public enum MessageType +{ + /// + /// 文本 + /// + Text = 0, + /// + /// 跳转URL + /// + Url = 1, + /// + /// HTML内容 + /// + Html = 2 +} + /// /// 消息实体 /// @@ -15,6 +34,11 @@ public class MessageRecord : BaseEntity /// public string Content { get; set; } = string.Empty; + /// + /// 消息类型 + /// + public MessageType MessageType { get; set; } = MessageType.Text; + /// /// 是否已读 /// diff --git a/Service/MessageRecordService.cs b/Service/MessageRecordService.cs index 8b98b49..edd8306 100644 --- a/Service/MessageRecordService.cs +++ b/Service/MessageRecordService.cs @@ -5,7 +5,7 @@ public interface IMessageRecordService Task<(IEnumerable List, long Total)> GetPagedListAsync(int pageIndex, int pageSize); Task GetByIdAsync(long id); Task AddAsync(MessageRecord message); - Task AddAsync(string title, string content); + Task AddAsync(string title, string content, MessageType type = MessageType.Text); Task MarkAsReadAsync(long id); Task MarkAllAsReadAsync(); Task DeleteAsync(long id); @@ -29,12 +29,13 @@ public class MessageRecordService(IMessageRecordRepository messageRepo, INotific return await messageRepo.AddAsync(message); } - public async Task AddAsync(string title, string content) + public async Task AddAsync(string title, string content, MessageType type = MessageType.Text) { var message = new MessageRecord { Title = title, Content = content, + MessageType = type, IsRead = false }; var result = await messageRepo.AddAsync(message); diff --git a/Web/src/components/AddClassifyDialog.vue b/Web/src/components/AddClassifyDialog.vue new file mode 100644 index 0000000..6096a0a --- /dev/null +++ b/Web/src/components/AddClassifyDialog.vue @@ -0,0 +1,43 @@ + + + diff --git a/Web/src/components/Bill/BillForm.vue b/Web/src/components/Bill/BillForm.vue index 4c8c4da..b05ee4d 100644 --- a/Web/src/components/Bill/BillForm.vue +++ b/Web/src/components/Bill/BillForm.vue @@ -36,7 +36,7 @@ @@ -150,4 +155,11 @@ const hasActions = computed(() => !!slots['header-actions']) overflow-x: hidden; -webkit-overflow-scrolling: touch; } + +.popup-footer-fixed { + flex-shrink: 0; + border-top: 1px solid var(--van-border-color, #ebedf0); + background-color: var(--van-background-2, #f7f8fa); + padding: 12px 16px; +} diff --git a/Web/src/components/ReasonGroupList.vue b/Web/src/components/ReasonGroupList.vue index 854e0c8..81b60de 100644 --- a/Web/src/components/ReasonGroupList.vue +++ b/Web/src/components/ReasonGroupList.vue @@ -87,12 +87,10 @@ /> - @@ -137,7 +135,7 @@ type="success" size="small" class="classify-btn" - @click="showAddClassify = true" + @click="addClassifyDialogRef.open()" > + 新增 @@ -163,17 +161,23 @@ - + + - - - + @@ -188,6 +192,7 @@ import { } from 'vant' import { getReasonGroups, batchUpdateByReason, getTransactionList } from '@/api/transactionRecord' import { getCategoryList, createCategory } from '@/api/transactionCategory' +import AddClassifyDialog from './AddClassifyDialog.vue' import TransactionList from './TransactionList.vue' import TransactionDetail from './TransactionDetail.vue' import PopupContainer from './PopupContainer.vue' @@ -201,7 +206,7 @@ const props = defineProps({ // 每页数量 pageSize: { type: Number, - default: 3 // TODO 测试写小一点 + default: 20 } }) @@ -232,10 +237,9 @@ const transactionPageSize = ref(20) // 批量分类相关状态 const showBatchDialog = ref(false) -const showAddClassify = ref(false) const batchFormRef = ref(null) const batchGroup = ref(null) -const newClassify = ref('') +const addClassifyDialogRef = ref() const batchForm = ref({ type: null, typeName: '', @@ -380,20 +384,13 @@ const selectClassify = (classify) => { } // 新增分类 -const addNewClassify = async () => { - if (!newClassify.value.trim()) { - showToast('请输入分类名称') - return - } - +const handleAddClassify = async (categoryName) => { if (batchForm.value.type === null) { showToast('请先选择交易类型') return } try { - const categoryName = newClassify.value.trim() - // 调用API创建分类 const response = await createCategory({ name: categoryName, @@ -411,9 +408,6 @@ const addNewClassify = async () => { } catch (error) { console.error('创建分类出错:', error) showToast('创建分类失败') - } finally { - newClassify.value = '' - showAddClassify.value = false } } @@ -711,6 +705,17 @@ defineExpose({ height: 28px; } +.popup-actions { + display: flex; + gap: 8px; + align-items: center; +} + +.popup-actions .van-button { + flex: 1; + min-width: auto; +} + .group-info { display: flex; align-items: center; diff --git a/Web/src/components/TransactionDetail.vue b/Web/src/components/TransactionDetail.vue index a6db4fe..e938c02 100644 --- a/Web/src/components/TransactionDetail.vue +++ b/Web/src/components/TransactionDetail.vue @@ -9,8 +9,7 @@ 抵账 -
- + @@ -68,7 +67,7 @@ type="success" size="small" class="classify-btn" - @click="showAddClassify = true" + @click="addClassifyDialogRef.open()" > + 新增 @@ -93,25 +92,26 @@
+ -
- - 保存修改 - -
- - + - - - + { } // 新增分类 -const addNewClassify = async () => { - if (!newClassify.value.trim()) { - showToast('请输入分类名称') - return - } - +const handleAddClassify = async (categoryName) => { try { - const categoryName = newClassify.value.trim() - // 调用API创建分类 const response = await createCategory({ name: categoryName, @@ -290,9 +283,6 @@ const addNewClassify = async () => { } catch (error) { console.error('创建分类出错:', error) showToast('创建分类失败') - } finally { - newClassify.value = '' - showAddClassify.value = false } } diff --git a/Web/src/views/ClassificationSmart.vue b/Web/src/views/ClassificationSmart.vue index ccca9e2..09d69c9 100644 --- a/Web/src/views/ClassificationSmart.vue +++ b/Web/src/views/ClassificationSmart.vue @@ -32,6 +32,7 @@ type="primary" :loading="classifying" :disabled="selectedCount === 0" + round @click="startClassify" class="action-btn" > @@ -41,6 +42,7 @@ diff --git a/Web/src/views/MessageView.vue b/Web/src/views/MessageView.vue index 109f365..b56ae32 100644 --- a/Web/src/views/MessageView.vue +++ b/Web/src/views/MessageView.vue @@ -49,7 +49,9 @@ height="50%" :closeable="true" > -
+
+
+
{{ currentMessage.content }}
@@ -126,9 +128,6 @@ const onRefresh = () => { }; const viewDetail = async (item) => { - currentMessage.value = item; - detailVisible.value = true; - if (!item.isRead) { try { await markAsRead(item.id); @@ -138,6 +137,18 @@ const viewDetail = async (item) => { console.error('标记已读失败', error); } } + + if (item.messageType === 1) { + if (item.content.startsWith('http')) { + window.open(item.content, '_blank'); + } else { + showToast('无效的URL'); + } + return; + } + + currentMessage.value = item; + detailVisible.value = true; }; const handleDelete = (item) => { diff --git a/Web/src/views/PeriodicRecord.vue b/Web/src/views/PeriodicRecord.vue index 1d0aa1e..852361b 100644 --- a/Web/src/views/PeriodicRecord.vue +++ b/Web/src/views/PeriodicRecord.vue @@ -90,7 +90,7 @@ :title="isEdit ? '编辑周期账单' : '新增周期账单'" height="85%" > - + + 新增 @@ -223,13 +223,12 @@
- -
- - {{ isEdit ? '更新' : '确认添加' }} - -
+
@@ -260,14 +259,10 @@ - - - + @@ -284,9 +279,11 @@ import { } from '@/api/transactionPeriodic' import { getCategoryList, createCategory } from '@/api/transactionCategory' import PopupContainer from '@/components/PopupContainer.vue' +import AddClassifyDialog from '@/components/AddClassifyDialog.vue' const router = useRouter() const navTitle = ref('周期账单') +const addClassifyDialogRef = ref() const periodicList = ref([]) const loading = ref(false) @@ -303,8 +300,6 @@ const submitting = ref(false) const showPeriodicTypePicker = ref(false) const showWeekdaysPicker = ref(false) const showMonthDaysPicker = ref(false) -const showAddClassify = ref(false) -const newClassify = ref('') // 分类列表 const classifyColumns = ref([]) @@ -626,15 +621,8 @@ const clearClassify = () => { } // 新增分类 -const addNewClassify = async () => { - if (!newClassify.value.trim()) { - showToast('请输入分类名称') - return - } - +const handleAddClassify = async (categoryName) => { try { - const categoryName = newClassify.value.trim() - // 调用API创建分类 const response = await createCategory({ name: categoryName, @@ -652,9 +640,6 @@ const addNewClassify = async () => { } catch (error) { console.error('创建分类出错:', error) showToast('创建分类失败') - } finally { - newClassify.value = '' - showAddClassify.value = false } }