perf: 还原mock.js
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { faker } from '@faker-js/faker'
|
||||
import Mock from 'mockjs'
|
||||
import { SUCCESS_CODE } from '@/constants'
|
||||
import { toAnyString } from '@/utils'
|
||||
|
||||
@@ -731,7 +731,7 @@ const menus = [
|
||||
component: '#',
|
||||
redirect: '/dashboard/analysis',
|
||||
name: 'Dashboard',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 1,
|
||||
meta: {
|
||||
title: '首页',
|
||||
@@ -743,7 +743,7 @@ const menus = [
|
||||
path: 'analysis',
|
||||
component: 'views/Dashboard/Analysis',
|
||||
name: 'Analysis',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 2,
|
||||
meta: {
|
||||
title: '分析页',
|
||||
@@ -754,7 +754,7 @@ const menus = [
|
||||
path: 'workplace',
|
||||
component: 'views/Dashboard/Workplace',
|
||||
name: 'Workplace',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 3,
|
||||
meta: {
|
||||
title: '工作台',
|
||||
@@ -771,13 +771,13 @@ const menus = [
|
||||
icon: 'clarity:document-solid'
|
||||
},
|
||||
name: 'ExternalLink',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 4,
|
||||
children: [
|
||||
{
|
||||
path: 'https://element-plus-admin-doc.cn/',
|
||||
name: 'DocumentLink',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 5,
|
||||
meta: {
|
||||
title: '文档'
|
||||
@@ -790,7 +790,7 @@ const menus = [
|
||||
component: '#',
|
||||
redirect: '/level/menu1/menu1-1/menu1-1-1',
|
||||
name: 'Level',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 6,
|
||||
meta: {
|
||||
title: '菜单',
|
||||
@@ -801,7 +801,7 @@ const menus = [
|
||||
path: 'menu1',
|
||||
name: 'Menu1',
|
||||
component: '##',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 7,
|
||||
redirect: '/level/menu1/menu1-1/menu1-1-1',
|
||||
meta: {
|
||||
@@ -812,7 +812,7 @@ const menus = [
|
||||
path: 'menu1-1',
|
||||
name: 'Menu11',
|
||||
component: '##',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 8,
|
||||
redirect: '/level/menu1/menu1-1/menu1-1-1',
|
||||
meta: {
|
||||
@@ -824,7 +824,7 @@ const menus = [
|
||||
path: 'menu1-1-1',
|
||||
name: 'Menu111',
|
||||
component: 'views/Level/Menu111',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 9,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -838,7 +838,7 @@ const menus = [
|
||||
path: 'menu1-2',
|
||||
name: 'Menu12',
|
||||
component: 'views/Level/Menu12',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 10,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -852,7 +852,7 @@ const menus = [
|
||||
path: 'menu2',
|
||||
name: 'Menu2Demo',
|
||||
component: 'views/Level/Menu2',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 11,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -867,7 +867,7 @@ const menus = [
|
||||
component: '#',
|
||||
redirect: '/example/example-dialog',
|
||||
name: 'Example',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 12,
|
||||
meta: {
|
||||
title: '综合示例',
|
||||
@@ -879,7 +879,7 @@ const menus = [
|
||||
path: 'example-dialog',
|
||||
component: 'views/Example/Dialog/ExampleDialog',
|
||||
name: 'ExampleDialog',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 13,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -891,7 +891,7 @@ const menus = [
|
||||
path: 'example-page',
|
||||
component: 'views/Example/Page/ExamplePage',
|
||||
name: 'ExamplePage',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 14,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -903,7 +903,7 @@ const menus = [
|
||||
path: 'example-add',
|
||||
component: 'views/Example/Page/ExampleAdd',
|
||||
name: 'ExampleAdd',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 15,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -920,7 +920,7 @@ const menus = [
|
||||
path: 'example-edit',
|
||||
component: 'views/Example/Page/ExampleEdit',
|
||||
name: 'ExampleEdit',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 16,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -937,7 +937,7 @@ const menus = [
|
||||
path: 'example-detail',
|
||||
component: 'views/Example/Page/ExampleDetail',
|
||||
name: 'ExampleDetail',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 17,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -959,7 +959,7 @@ const menus = [
|
||||
component: '#',
|
||||
redirect: '/dashboard/analysis',
|
||||
name: 'Dashboard',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 1,
|
||||
meta: {
|
||||
title: '首页',
|
||||
@@ -971,7 +971,7 @@ const menus = [
|
||||
path: 'analysis',
|
||||
component: 'views/Dashboard/Analysis',
|
||||
name: 'Analysis',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 2,
|
||||
meta: {
|
||||
title: '分析页',
|
||||
@@ -982,7 +982,7 @@ const menus = [
|
||||
path: 'workplace',
|
||||
component: 'views/Dashboard/Workplace',
|
||||
name: 'Workplace',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 3,
|
||||
meta: {
|
||||
title: '工作台',
|
||||
@@ -1001,13 +1001,13 @@ const menus = [
|
||||
icon: 'clarity:document-solid'
|
||||
},
|
||||
name: 'ExternalLink',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 4,
|
||||
children: [
|
||||
{
|
||||
path: 'https://element-plus-admin-doc.cn/',
|
||||
name: 'DocumentLink',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 5,
|
||||
meta: {
|
||||
title: '文档'
|
||||
@@ -1020,7 +1020,7 @@ const menus = [
|
||||
component: '#',
|
||||
redirect: '/level/menu1/menu1-1/menu1-1-1',
|
||||
name: 'Level',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 6,
|
||||
meta: {
|
||||
title: '菜单',
|
||||
@@ -1031,7 +1031,7 @@ const menus = [
|
||||
path: 'menu1',
|
||||
name: 'Menu1',
|
||||
component: '##',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 7,
|
||||
redirect: '/level/menu1/menu1-1/menu1-1-1',
|
||||
meta: {
|
||||
@@ -1042,7 +1042,7 @@ const menus = [
|
||||
path: 'menu1-1',
|
||||
name: 'Menu11',
|
||||
component: '##',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 8,
|
||||
redirect: '/level/menu1/menu1-1/menu1-1-1',
|
||||
meta: {
|
||||
@@ -1054,7 +1054,7 @@ const menus = [
|
||||
path: 'menu1-1-1',
|
||||
name: 'Menu111',
|
||||
component: 'views/Level/Menu111',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 9,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -1068,7 +1068,7 @@ const menus = [
|
||||
path: 'menu1-2',
|
||||
name: 'Menu12',
|
||||
component: 'views/Level/Menu12',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 10,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -1082,7 +1082,7 @@ const menus = [
|
||||
path: 'menu2',
|
||||
name: 'Menu2Demo',
|
||||
component: 'views/Level/Menu2',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 11,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -1099,7 +1099,7 @@ const menus = [
|
||||
component: '#',
|
||||
redirect: '/example/example-dialog',
|
||||
name: 'Example',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 12,
|
||||
meta: {
|
||||
title: '综合示例',
|
||||
@@ -1111,7 +1111,7 @@ const menus = [
|
||||
path: 'example-detail',
|
||||
component: 'views/Example/Page/ExampleDetail',
|
||||
name: 'ExampleDetail',
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
status: Mock.Random.integer(0, 1),
|
||||
id: 17,
|
||||
permission: ['edit', 'add', 'delete'],
|
||||
meta: {
|
||||
@@ -1130,16 +1130,18 @@ const menus = [
|
||||
]
|
||||
|
||||
for (let i = 0; i < 4; i++) {
|
||||
List.push({
|
||||
id: toAnyString(),
|
||||
// timestamp: +Mock.Random.date('T'),
|
||||
roleName: roleNames[i],
|
||||
role: faker.lorem.sentence(1),
|
||||
status: faker.number.int({ min: 0, max: 1 }),
|
||||
createTime: faker.date.anytime(),
|
||||
remark: faker.lorem.sentence(),
|
||||
menu: menus[i]
|
||||
})
|
||||
List.push(
|
||||
Mock.mock({
|
||||
id: toAnyString(),
|
||||
// timestamp: +Mock.Random.date('T'),
|
||||
roleName: roleNames[i],
|
||||
role: '@first',
|
||||
status: Mock.Random.integer(0, 1),
|
||||
createTime: '@datetime',
|
||||
remark: '@cword(10, 15)',
|
||||
menu: menus[i]
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export default [
|
||||
|
||||
Reference in New Issue
Block a user