feat: 新增日历页面并设为默认首页
新增日历页以月视图展示每日收支汇总、以年视图展示每月汇总,支持月份切换、统计口径过滤与当日明细查看,并将日历置于侧边导航首位、作为访问 / 的默认落地页。 变更内容: - 新增 `views/Calendar.vue`:月视图按日展示收入/支出/结余与当月合计,年视图以 12 月网格展示每月汇总并可点击进入该月,表头支持上一/下一期、年与月下拉跳转、「今天」及月/年视图切换 - 日历支持统计口径过滤(仅计入统计/全部记录/仅不计入,持久化于 `ledgerly.calendar.statsScope`),仅作用于汇总、不影响当日明细 - 点击日期弹出当日明细浮窗(顶部显示当日收入/支出/结余合计),明细行在条目主行展示金额,可点击打开完整账单详情(只读)并跳转到收支记录按当日筛选 - 视图模式持久化于 `ledgerly.calendar.view`,当前视图与年月同步到 URL(`?view=month|year&y=YYYY&m=MM`),月/年无数据时显示空状态 - `TransactionDetailModal` 新增 `editable` 属性(默认 true)以支持只读场景;`utils/navItems.ts` 将日历置于导航首位;`router` 与 `Login` 默认跳转由统计面板改为日历;补充导航、存储键与 `layout.calendar`、`calendar.*` 三语文案
This commit is contained in:
@@ -34,13 +34,18 @@ const router = createRouter({
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('../views/Layout.vue'), // 主布局(带侧边栏)
|
||||
redirect: '/dashboard', // 默认跳转到统计面板
|
||||
redirect: '/calendar', // 默认跳转到日历
|
||||
children: [
|
||||
{
|
||||
path: 'dashboard',
|
||||
name: 'Dashboard',
|
||||
component: () => import('../views/Dashboard.vue'), // 统计面板
|
||||
},
|
||||
{
|
||||
path: 'calendar',
|
||||
name: 'Calendar',
|
||||
component: () => import('../views/Calendar.vue'), // 日历(每日收支概览)
|
||||
},
|
||||
{
|
||||
path: 'smart-query',
|
||||
name: 'SqlQuery',
|
||||
@@ -139,7 +144,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
// 已配置数据库:配置引导页不再需要,跳转到登录或首页
|
||||
if (to.path === '/database-setup') {
|
||||
const userStore = useUserStore()
|
||||
next(userStore.token ? '/dashboard' : '/login')
|
||||
next(userStore.token ? '/calendar' : '/login')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -151,7 +156,7 @@ router.beforeEach(async (to, _from, next) => {
|
||||
const target =
|
||||
typeof redirect === 'string' && redirect.startsWith('/') && !redirect.startsWith('//')
|
||||
? redirect
|
||||
: '/dashboard'
|
||||
: '/calendar'
|
||||
next(target)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user