## 后端重构 ### 新增基础设施 - src/common/dto/ - 统一响应格式和分页查询DTO基类 - src/common/interceptors/ - 响应转换拦截器 - src/common/utils/ - JSON解析和分页计算工具函数 ### DTO规范化 - Course、Lesson、TeacherCourse、SchoolCourse、Tenant控制器添加Swagger装饰器 - 添加@ApiQuery、@ApiBody、@ApiOperation完善API文档 - 修复CourseLesson控制器路径参数问题 ## 前端重构 ### Orval API客户端生成 - 添加orval配置和生成脚本 - 生成完整的类型安全API客户端 (src/api/generated/) - 导入56个参数类型文件 ### API模块迁移 - src/api/course.ts - 迁移使用Orval生成API - src/api/school-course.ts - 修复类型错误(number vs string) - src/api/teacher.ts - 完整迁移教师端API - src/api/client.ts - 重构API客户端统一入口 - src/api/lesson.ts - 修复未使用参数 ### 文件路由配置 - 配置unplugin-vue-router插件 - 创建动态路由配置支持自动路由和传统路由切换 - 添加路由守卫保留原有权限逻辑 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
81 lines
1.9 KiB
TypeScript
81 lines
1.9 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import vue from '@vitejs/plugin-vue';
|
|
import { resolve } from 'path';
|
|
import AutoImport from 'unplugin-auto-import/vite';
|
|
import Components from 'unplugin-vue-components/vite';
|
|
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
|
|
import viteCompression from 'vite-plugin-compression';
|
|
import fileRouter from 'unplugin-vue-router/vite';
|
|
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
fileRouter({
|
|
routesFolder: 'src/views',
|
|
extensions: ['.vue'],
|
|
importMode: 'sync',
|
|
}),
|
|
AutoImport({
|
|
imports: [
|
|
'vue',
|
|
'vue-router',
|
|
'pinia',
|
|
{
|
|
'ant-design-vue': ['message', 'notification', 'Modal'],
|
|
},
|
|
],
|
|
dts: 'src/auto-imports.d.ts',
|
|
// 添加 vue-router 的自动导入
|
|
vueTemplate: true,
|
|
}),
|
|
Components({
|
|
resolvers: [
|
|
AntDesignVueResolver({
|
|
importStyle: false,
|
|
}),
|
|
],
|
|
dts: 'src/components.d.ts',
|
|
}),
|
|
viteCompression({
|
|
verbose: true,
|
|
disable: false,
|
|
threshold: 10240,
|
|
algorithm: 'gzip',
|
|
ext: '.gz',
|
|
}),
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'@': resolve(__dirname, 'src'),
|
|
},
|
|
},
|
|
server: {
|
|
port: 5173,
|
|
host: true,
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
rewrite: (path) => path.replace(/^\/api/, '/api'),
|
|
},
|
|
'/uploads': {
|
|
target: 'http://localhost:3000',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
rollupOptions: {
|
|
output: {
|
|
manualChunks: {
|
|
'ant-design-vue': ['ant-design-vue', '@ant-design/icons-vue'],
|
|
'echarts': ['echarts'],
|
|
'fullcalendar': ['@fullcalendar/vue3', '@fullcalendar/core', '@fullcalendar/daygrid', '@fullcalendar/timegrid', '@fullcalendar/interaction'],
|
|
'dayjs': ['dayjs'],
|
|
},
|
|
},
|
|
},
|
|
chunkSizeWarningLimit: 1000,
|
|
},
|
|
});
|