feat: remove V1 calendar/budget/stats modules

- 删除 V1 前端页面 (CalendarView, BudgetView, statisticsV1)
- 移除 V1 路由配置 (/calendar, /budget, /)
- 清理路由守卫中的 V1 版本切换逻辑
- 移除设置页面中的版本切换功能
- 更新底部导航和登录重定向到 V2 路由
- 移除 App.vue 中 V1 页面的缓存配置
- 删除后端 TransactionRecordController.GetDailyStatisticsAsync (Obsolete)
- 删除 TransactionStatisticsController.GetBalanceStatisticsAsync
- 保留 V2 仍在使用的共享 API (GetUncoveredCategories, GetArchiveSummary, GetDailyStatistics)
- 保留 V2 使用的全局事件监听机制
- 所有测试通过 (210/210)

Breaking Change: V1 API 端点和路由将不可用
This commit is contained in:
SunCheng
2026-02-14 00:01:44 +08:00
parent 162b6d02dd
commit a7954f55ad
23 changed files with 1028 additions and 3946 deletions

View File

@@ -115,12 +115,6 @@
is-link
@click="handleScheduledTasks"
/>
<van-cell
title="切换版本"
is-link
:value="versionStore.currentVersion.toUpperCase()"
@click="handleVersionSwitch"
/>
</van-cell-group>
<div
@@ -145,16 +139,14 @@
<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { showLoadingToast, showSuccessToast, showToast, closeToast, showConfirmDialog, showDialog } from 'vant'
import { showLoadingToast, showSuccessToast, showToast, closeToast, showConfirmDialog } from 'vant'
import { uploadBillFile } from '@/api/billImport'
import { useAuthStore } from '@/stores/auth'
import { useVersionStore } from '@/stores/version'
import { getVapidPublicKey, subscribe, testNotification } from '@/api/notification'
import { updateServiceWorker } from '@/registerServiceWorker'
const router = useRouter()
const authStore = useAuthStore()
const versionStore = useVersionStore()
const fileInputRef = ref(null)
const currentType = ref('')
@@ -390,64 +382,6 @@ const handleReloadFromNetwork = async () => {
const handleScheduledTasks = () => {
router.push({ name: 'scheduled-tasks' })
}
/**
* 处理版本切换
*/
const handleVersionSwitch = async () => {
try {
await showDialog({
title: '选择版本',
message: '请选择要使用的版本',
showCancelButton: true,
confirmButtonText: 'V2',
cancelButtonText: 'V1'
}).then(() => {
// 选择 V2
versionStore.setVersion('v2')
showSuccessToast('已切换到 V2')
// 尝试跳转到当前路由的 V2 版本
redirectToVersionRoute()
}).catch(() => {
// 选择 V1
versionStore.setVersion('v1')
showSuccessToast('已切换到 V1')
// 尝试跳转到当前路由的 V1 版本
redirectToVersionRoute()
})
} catch (error) {
console.error('版本切换失败:', error)
}
}
/**
* 根据当前版本重定向路由
*/
const redirectToVersionRoute = () => {
const currentRoute = router.currentRoute.value
const currentRouteName = currentRoute.name
if (versionStore.isV2()) {
// 尝试跳转到 V2 路由
const v2RouteName = `${currentRouteName}-v2`
const v2Route = router.getRoutes().find(route => route.name === v2RouteName)
if (v2Route) {
router.push({ name: v2RouteName })
}
// 如果没有 V2 路由,保持当前路由
} else {
// V1 版本:如果当前在 V2 路由,跳转到 V1
if (currentRouteName && currentRouteName.toString().endsWith('-v2')) {
const v1RouteName = currentRouteName.toString().replace(/-v2$/, '')
const v1Route = router.getRoutes().find(route => route.name === v1RouteName)
if (v1Route) {
router.push({ name: v1RouteName })
}
}
}
}
</script>
<style scoped>