feat(admin): art-design-pro integration with local session auth
P1b Task 9: apps/admin based on art-design-pro v3.0.2 (tag, commit d224dd4; source recorded in apps/admin/SOURCE.md), trimmed to layout/login/i18n/request/table-form core. Login wired to real POST /v1/auth/password (single-token session), Bearer header on all requests, 401 interceptor logout+redirect, request-driven sliding renewal (refresh at ~80% TTL, single-flight), best-effort POST /v1/auth/logout on user-menu logout. One protected stub page (相册管理). Dev port 5176 strictPort + /v1 proxy to 8080. Admin keeps its own eslint9 flat config; root eslint ignores apps/admin/**. vitest unit tests for renewal pacing + Playwright e2e (guard redirect, localized wrong-password error, login lands on stub, token persists across reload, logout clears session). Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { defineConfig } from 'vitest/config'
|
||||
|
||||
// 仅收集单元测试(纯函数);e2e/ 归 Playwright(test:e2e)。
|
||||
// 别名与 vite.config.ts 对齐(被测模块的导入链会拉到 router/views 的 .vue)。
|
||||
const r = (p: string) => path.resolve(fileURLToPath(new URL('.', import.meta.url)), p)
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue()],
|
||||
define: {
|
||||
// vite.config.ts 里由 VITE_VERSION 注入;单测环境直接给常量
|
||||
__APP_VERSION__: JSON.stringify('0.1.0')
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': r('src'),
|
||||
'@views': r('src/views'),
|
||||
'@imgs': r('src/assets/images'),
|
||||
'@icons': r('src/assets/icons'),
|
||||
'@utils': r('src/utils'),
|
||||
'@stores': r('src/store'),
|
||||
'@styles': r('src/assets/styles')
|
||||
}
|
||||
},
|
||||
test: {
|
||||
environment: 'jsdom',
|
||||
include: ['src/**/*.{test,spec}.ts']
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user