feat: 迭代三大模块 + 全系统 Bug 修复
新功能: - 账单筛选统计:多维度筛选面板 + 保存方案 + 结果统计 - 通知公告:系统公告/群组通知/个人提醒 + 通知中心页面 - 管理员后台:数据看板 + 用户管理 + 发布公告 Bug 修复: - 统计页 fetchPrevMonthData/fetchMaxSingle 添加 group_id - 群组视图添加 t.group_id 过滤,防止私人数据泄露 - 通知列表添加群组通知条件 - 通知标记已读添加错误处理 - 管理员 API 添加 affectedRows 检查 - 筛选面板金额为 0 时正确回填 - profile onShow 补充 userStore.fetchUserInfo - 全系统样式修复(overflow/box-sizing)
This commit is contained in:
25
client/src/stores/filter.ts
Normal file
25
client/src/stores/filter.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import * as api from '@/api/filter'
|
||||
import type { FilterParams } from '@/api/filter'
|
||||
|
||||
export const useFilterStore = defineStore('filter', () => {
|
||||
const savedFilters = ref<api.SavedFilter[]>([])
|
||||
|
||||
async function fetchSavedFilters() {
|
||||
savedFilters.value = await api.getSavedFilters()
|
||||
}
|
||||
|
||||
async function saveFilter(name: string, filters: FilterParams) {
|
||||
const result = await api.saveFilter({ name, filters })
|
||||
await fetchSavedFilters()
|
||||
return result.id
|
||||
}
|
||||
|
||||
async function deleteFilter(id: number) {
|
||||
await api.deleteFilter(id)
|
||||
savedFilters.value = savedFilters.value.filter(f => f.id !== id)
|
||||
}
|
||||
|
||||
return { savedFilters, fetchSavedFilters, saveFilter, deleteFilter }
|
||||
})
|
||||
24
client/src/stores/notification.ts
Normal file
24
client/src/stores/notification.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import * as api from '@/api/notification'
|
||||
|
||||
export const useNotificationStore = defineStore('notification', () => {
|
||||
const unreadCount = ref(0)
|
||||
|
||||
async function fetchUnreadCount() {
|
||||
const data = await api.getUnreadCount()
|
||||
unreadCount.value = data.count
|
||||
}
|
||||
|
||||
async function markRead(id: number) {
|
||||
await api.markRead(id)
|
||||
if (unreadCount.value > 0) unreadCount.value--
|
||||
}
|
||||
|
||||
async function markAllRead() {
|
||||
await api.markAllRead()
|
||||
unreadCount.value = 0
|
||||
}
|
||||
|
||||
return { unreadCount, fetchUnreadCount, markRead, markAllRead }
|
||||
})
|
||||
@@ -19,6 +19,7 @@ export const useTransactionStore = defineStore('transaction', () => {
|
||||
})
|
||||
transactions.value = data.list
|
||||
total.value = data.total
|
||||
return data
|
||||
} catch (err) {
|
||||
transactions.value = []
|
||||
total.value = 0
|
||||
|
||||
@@ -24,6 +24,7 @@ export const useUserStore = defineStore('user', () => {
|
||||
if (userInfo.value) {
|
||||
uni.setStorageSync('xc:nickname', userInfo.value.nickname)
|
||||
uni.setStorageSync('xc:avatar_url', userInfo.value.avatar_url)
|
||||
uni.setStorageSync('xc:role', userInfo.value.role)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user