mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-11-22 02:23:37 +08:00
feat: 搜索用户和用户详情 搭建
This commit is contained in:
@@ -1,36 +1,36 @@
|
||||
// 根据角色动态生成路由
|
||||
import { MockMethod } from "vite-plugin-mock";
|
||||
import { MockMethod } from 'vite-plugin-mock'
|
||||
|
||||
export default [
|
||||
{
|
||||
url: "/login",
|
||||
method: "post",
|
||||
url: '/login',
|
||||
method: 'post',
|
||||
response: ({ body }) => {
|
||||
if (body.username === "admin") {
|
||||
if (body.username === 'admin') {
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
username: "admin",
|
||||
username: 'admin',
|
||||
// 一个用户可能有多个角色
|
||||
roles: ["admin"],
|
||||
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin",
|
||||
refreshToken: "eyJhbGciOiJIUzUxMiJ9.adminRefresh",
|
||||
expires: "2023/10/30 00:00:00"
|
||||
roles: ['admin'],
|
||||
accessToken: 'eyJhbGciOiJIUzUxMiJ9.admin',
|
||||
refreshToken: 'eyJhbGciOiJIUzUxMiJ9.adminRefresh',
|
||||
expires: '2023/10/30 00:00:00'
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
username: "common",
|
||||
username: 'common',
|
||||
// 一个用户可能有多个角色
|
||||
roles: ["common"],
|
||||
accessToken: "eyJhbGciOiJIUzUxMiJ9.common",
|
||||
refreshToken: "eyJhbGciOiJIUzUxMiJ9.commonRefresh",
|
||||
expires: "2023/10/30 00:00:00"
|
||||
roles: ['common'],
|
||||
accessToken: 'eyJhbGciOiJIUzUxMiJ9.common',
|
||||
refreshToken: 'eyJhbGciOiJIUzUxMiJ9.commonRefresh',
|
||||
expires: '2023/10/30 00:00:00'
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
] as MockMethod[];
|
||||
] as MockMethod[]
|
||||
|
||||
78
mock/playerData.ts
Normal file
78
mock/playerData.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import { MockMethod } from 'vite-plugin-mock'
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/dev-api/getCurrentDayData',
|
||||
method: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
active_count: 12398,
|
||||
play_count: 123,
|
||||
register_count: 222,
|
||||
channel: 'PC',
|
||||
nlh_player: 98,
|
||||
plo4_player: 715,
|
||||
plo5_player: 123,
|
||||
plo6_player: 123
|
||||
},
|
||||
{
|
||||
active_count: 23,
|
||||
play_count: 212,
|
||||
register_count: 253,
|
||||
channel: 'IOS',
|
||||
nlh_player: 254,
|
||||
plo4_player: 2213,
|
||||
plo5_player: 2123,
|
||||
plo6_player: 512
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
url: '/getHistoricalData',
|
||||
method: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
play_account: 2132,
|
||||
register_account: 232,
|
||||
active_account: 2123,
|
||||
channel: 'PC'
|
||||
},
|
||||
{
|
||||
play_account: 21232,
|
||||
register_account: 12313,
|
||||
active_account: 67123,
|
||||
channel: 'IOS'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
url: '/snow/getUserData',
|
||||
method: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
success: true,
|
||||
data: [
|
||||
{
|
||||
username: 2132,
|
||||
club_name: '12123',
|
||||
channel: 'PC',
|
||||
mobile: 'P123123213123',
|
||||
area: 'beijing',
|
||||
last_login_date: '2023/12/12',
|
||||
last_area: 'beijing'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
] as MockMethod[]
|
||||
@@ -1,27 +1,27 @@
|
||||
import { MockMethod } from "vite-plugin-mock";
|
||||
import { MockMethod } from 'vite-plugin-mock'
|
||||
|
||||
// 模拟刷新token接口
|
||||
export default [
|
||||
{
|
||||
url: "/refreshToken",
|
||||
method: "post",
|
||||
url: '/refreshToken',
|
||||
method: 'post',
|
||||
response: ({ body }) => {
|
||||
if (body.refreshToken) {
|
||||
return {
|
||||
success: true,
|
||||
data: {
|
||||
accessToken: "eyJhbGciOiJIUzUxMiJ9.newAdmin",
|
||||
refreshToken: "eyJhbGciOiJIUzUxMiJ9.newAdminRefresh",
|
||||
accessToken: 'eyJhbGciOiJIUzUxMiJ9.newAdmin',
|
||||
refreshToken: 'eyJhbGciOiJIUzUxMiJ9.newAdminRefresh',
|
||||
// `expires`选择这种日期格式是为了方便调试,后端直接设置时间戳或许更方便(每次都应该递增)。如果后端返回的是时间戳格式,前端开发请来到这个目录`src/utils/auth.ts`,把第`38`行的代码换成expires = data.expires即可。
|
||||
expires: "2023/10/30 23:59:59"
|
||||
expires: '2023/10/30 23:59:59'
|
||||
}
|
||||
};
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
success: false,
|
||||
data: {}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
] as MockMethod[];
|
||||
] as MockMethod[]
|
||||
|
||||
Reference in New Issue
Block a user