mirror of
https://github.com/chansee97/nova-admin.git
synced 2025-04-06 03:57:54 +08:00
66 lines
1.2 KiB
TypeScript
66 lines
1.2 KiB
TypeScript
import Mock from 'mockjs';
|
|
function resultSuccess(data: any, { msg = 'success' } = {}) {
|
|
return Mock.mock({
|
|
code: 200,
|
|
data,
|
|
msg,
|
|
});
|
|
}
|
|
|
|
const Random = Mock.Random;
|
|
|
|
const token = Random.string('upper', 32, 32);
|
|
|
|
const adminInfo = {
|
|
userId: '1',
|
|
username: 'admin',
|
|
realName: 'Admin',
|
|
avatar: Random.image(),
|
|
desc: 'manager',
|
|
password: Random.string('upper', 4, 16),
|
|
token,
|
|
permissions: [
|
|
{
|
|
label: '主控台',
|
|
value: 'dashboard_console',
|
|
},
|
|
{
|
|
label: '监控页',
|
|
value: 'dashboard_monitor',
|
|
},
|
|
{
|
|
label: '工作台',
|
|
value: 'dashboard_workplace',
|
|
},
|
|
{
|
|
label: '基础列表',
|
|
value: 'basic_list',
|
|
},
|
|
{
|
|
label: '基础列表删除',
|
|
value: 'basic_list_delete',
|
|
},
|
|
],
|
|
};
|
|
|
|
export default [
|
|
{
|
|
url: '/mock/login',
|
|
timeout: 1000,
|
|
method: 'post',
|
|
response: () => {
|
|
return resultSuccess({ token });
|
|
},
|
|
},
|
|
{
|
|
url: '/mock/admin_info',
|
|
timeout: 1000,
|
|
method: 'get',
|
|
response: () => {
|
|
// const token = getRequestToken(request);
|
|
// if (!token) return resultError('Invalid token');
|
|
return resultSuccess(adminInfo);
|
|
},
|
|
},
|
|
];
|