feat: 支持数据库运行时配置与多数据库,重构设置页并完善打包

- 数据库支持 SQLite / MySQL 运行时配置与切换,未配置时仍可启动,配置后自动建表
- 新增默认分类与标签初始化,注册用户自动创建
- 新增注册开关(默认关闭,可在系统设置开启;无用户时允许创建首个账号)
- 合并数据库、注册与 AI 配置为「系统设置」页,拆分「模型使用情况」独立页面
- AI 一键设置支持新建分类与标签
- 前端构建产物打包进可执行 jar,后端增加 SPA 路由回退
- jar 更名为 finance-app,补全 Gradle Wrapper,移除 archive 任务
- 更新 DeepSeek 模型说明文案
This commit is contained in:
2026-09-18 12:33:41 +08:00
parent 16e4c30456
commit c1f5d02564
63 changed files with 3783 additions and 573 deletions
+32
View File
@@ -0,0 +1,32 @@
// 数据库状态管理模块:记录后端是否已完成数据库配置,供路由守卫与页面使用
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getDatabaseStatus } from '../api/database'
import type { DatabaseStatus } from '../api/database'
export const useDatabaseStore = defineStore('database', () => {
const configured = ref(false) // 后端是否已完成数据库配置
const status = ref<DatabaseStatus | null>(null) // 当前数据库状态
const loaded = ref(false) // 是否已从后端加载过状态
/** 从后端加载数据库状态 */
async function load() {
try {
const res: any = await getDatabaseStatus()
setStatus(res.data)
} catch (e) {
// 状态查询失败时按未配置处理,引导用户前往配置页
configured.value = false
loaded.value = true
}
}
/** 更新本地保存的数据库状态 */
function setStatus(next: DatabaseStatus | null) {
status.value = next
configured.value = !!next?.configured
loaded.value = true
}
return { configured, status, loaded, load, setStatus }
})
+30
View File
@@ -0,0 +1,30 @@
// 注册状态管理模块:缓存后端注册开关与是否允许注册,供登录页与路由守卫复用
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { getRegistrationStatus } from '../api/user'
import type { RegistrationStatus } from '../api/user'
export const useRegistrationStore = defineStore('registration', () => {
const status = ref<RegistrationStatus | null>(null) // 注册状态
const loaded = ref(false) // 是否已从后端加载过
/** 从后端加载注册状态,失败时按不允许注册处理 */
async function load() {
try {
const res: any = await getRegistrationStatus()
status.value = res.data
} catch (e) {
status.value = null
} finally {
loaded.value = true
}
}
/** 更新本地缓存的注册状态 */
function setStatus(next: RegistrationStatus | null) {
status.value = next
loaded.value = true
}
return { status, loaded, load, setStatus }
})