feat: init project

This commit is contained in:
2025-02-19 20:55:04 +08:00
commit 24a6c59d73
30 changed files with 6578 additions and 0 deletions

3
server/routes/index.ts Normal file
View File

@ -0,0 +1,3 @@
export default defineEventHandler((event) => {
return 'Start by editing <code>server/routes/index.ts</code>.'
})

View File

@ -0,0 +1,26 @@
export default defineEventHandler((event) => {
const page = 1
const pageSize = 10
const dataList: Record<string, any>[] = []
// 根据分页计算数据
for (let i = 0; i < pageSize; i++) {
dataList.push({
id: i + (page - 1) * pageSize,
pid: null,
path: '/dashboard',
redirect: '/dashboard/analysis',
name: `Dashboard` + `_${i + 1}`,
icon: 'AppstoreOutlined',
title: 'pages.dashboard.title',
component: 'RouteView',
})
}
return {
code: 200,
data: {
data: dataList,
total: 200,
},
}
})

View File

@ -0,0 +1,7 @@
export default defineEventHandler((event) => {
return {
code: 200,
msg: '请求成功',
data: {},
}
})

View File

@ -0,0 +1,6 @@
export default defineEventHandler((event) => {
return {
code: 401,
msg: '暂无权限',
}
})

View File

@ -0,0 +1,6 @@
export default defineEventHandler((event) => {
return {
code: 403,
msg: '暂无权限',
}
})

View File

@ -0,0 +1,6 @@
export default defineEventHandler((event) => {
return {
code: 404,
msg: '页面不存在',
}
})

View File

@ -0,0 +1,6 @@
export default defineEventHandler((event) => {
return {
code: 500,
msg: '服务器错误',
}
})

View File

@ -0,0 +1,6 @@
export default defineEventHandler((event) => {
return {
code: 200,
msg: 'delete success',
}
})

View File

@ -0,0 +1,6 @@
export default defineEventHandler((event) => {
return {
code: 200,
msg: 'post request success',
}
})

View File

@ -0,0 +1,6 @@
export default defineEventHandler((event) => {
return {
code: 200,
msg: 'put request success',
}
})

View File

@ -0,0 +1,32 @@
export interface UserInfo {
id: number
username: string
nickname?: string
email?: string
mobile?: string
avatar?: string
signature?: string
realName?: string
money?: number
birth?: string
}
export default defineEventHandler((event) => {
const userInfo: UserInfo = {
id: 1,
username: 'admin',
nickname: 'admin',
email: 'test@qq.com',
mobile: '13000000000',
avatar: 'https://avatars.githubusercontent.com/u/21073088',
signature: '海纳百川,有容乃大',
realName: '张三',
money: 10000,
birth: '1990-01-01',
}
return {
code: 200,
data: userInfo,
msg: '获取成功',
}
})

View File

@ -0,0 +1,9 @@
export default defineEventHandler((event) => {
return {
code: 200,
data: {
token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.UQmqAUhUrpDVV2ST7mZKyLTomVfg7sYkEjmdDI5XF8Q',
},
msg: '登录成功',
}
})

View File

@ -0,0 +1,45 @@
export default defineEventHandler((event) => {
return {
code: 200,
data: [
{
id: 1,
pid: null,
path: '/dashboard',
redirect: '/dashboard/analysis',
name: 'Dashboard',
icon: 'AppstoreOutlined',
title: 'pages.dashboard.title',
component: 'RouteView',
},
{
id: 2,
pid: 1,
path: '/dashboard/analysis',
name: 'DashboardAnalysis',
component: 'DashboardAnalysis',
title: 'pages.dashboard.analysis.title',
icon: null,
},
{
id: 3,
pid: 1,
name: 'DashboardWorkspace',
component: 'DashboardWorkspace',
path: '/dashboard/workspace',
title: 'pages.dashboard.workspace.title',
icon: null,
},
{
id: 4,
pid: null,
name: 'FullPath',
path: 'https://www.baidu.com',
component: 'BlankRoute',
title: 'pages.jump.baidu',
icon: 'LinkOutlined',
},
],
msg: '获取成功',
}
})

View File

@ -0,0 +1,45 @@
export default defineEventHandler((event) => {
return {
code: 200,
data: [
{
id: 1,
pid: null,
path: '/',
redirect: '/home',
name: 'Home',
icon: 'AppstoreOutlined',
title: '工作区',
component: 'RouteView',
},
{
id: 2,
pid: 1,
path: '/home',
name: 'Home',
component: 'Home',
title: 'Home',
icon: null,
},
{
id: 3,
pid: 1,
name: 'workspace',
component: 'Workspace',
path: '/workspace',
title: '工作台',
icon: null,
},
{
id: 4,
pid: null,
name: 'FullPath',
path: 'https://www.baidu.com',
component: 'BlankRoute',
title: '跳转百度',
icon: 'LinkOutlined',
},
],
msg: '获取成功',
}
})

View File

@ -0,0 +1,109 @@
export default defineEventHandler((event) => {
return {
code: 200,
data: [
{
id: 1,
pid: null,
path: '/dashboard',
redirect: '/dashboard/analysis',
name: 'Dashboard',
icon: 'AppstoreOutlined',
title: 'pages.dashboard.title',
component: 'RouteView',
},
{
id: 2,
pid: 1,
path: '/dashboard/analysis',
name: 'DashboardAnalysis',
component: 'DashboardAnalysis',
title: 'pages.dashboard.analysis.title',
icon: null,
},
{
id: 3,
pid: 1,
name: 'DashboardWorkspace',
component: 'DashboardWorkspace',
path: '/dashboard/workspace',
title: 'pages.dashboard.workspace.title',
icon: null,
},
{
id: 5,
pid: null,
component: 'RouteView',
name: 'Menu1',
path: '/menu1',
redirect: '/menu1/1-1',
title: 'pages.menu.title',
icon: 'MenuOutlined',
},
{
id: 6,
pid: 5,
name: 'Menu1-1',
component: 'RouteView',
redirect: '/menu1/1-1/1-1-1',
title: 'pages.menu.menu1.title',
path: '/menu1/1-1',
},
{
id: 7,
pid: 6,
name: 'Menu1-1-1',
component: 'Menu11',
title: 'pages.menu.menu11.title',
path: '/menu1/1-1/1-1-1',
keepAlive: false,
},
{
id: 11,
pid: 6,
name: 'Menu1-1-2',
component: 'Menu12',
title: 'pages.menu.menu12.title',
path: '/menu1/1-1/1-1-2',
keepAlive: false,
},
{
id: 8,
pid: null,
name: 'Menu1-2',
path: '/menu1/1-2',
component: 'RouteView',
redirect: '/menu1/1-2/1-2-1',
title: 'pages.menu.menu2.title',
},
{
id: 9,
pid: 8,
name: 'Menu1-2-1',
path: '/menu1/1-2/1-2-1',
component: 'Menu21',
redirect: null,
title: 'pages.menu.menu2.title',
},
{
id: 10,
pid: 8,
name: 'Menu1-2-2',
path: '/menu1/1-2/1-2-2',
component: 'Menu22',
redirect: null,
title: 'pages.menu.menu2.title',
},
{
id: 4,
pid: null,
name: 'FullPath',
path: 'https://www.baidu.com',
component: 'BlankRoute',
title: 'pages.jump.baidu',
icon: 'LinkOutlined',
},
],
msg: '获取成功',
}
})

View File

@ -0,0 +1,9 @@
export default defineEventHandler((event) => {
return {
code: 200,
data: {
code: '123456',
},
msg: '发送成功',
}
})