refactor(backend): 重构动物相关 API 接口

- 更新了动物数据结构和相关类型定义
- 优化了动物列表、详情、创建、更新和删除接口
- 新增了更新动物状态接口
- 移除了与认领记录相关的接口
-调整了 API 响应结构
This commit is contained in:
ylweng
2025-08-31 23:26:25 +08:00
parent 5b5d65e072
commit cbee609e78
25 changed files with 3232 additions and 375 deletions

View File

@@ -1,5 +1,6 @@
import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
import { useAppStore } from '@/stores/app'
// 基础路由
const routes: RouteRecordRaw[] = [
@@ -125,7 +126,14 @@ const router = createRouter({
// 路由守卫
router.beforeEach(async (to, from, next) => {
const { meta } = to
const isAuthenticated = localStorage.getItem('admin_token') !== null
const appStore = useAppStore()
// 确保应用已初始化
if (!appStore.state.initialized) {
await appStore.initialize()
}
const isAuthenticated = !!appStore.state.user
// 检查是否需要认证
if (meta.requiresAuth && !isAuthenticated) {