mirror of
https://github.com/jekip/naive-ui-admin.git
synced 2026-02-04 13:42:27 +08:00
fix Bug or esLink formatting
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';
|
||||
|
||||
const modules = import.meta.globEager('./**/*.ts');
|
||||
|
||||
const mockModules: any[] = [];
|
||||
Object.keys(modules).forEach((key) => {
|
||||
if (key.includes('/_')) {
|
||||
return;
|
||||
}
|
||||
mockModules.push(...modules[key].default);
|
||||
});
|
||||
|
||||
/**
|
||||
* Used in a production environment. Need to manually import all modules
|
||||
*/
|
||||
export function setupProdMockServer() {
|
||||
createProdMockServer(mockModules);
|
||||
}
|
||||
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';
|
||||
|
||||
const modules = import.meta.globEager('./**/*.ts');
|
||||
|
||||
const mockModules: any[] = [];
|
||||
Object.keys(modules).forEach((key) => {
|
||||
if (key.includes('/_')) {
|
||||
return;
|
||||
}
|
||||
mockModules.push(...modules[key].default);
|
||||
});
|
||||
|
||||
/**
|
||||
* Used in a production environment. Need to manually import all modules
|
||||
*/
|
||||
export function setupProdMockServer() {
|
||||
createProdMockServer(mockModules);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import Mock from 'mockjs'
|
||||
import Mock from 'mockjs';
|
||||
|
||||
export function resultSuccess(result, { message = 'ok' } = {}) {
|
||||
return Mock.mock({
|
||||
@@ -50,10 +50,10 @@ export function pagination<T = any>(pageNo: number, pageSize: number, array: T[]
|
||||
* @param {Number} times 回调函数需要执行的次数
|
||||
* @param {Function} callback 回调函数
|
||||
*/
|
||||
export function doCustomTimes (times:number, callback:any) {
|
||||
let i = -1
|
||||
export function doCustomTimes(times: number, callback: any) {
|
||||
let i = -1;
|
||||
while (++i < times) {
|
||||
callback(i)
|
||||
callback(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
import { Random } from 'mockjs'
|
||||
import { resultSuccess } from '../_util'
|
||||
import { Random } from 'mockjs';
|
||||
import { resultSuccess } from '../_util';
|
||||
|
||||
const consoleInfo = {
|
||||
//访问量
|
||||
visits:{
|
||||
dayVisits:Random.float(10000,99999,2,2),
|
||||
rise:Random.float(10,99),
|
||||
decline:Random.float(10,99),
|
||||
amount:Random.float(99999,999999,3,5),
|
||||
visits: {
|
||||
dayVisits: Random.float(10000, 99999, 2, 2),
|
||||
rise: Random.float(10, 99),
|
||||
decline: Random.float(10, 99),
|
||||
amount: Random.float(99999, 999999, 3, 5),
|
||||
},
|
||||
//销售额
|
||||
saleroom:{
|
||||
weekSaleroom:Random.float(10000,99999,2,2),
|
||||
amount:Random.float(99999,999999,2,2),
|
||||
degree:Random.float(10,99)
|
||||
saleroom: {
|
||||
weekSaleroom: Random.float(10000, 99999, 2, 2),
|
||||
amount: Random.float(99999, 999999, 2, 2),
|
||||
degree: Random.float(10, 99),
|
||||
},
|
||||
//订单量
|
||||
orderLarge:{
|
||||
weekLarge:Random.float(10000,99999,2,2),
|
||||
rise:Random.float(10,99),
|
||||
decline:Random.float(10,99),
|
||||
amount:Random.float(99999,999999,2,2),
|
||||
orderLarge: {
|
||||
weekLarge: Random.float(10000, 99999, 2, 2),
|
||||
rise: Random.float(10, 99),
|
||||
decline: Random.float(10, 99),
|
||||
amount: Random.float(99999, 999999, 2, 2),
|
||||
},
|
||||
//成交额度
|
||||
volume:{
|
||||
weekLarge:Random.float(10000,99999,2,2),
|
||||
rise:Random.float(10,99),
|
||||
decline:Random.float(10,99),
|
||||
amount:Random.float(99999,999999,2,2)
|
||||
volume: {
|
||||
weekLarge: Random.float(10000, 99999, 2, 2),
|
||||
rise: Random.float(10, 99),
|
||||
decline: Random.float(10, 99),
|
||||
amount: Random.float(99999, 999999, 2, 2),
|
||||
},
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export default [
|
||||
//主控台 卡片数据
|
||||
@@ -41,7 +40,5 @@ export default [
|
||||
response: () => {
|
||||
return resultSuccess(consoleInfo);
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,93 +1,89 @@
|
||||
import { resultSuccess } from '../_util'
|
||||
import { resultSuccess } from '../_util';
|
||||
|
||||
const menuList = (() => {
|
||||
const result: any[] = [
|
||||
const menuList = () => {
|
||||
const result: any[] = [
|
||||
{
|
||||
label: 'Dashboard',
|
||||
key: 'dashboard',
|
||||
type: 1,
|
||||
subtitle: 'dashboard',
|
||||
openType: 1,
|
||||
auth: 'dashboard',
|
||||
path: '/dashboard',
|
||||
children: [
|
||||
{
|
||||
label: 'Dashboard',
|
||||
key: 'dashboard',
|
||||
type: 1,
|
||||
subtitle:'dashboard',
|
||||
openType:1,
|
||||
auth:'dashboard',
|
||||
path:'/dashboard',
|
||||
children: [
|
||||
{
|
||||
label: '主控台',
|
||||
key: 'console',
|
||||
type: 1,
|
||||
subtitle:'console',
|
||||
openType:1,
|
||||
auth:'console',
|
||||
path:'/dashboard/console',
|
||||
},
|
||||
{
|
||||
label: '工作台',
|
||||
key: 'workplace',
|
||||
type: 1,
|
||||
subtitle:'workplace',
|
||||
openType:1,
|
||||
auth:'workplace',
|
||||
path:'/dashboard/workplace',
|
||||
}
|
||||
]
|
||||
label: '主控台',
|
||||
key: 'console',
|
||||
type: 1,
|
||||
subtitle: 'console',
|
||||
openType: 1,
|
||||
auth: 'console',
|
||||
path: '/dashboard/console',
|
||||
},
|
||||
{
|
||||
label: '表单管理',
|
||||
key: 'form',
|
||||
type: 1,
|
||||
subtitle:'form',
|
||||
openType:1,
|
||||
auth:'form',
|
||||
path:'/form',
|
||||
children: [
|
||||
{
|
||||
label: '基础表单',
|
||||
key: 'basic-form',
|
||||
type: 1,
|
||||
subtitle:'basic-form',
|
||||
openType:1,
|
||||
auth:'basic-form',
|
||||
path:'/form/basic-form',
|
||||
},
|
||||
{
|
||||
label: '分步表单',
|
||||
key: 'step-form',
|
||||
type: 1,
|
||||
subtitle:'step-form',
|
||||
openType:1,
|
||||
auth:'step-form',
|
||||
path:'/form/step-form',
|
||||
},
|
||||
{
|
||||
label: '表单详情',
|
||||
key: 'detail',
|
||||
type: 1,
|
||||
subtitle:'detail',
|
||||
openType:1,
|
||||
auth:'detail',
|
||||
path:'/form/detail',
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
return result
|
||||
});
|
||||
label: '工作台',
|
||||
key: 'workplace',
|
||||
type: 1,
|
||||
subtitle: 'workplace',
|
||||
openType: 1,
|
||||
auth: 'workplace',
|
||||
path: '/dashboard/workplace',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: '表单管理',
|
||||
key: 'form',
|
||||
type: 1,
|
||||
subtitle: 'form',
|
||||
openType: 1,
|
||||
auth: 'form',
|
||||
path: '/form',
|
||||
children: [
|
||||
{
|
||||
label: '基础表单',
|
||||
key: 'basic-form',
|
||||
type: 1,
|
||||
subtitle: 'basic-form',
|
||||
openType: 1,
|
||||
auth: 'basic-form',
|
||||
path: '/form/basic-form',
|
||||
},
|
||||
{
|
||||
label: '分步表单',
|
||||
key: 'step-form',
|
||||
type: 1,
|
||||
subtitle: 'step-form',
|
||||
openType: 1,
|
||||
auth: 'step-form',
|
||||
path: '/form/step-form',
|
||||
},
|
||||
{
|
||||
label: '表单详情',
|
||||
key: 'detail',
|
||||
type: 1,
|
||||
subtitle: 'detail',
|
||||
openType: 1,
|
||||
auth: 'detail',
|
||||
path: '/form/detail',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/menu/list',
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: () => {
|
||||
const list = menuList()
|
||||
return resultSuccess({
|
||||
list
|
||||
}
|
||||
);
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
{
|
||||
url: '/api/menu/list',
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: () => {
|
||||
const list = menuList();
|
||||
return resultSuccess({
|
||||
list,
|
||||
});
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,50 +1,45 @@
|
||||
import { resultSuccess, doCustomTimes } from '../_util'
|
||||
|
||||
import { resultSuccess, doCustomTimes } from '../_util';
|
||||
|
||||
function getMenuKeys() {
|
||||
let keys = ['dashboard', 'console', 'workplace', 'basic-form', 'step-form', 'detail']
|
||||
let newKeys = []
|
||||
doCustomTimes(parseInt(Math.random()*6), () => {
|
||||
let key = keys[Math.floor(Math.random() * keys.length)];
|
||||
newKeys.push(key)
|
||||
})
|
||||
return Array.from(new Set(newKeys));
|
||||
const keys = ['dashboard', 'console', 'workplace', 'basic-form', 'step-form', 'detail'];
|
||||
const newKeys = [];
|
||||
doCustomTimes(parseInt(Math.random() * 6), () => {
|
||||
const key = keys[Math.floor(Math.random() * keys.length)];
|
||||
newKeys.push(key);
|
||||
});
|
||||
return Array.from(new Set(newKeys));
|
||||
}
|
||||
|
||||
const roleList = ((pageSize) => {
|
||||
const result: any[] = []
|
||||
doCustomTimes(pageSize, () => {
|
||||
result.push({
|
||||
id: '@integer(10,100)',
|
||||
name: '@cname()',
|
||||
explain: '@cname()',
|
||||
isDefault: '@boolean()',
|
||||
menu_keys: getMenuKeys(),
|
||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
||||
'status|1': ['normal', 'enable', 'disable'],
|
||||
});
|
||||
})
|
||||
return result
|
||||
});
|
||||
|
||||
const roleList = (pageSize) => {
|
||||
const result: any[] = [];
|
||||
doCustomTimes(pageSize, () => {
|
||||
result.push({
|
||||
id: '@integer(10,100)',
|
||||
name: '@cname()',
|
||||
explain: '@cname()',
|
||||
isDefault: '@boolean()',
|
||||
menu_keys: getMenuKeys(),
|
||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
||||
'status|1': ['normal', 'enable', 'disable'],
|
||||
});
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/role/list',
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: ({ query }) => {
|
||||
const { page = 1, pageSize = 10 } = query;
|
||||
const list = roleList(Number(pageSize))
|
||||
return resultSuccess({
|
||||
page: Number(page),
|
||||
pageSize: Number(pageSize),
|
||||
pageCount: 60,
|
||||
list
|
||||
}
|
||||
);
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
{
|
||||
url: '/api/role/list',
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: ({ query }) => {
|
||||
const { page = 1, pageSize = 10 } = query;
|
||||
const list = roleList(Number(pageSize));
|
||||
return resultSuccess({
|
||||
page: Number(page),
|
||||
pageSize: Number(pageSize),
|
||||
pageCount: 60,
|
||||
list,
|
||||
});
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Random } from 'mockjs'
|
||||
import { resultSuccess, doCustomTimes, resultPageSuccess } from '../_util'
|
||||
import { Random } from 'mockjs';
|
||||
import { resultSuccess, doCustomTimes } from '../_util';
|
||||
|
||||
const tableList = ((pageSize) => {
|
||||
const result:any[] = []
|
||||
doCustomTimes(pageSize,()=> {
|
||||
const tableList = (pageSize) => {
|
||||
const result: any[] = [];
|
||||
doCustomTimes(pageSize, () => {
|
||||
result.push({
|
||||
id: '@integer(10,100)',
|
||||
beginTime: '@datetime',
|
||||
@@ -16,10 +16,9 @@ const tableList = ((pageSize) => {
|
||||
'no|100000-10000000': 100000,
|
||||
'status|1': ['normal', 'enable', 'disable'],
|
||||
});
|
||||
})
|
||||
return result
|
||||
});
|
||||
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
export default [
|
||||
//表格数据列表
|
||||
@@ -29,16 +28,13 @@ export default [
|
||||
method: 'get',
|
||||
response: ({ query }) => {
|
||||
const { page = 1, pageSize = 10 } = query;
|
||||
const list = tableList(Number(pageSize))
|
||||
const list = tableList(Number(pageSize));
|
||||
return resultSuccess({
|
||||
page:Number(page),
|
||||
pageSize:Number(pageSize),
|
||||
page: Number(page),
|
||||
pageSize: Number(pageSize),
|
||||
pageCount: 60,
|
||||
list
|
||||
}
|
||||
);
|
||||
list,
|
||||
});
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,53 +1,52 @@
|
||||
import { MockMethod } from 'vite-plugin-mock'
|
||||
import { resultSuccess, getRequestToken } from '../_util'
|
||||
|
||||
const menusList = [
|
||||
{
|
||||
path: '/dashboard',
|
||||
name: 'Dashboard',
|
||||
component: 'Layout',
|
||||
redirect: '/dashboard/console',
|
||||
meta: {
|
||||
icon: 'DashboardOutlined',
|
||||
title: 'Dashboard',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'console',
|
||||
name: 'dashboard_console',
|
||||
component: 'DashboardConsole',
|
||||
meta: {
|
||||
title: '主控台',
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'monitor',
|
||||
name: 'dashboard_monitor',
|
||||
component: 'DashboardMonitor',
|
||||
meta: {
|
||||
title: '监控页',
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'workplace',
|
||||
name: 'dashboard_workplace',
|
||||
component: 'DashboardWorkplace',
|
||||
meta: {
|
||||
hidden: true,
|
||||
title: '工作台',
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
]
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/menus',
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: () => {
|
||||
return resultSuccess(menusList);
|
||||
},
|
||||
}
|
||||
]
|
||||
import { resultSuccess } from '../_util';
|
||||
|
||||
const menusList = [
|
||||
{
|
||||
path: '/dashboard',
|
||||
name: 'Dashboard',
|
||||
component: 'Layout',
|
||||
redirect: '/dashboard/console',
|
||||
meta: {
|
||||
icon: 'DashboardOutlined',
|
||||
title: 'Dashboard',
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'console',
|
||||
name: 'dashboard_console',
|
||||
component: 'DashboardConsole',
|
||||
meta: {
|
||||
title: '主控台',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'monitor',
|
||||
name: 'dashboard_monitor',
|
||||
component: 'DashboardMonitor',
|
||||
meta: {
|
||||
title: '监控页',
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'workplace',
|
||||
name: 'dashboard_workplace',
|
||||
component: 'DashboardWorkplace',
|
||||
meta: {
|
||||
hidden: true,
|
||||
title: '工作台',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/api/menus',
|
||||
timeout: 1000,
|
||||
method: 'get',
|
||||
response: () => {
|
||||
return resultSuccess(menusList);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import Mock from 'mockjs'
|
||||
import { resultSuccess, getRequestToken } from '../_util'
|
||||
import Mock from 'mockjs';
|
||||
import { resultSuccess } from '../_util';
|
||||
|
||||
const Random = Mock.Random
|
||||
const Random = Mock.Random;
|
||||
|
||||
const token = Random.string('upper', 32, 32)
|
||||
const token = Random.string('upper', 32, 32);
|
||||
|
||||
const adminInfo = {
|
||||
userId: '1',
|
||||
@@ -33,9 +33,9 @@ const adminInfo = {
|
||||
{
|
||||
roleName: '基础列表删除',
|
||||
value: 'basic_list_delete',
|
||||
}
|
||||
},
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
export default [
|
||||
{
|
||||
@@ -56,4 +56,4 @@ export default [
|
||||
return resultSuccess(adminInfo);
|
||||
},
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user