mock false
This commit is contained in:
parent
a8a6577f9a
commit
91056ecc30
@ -5,7 +5,7 @@ VITE_PORT = 8001
|
|||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# 是否开启mock
|
# 是否开启mock
|
||||||
VITE_USE_MOCK = true
|
VITE_USE_MOCK = false
|
||||||
|
|
||||||
# 网站前缀
|
# 网站前缀
|
||||||
VITE_BASE_URL = /
|
VITE_BASE_URL = /
|
||||||
@ -16,6 +16,7 @@ VITE_DROP_CONSOLE = true
|
|||||||
# 跨域代理,可以配置多个,请注意不要换行
|
# 跨域代理,可以配置多个,请注意不要换行
|
||||||
#VITE_PROXY = [["/appApi","http://localhost:8001"],["/upload","http://localhost:8001/upload"]]
|
#VITE_PROXY = [["/appApi","http://localhost:8001"],["/upload","http://localhost:8001/upload"]]
|
||||||
# VITE_PROXY=[["/api","https://naive-ui-admin"]]
|
# VITE_PROXY=[["/api","https://naive-ui-admin"]]
|
||||||
|
VITE_PROXY=[["/api","http://192.168.124.203:8081/api"]]
|
||||||
|
|
||||||
# API 接口地址
|
# API 接口地址
|
||||||
VITE_GLOB_API_URL =
|
VITE_GLOB_API_URL =
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
# 是否开启mock
|
# 是否开启mock
|
||||||
VITE_USE_MOCK = true
|
VITE_USE_MOCK = false
|
||||||
|
|
||||||
# 网站根目录
|
# 网站根目录
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ dist_electron
|
|||||||
# local env files
|
# local env files
|
||||||
.env.local
|
.env.local
|
||||||
.env.*.local
|
.env.*.local
|
||||||
|
.history
|
||||||
|
|
||||||
# Log files
|
# Log files
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';
|
|
||||||
|
|
||||||
const modules: any = import.meta.glob('./**/*.ts', { eager: true });
|
|
||||||
|
|
||||||
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,73 +0,0 @@
|
|||||||
import Mock from 'mockjs';
|
|
||||||
|
|
||||||
export function resultSuccess(result, { message = 'ok' } = {}) {
|
|
||||||
return Mock.mock({
|
|
||||||
code: 200,
|
|
||||||
result,
|
|
||||||
message,
|
|
||||||
type: 'success',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function resultPageSuccess<T = any>(
|
|
||||||
page: number,
|
|
||||||
pageSize: number,
|
|
||||||
list: T[],
|
|
||||||
{ message = 'ok' } = {},
|
|
||||||
) {
|
|
||||||
const pageData = pagination(page, pageSize, list);
|
|
||||||
|
|
||||||
return {
|
|
||||||
...resultSuccess({
|
|
||||||
page,
|
|
||||||
pageSize,
|
|
||||||
pageCount: list.length,
|
|
||||||
list: pageData,
|
|
||||||
}),
|
|
||||||
message,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function resultError(message = 'Request failed', { code = -1, result = null } = {}) {
|
|
||||||
return {
|
|
||||||
code,
|
|
||||||
result,
|
|
||||||
message,
|
|
||||||
type: 'error',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function pagination<T = any>(pageNo: number, pageSize: number, array: T[]): T[] {
|
|
||||||
const offset = (pageNo - 1) * Number(pageSize);
|
|
||||||
const ret =
|
|
||||||
offset + Number(pageSize) >= array.length
|
|
||||||
? array.slice(offset, array.length)
|
|
||||||
: array.slice(offset, offset + Number(pageSize));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Number} times 回调函数需要执行的次数
|
|
||||||
* @param {Function} callback 回调函数
|
|
||||||
*/
|
|
||||||
export function doCustomTimes(times: number, callback: any) {
|
|
||||||
let i = -1;
|
|
||||||
while (++i < times) {
|
|
||||||
callback(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface requestParams {
|
|
||||||
method: string;
|
|
||||||
body: any;
|
|
||||||
headers?: { token?: string };
|
|
||||||
query: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description 本函数用于从request数据中获取token,请根据项目的实际情况修改
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export function getRequestToken({ headers }: requestParams): string | undefined {
|
|
||||||
return headers?.token;
|
|
||||||
}
|
|
||||||
@ -1,44 +0,0 @@
|
|||||||
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),
|
|
||||||
},
|
|
||||||
//销售额
|
|
||||||
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),
|
|
||||||
},
|
|
||||||
//成交额度
|
|
||||||
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 [
|
|
||||||
//主控台 卡片数据
|
|
||||||
{
|
|
||||||
url: '/api/dashboard/console',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(consoleInfo);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,153 +0,0 @@
|
|||||||
import { resultSuccess } from '../_util';
|
|
||||||
|
|
||||||
const regionList = [
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '广东省',
|
|
||||||
parentId: null,
|
|
||||||
depth: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '江西省',
|
|
||||||
parentId: null,
|
|
||||||
depth: 1,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '浙江省',
|
|
||||||
parentId: null,
|
|
||||||
depth: 1,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const subRegionList = [
|
|
||||||
{
|
|
||||||
id: 11,
|
|
||||||
name: '深圳市',
|
|
||||||
parentId: 1,
|
|
||||||
depth: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 111,
|
|
||||||
name: '宝安区',
|
|
||||||
parentId: 11,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 112,
|
|
||||||
name: '南山区',
|
|
||||||
parentId: 11,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 22,
|
|
||||||
name: '广州市',
|
|
||||||
parentId: 1,
|
|
||||||
depth: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 221,
|
|
||||||
name: '花都区',
|
|
||||||
parentId: 22,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 222,
|
|
||||||
name: '白云区',
|
|
||||||
parentId: 22,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 33,
|
|
||||||
name: '萍乡市',
|
|
||||||
parentId: 2,
|
|
||||||
depth: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 331,
|
|
||||||
name: '上栗县',
|
|
||||||
parentId: 33,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 332,
|
|
||||||
name: '安源区',
|
|
||||||
parentId: 33,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 44,
|
|
||||||
name: '宜春市',
|
|
||||||
parentId: 2,
|
|
||||||
depth: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 441,
|
|
||||||
name: '袁州区',
|
|
||||||
parentId: 44,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 442,
|
|
||||||
name: '上高县',
|
|
||||||
parentId: 44,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 55,
|
|
||||||
name: '杭州市',
|
|
||||||
parentId: 3,
|
|
||||||
depth: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 551,
|
|
||||||
name: '上城区',
|
|
||||||
parentId: 55,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 552,
|
|
||||||
name: '下城区',
|
|
||||||
parentId: 55,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 66,
|
|
||||||
name: '温州市',
|
|
||||||
parentId: 3,
|
|
||||||
depth: 2,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 661,
|
|
||||||
name: '龙湾区',
|
|
||||||
parentId: 66,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 662,
|
|
||||||
name: '平阳县',
|
|
||||||
parentId: 66,
|
|
||||||
depth: 3,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: '/api/area/getParent',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(regionList);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: '/api/area/findByParentId',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: ({ query }) => {
|
|
||||||
const { parentId } = query;
|
|
||||||
return resultSuccess(subRegionList.filter((item) => item.parentId === parseInt(parentId)));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
import { resultSuccess } from '../_util';
|
|
||||||
|
|
||||||
const classifyList = [
|
|
||||||
{
|
|
||||||
label: '新品',
|
|
||||||
value: 'new',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '爆款',
|
|
||||||
value: 'hot',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '推荐',
|
|
||||||
value: 'rec',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '促销',
|
|
||||||
value: 'promotion',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: '/api/classifyList',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(classifyList);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,151 +0,0 @@
|
|||||||
import { resultSuccess } from '../_util';
|
|
||||||
|
|
||||||
const dictionaryList = [
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
label: '预约事项',
|
|
||||||
key: 'makeMatter',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
label: '初次预约',
|
|
||||||
key: 'theMake',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
label: '多次预约',
|
|
||||||
key: 'towMake',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
label: '注册来源',
|
|
||||||
key: 'registeredSource',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const dictionaryItems = () => {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
key: 'registeredSource',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
value: 'baidu',
|
|
||||||
label: '百度',
|
|
||||||
'order|1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
value: 'weibo',
|
|
||||||
label: '微博',
|
|
||||||
'order|1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
value: 'weixin',
|
|
||||||
label: '微信',
|
|
||||||
'order|1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'theMake',
|
|
||||||
parentKey: 'makeMatter',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
value: 'examine',
|
|
||||||
label: '检查',
|
|
||||||
'order|1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
value: 'tooth',
|
|
||||||
label: '拔牙',
|
|
||||||
'order|1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'towMake',
|
|
||||||
parentKey: 'makeMatter',
|
|
||||||
values: [
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
value: 'take',
|
|
||||||
label: '拆线',
|
|
||||||
'order|1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
value: 'periodontal',
|
|
||||||
label: '牙周',
|
|
||||||
'order|1': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
const dictionaryInfo = (_, key: string) => {
|
|
||||||
const list: any[] = [];
|
|
||||||
dictionaryItems().forEach((item: any) => {
|
|
||||||
if (item.key === key || item.parentKey === key) {
|
|
||||||
list.push(item as any);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const valuesList: any[] = [];
|
|
||||||
list.forEach((item: any) => {
|
|
||||||
item.values.map((values) => {
|
|
||||||
valuesList.push(values);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return valuesList;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default [
|
|
||||||
//字典列表
|
|
||||||
{
|
|
||||||
url: '/api/dictionary/list',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess(dictionaryList);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
//字典详情
|
|
||||||
{
|
|
||||||
url: '/api/dictionary/info',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: ({ query }) => {
|
|
||||||
const { page = 1, pageSize = 10, key, keywords } = query;
|
|
||||||
let list = dictionaryInfo(Number(pageSize), key);
|
|
||||||
//实现搜索筛选
|
|
||||||
if (keywords) {
|
|
||||||
list = list.filter((item) => {
|
|
||||||
return item.label.indexOf(keywords) != -1;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
const count =
|
|
||||||
list.length > Number(pageSize) ? Math.ceil(list.length / Number(pageSize)) : list.length;
|
|
||||||
const itemCount = count > Number(pageSize) ? count * Number(pageSize) : count;
|
|
||||||
return resultSuccess({
|
|
||||||
page: Number(page),
|
|
||||||
pageSize: Number(pageSize),
|
|
||||||
pageCount: count,
|
|
||||||
itemCount,
|
|
||||||
list,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,96 +0,0 @@
|
|||||||
import { resultSuccess } from '../_util';
|
|
||||||
|
|
||||||
const menuList = () => {
|
|
||||||
const result: any[] = [
|
|
||||||
{
|
|
||||||
label: 'Dashboard',
|
|
||||||
key: 'dashboard',
|
|
||||||
type: 1,
|
|
||||||
subtitle: 'dashboard',
|
|
||||||
openType: 1,
|
|
||||||
auth: 'dashboard',
|
|
||||||
path: '/dashboard',
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: '主控台',
|
|
||||||
key: 'console',
|
|
||||||
type: 1,
|
|
||||||
subtitle: 'console',
|
|
||||||
openType: 1,
|
|
||||||
auth: 'console',
|
|
||||||
path: '/dashboard/console',
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '工作台',
|
|
||||||
key: 'workplace',
|
|
||||||
type: 1,
|
|
||||||
subtitle: 'workplace',
|
|
||||||
openType: 1,
|
|
||||||
auth: 'workplace',
|
|
||||||
path: '/dashboard/workplace',
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '表单管理',
|
|
||||||
key: 'form',
|
|
||||||
type: 1,
|
|
||||||
subtitle: 'form',
|
|
||||||
openType: 1,
|
|
||||||
auth: 'form',
|
|
||||||
path: '/form',
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: '基础表单',
|
|
||||||
key: 'basic-form',
|
|
||||||
type: 1,
|
|
||||||
subtitle: 'basic-form',
|
|
||||||
openType: 1,
|
|
||||||
auth: 'basic-form',
|
|
||||||
path: '/form/basic-form',
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '分步表单',
|
|
||||||
key: 'step-form',
|
|
||||||
type: 1,
|
|
||||||
subtitle: 'step-form',
|
|
||||||
openType: 1,
|
|
||||||
auth: 'step-form',
|
|
||||||
path: '/form/step-form',
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '表单详情',
|
|
||||||
key: 'detail',
|
|
||||||
type: 1,
|
|
||||||
subtitle: 'detail',
|
|
||||||
openType: 1,
|
|
||||||
auth: 'detail',
|
|
||||||
path: '/form/detail',
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: '/api/menu/list',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: () => {
|
|
||||||
const list = menuList();
|
|
||||||
return resultSuccess({
|
|
||||||
list,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
import { resultSuccess, doCustomTimes } from '../_util';
|
|
||||||
|
|
||||||
function getMenuKeys() {
|
|
||||||
const keys = ['dashboard', 'console', 'workplace', 'basic-form', 'step-form', 'detail'];
|
|
||||||
const newKeys: string[] = [];
|
|
||||||
doCustomTimes(parseInt(Math.random() * 6), () => {
|
|
||||||
const key: string = 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;
|
|
||||||
};
|
|
||||||
|
|
||||||
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: 30,
|
|
||||||
itemCount: 30 * Number(pageSize),
|
|
||||||
list,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
import { Random } from 'mockjs';
|
|
||||||
import { resultSuccess, doCustomTimes } from '../_util';
|
|
||||||
|
|
||||||
const tableList = (pageSize) => {
|
|
||||||
const result: any[] = [];
|
|
||||||
doCustomTimes(pageSize, () => {
|
|
||||||
result.push({
|
|
||||||
id: '@integer(10,999999)',
|
|
||||||
'no|100000-10000000': 100000,
|
|
||||||
name: '@cname()',
|
|
||||||
avatar: Random.image('400x400', Random.color(), Random.color(), Random.first()),
|
|
||||||
address: '@city()',
|
|
||||||
beginTime: '@datetime',
|
|
||||||
endTime: '@datetime',
|
|
||||||
'status|1': [true, false],
|
|
||||||
date: `@date('yyyy-MM-dd')`,
|
|
||||||
time: `@time('HH:mm')`,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default [
|
|
||||||
//表格数据列表
|
|
||||||
{
|
|
||||||
url: '/api/table/list',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: ({ query }) => {
|
|
||||||
const { page = 1, pageSize = 10, name } = query;
|
|
||||||
const list = tableList(Number(pageSize));
|
|
||||||
//并非真实,只是为了模拟搜索结果
|
|
||||||
const count = name ? 30 : 60;
|
|
||||||
return resultSuccess({
|
|
||||||
page: Number(page),
|
|
||||||
pageSize: Number(pageSize),
|
|
||||||
pageCount: count,
|
|
||||||
itemCount: count * Number(pageSize),
|
|
||||||
list,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,269 +0,0 @@
|
|||||||
import { resultSuccess } from '../_util';
|
|
||||||
|
|
||||||
const tableList = (page) => {
|
|
||||||
return page === 1
|
|
||||||
? [
|
|
||||||
{
|
|
||||||
id: 659962,
|
|
||||||
no: 6965078,
|
|
||||||
name: '文洋',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/79f29b/f27979&text=Joseph',
|
|
||||||
address: '台北市',
|
|
||||||
beginTime: '1982-08-20 04:10:02',
|
|
||||||
endTime: '1975-01-12 02:09:40',
|
|
||||||
status: false,
|
|
||||||
date: '1984-11-08',
|
|
||||||
time: '21:40',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 818440,
|
|
||||||
no: 2032345,
|
|
||||||
name: '冯涛',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/799df2/c0f279&text=Donna',
|
|
||||||
address: '九龙',
|
|
||||||
beginTime: '1991-12-29 20:44:54',
|
|
||||||
endTime: '2002-05-27 12:09:35',
|
|
||||||
status: false,
|
|
||||||
date: '1993-11-04',
|
|
||||||
time: '18:56',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 212788,
|
|
||||||
no: 9668086,
|
|
||||||
name: '卢桂英',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/f279e3/79f2dd&text=Sarah',
|
|
||||||
address: '毕节市',
|
|
||||||
beginTime: '2006-02-04 17:37:27',
|
|
||||||
endTime: '2007-03-13 12:15:59',
|
|
||||||
status: false,
|
|
||||||
date: '1984-05-07',
|
|
||||||
time: '13:47',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 23986,
|
|
||||||
no: 6841254,
|
|
||||||
name: '董秀英',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/f2ba79/9679f2&text=Deborah',
|
|
||||||
address: '香港岛',
|
|
||||||
beginTime: '2016-03-28 12:39:23',
|
|
||||||
endTime: '1990-08-19 05:20:46',
|
|
||||||
status: true,
|
|
||||||
date: '1997-04-20',
|
|
||||||
time: '05:26',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 318041,
|
|
||||||
no: 1476802,
|
|
||||||
name: '周秀兰',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/7ef279/f279a2&text=Laura',
|
|
||||||
address: '阿里地区',
|
|
||||||
beginTime: '2016-08-04 23:48:29',
|
|
||||||
endTime: '2005-05-02 09:28:46',
|
|
||||||
status: true,
|
|
||||||
date: '1997-11-14',
|
|
||||||
time: '13:42',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 228323,
|
|
||||||
no: 8883045,
|
|
||||||
name: '吕超',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/79c5f2/e8f279&text=Linda',
|
|
||||||
address: '内江市',
|
|
||||||
beginTime: '1989-02-22 14:08:54',
|
|
||||||
endTime: '2009-10-30 23:04:49',
|
|
||||||
status: true,
|
|
||||||
date: '2016-07-19',
|
|
||||||
time: '05:51',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 5347,
|
|
||||||
no: 7551218,
|
|
||||||
name: '黎丽',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/d879f2/79f2b4&text=William',
|
|
||||||
address: '辽源市',
|
|
||||||
beginTime: '1974-07-29 13:43:47',
|
|
||||||
endTime: '2012-08-27 23:27:05',
|
|
||||||
status: true,
|
|
||||||
date: '1976-07-14',
|
|
||||||
time: '22:50',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 287642,
|
|
||||||
no: 4410781,
|
|
||||||
name: '孙秀兰',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/f29179/7984f2&text=Gary',
|
|
||||||
address: '汉中市',
|
|
||||||
beginTime: '1979-12-06 09:22:28',
|
|
||||||
endTime: '1972-06-20 02:53:21',
|
|
||||||
status: false,
|
|
||||||
date: '1988-01-01',
|
|
||||||
time: '00:01',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 352276,
|
|
||||||
no: 1342992,
|
|
||||||
name: '谢涛',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/a7f279/f279ca&text=Daniel',
|
|
||||||
address: '苏州市',
|
|
||||||
beginTime: '2019-10-29 20:53:32',
|
|
||||||
endTime: '1977-09-17 01:41:39',
|
|
||||||
status: true,
|
|
||||||
date: '1970-06-09',
|
|
||||||
time: '22:39',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 509832,
|
|
||||||
no: 8171697,
|
|
||||||
name: '邵杰',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/79eef2/f2d379&text=Paul',
|
|
||||||
address: '巢湖市',
|
|
||||||
beginTime: '1994-04-07 06:46:03',
|
|
||||||
endTime: '1974-03-16 01:28:24',
|
|
||||||
status: false,
|
|
||||||
date: '1988-11-11',
|
|
||||||
time: '19:10',
|
|
||||||
},
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
{
|
|
||||||
id: 601173,
|
|
||||||
no: 9911085,
|
|
||||||
name: '乔涛',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/79e3f2/f2dd79&text=Jennifer',
|
|
||||||
address: '阳泉市',
|
|
||||||
beginTime: '1997-03-14 06:52:04',
|
|
||||||
endTime: '1989-05-23 13:14:14',
|
|
||||||
status: false,
|
|
||||||
date: '1988-12-15',
|
|
||||||
time: '04:42',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 328638,
|
|
||||||
no: 720053,
|
|
||||||
name: '郝明',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/ba79f2/79f296&text=Anthony',
|
|
||||||
address: '吴忠市',
|
|
||||||
beginTime: '1991-09-19 21:15:47',
|
|
||||||
endTime: '1977-04-04 06:45:09',
|
|
||||||
status: false,
|
|
||||||
date: '2014-08-30',
|
|
||||||
time: '14:41',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 274363,
|
|
||||||
no: 3776909,
|
|
||||||
name: '贾洋',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/f2797e/79a2f2&text=Sandra',
|
|
||||||
address: '吉安市',
|
|
||||||
beginTime: '2011-06-06 01:50:26',
|
|
||||||
endTime: '2000-03-29 13:02:10',
|
|
||||||
status: true,
|
|
||||||
date: '1985-11-10',
|
|
||||||
time: '01:11',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 627841,
|
|
||||||
no: 4226993,
|
|
||||||
name: '尹磊',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/c5f279/f279e8&text=Ruth',
|
|
||||||
address: '新界',
|
|
||||||
beginTime: '1972-01-22 02:49:21',
|
|
||||||
endTime: '1994-12-10 14:33:11',
|
|
||||||
status: true,
|
|
||||||
date: '2017-05-29',
|
|
||||||
time: '18:28',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 853120,
|
|
||||||
no: 8772153,
|
|
||||||
name: '尹静',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/79f2d8/f2b579&text=Lisa',
|
|
||||||
address: '抚顺市',
|
|
||||||
beginTime: '2018-10-31 07:40:52',
|
|
||||||
endTime: '2011-08-24 18:50:10',
|
|
||||||
status: true,
|
|
||||||
date: '1984-10-09',
|
|
||||||
time: '06:00',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 973847,
|
|
||||||
no: 8594801,
|
|
||||||
name: '毛涛',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/9179f2/83f279&text=Maria',
|
|
||||||
address: '钦州市',
|
|
||||||
beginTime: '1970-05-10 20:00:00',
|
|
||||||
endTime: '1986-12-10 12:23:18',
|
|
||||||
status: true,
|
|
||||||
date: '1981-01-31',
|
|
||||||
time: '09:39',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 366765,
|
|
||||||
no: 9291682,
|
|
||||||
name: '方秀英',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/f279a7/79caf2&text=Laura',
|
|
||||||
address: '昌都地区',
|
|
||||||
beginTime: '1980-05-12 22:54:51',
|
|
||||||
endTime: '1998-11-13 16:11:40',
|
|
||||||
status: true,
|
|
||||||
date: '1996-02-23',
|
|
||||||
time: '00:33',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 145082,
|
|
||||||
no: 4062636,
|
|
||||||
name: '范艳',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/edf279/d379f2&text=Angela',
|
|
||||||
address: '连江县',
|
|
||||||
beginTime: '2001-03-19 23:58:41',
|
|
||||||
endTime: '2003-02-02 07:36:33',
|
|
||||||
status: false,
|
|
||||||
date: '2018-03-01',
|
|
||||||
time: '11:44',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 175542,
|
|
||||||
no: 9194674,
|
|
||||||
name: '刘秀英',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/79f2af/f28c79&text=Maria',
|
|
||||||
address: '唐山市',
|
|
||||||
beginTime: '2018-05-07 16:06:35',
|
|
||||||
endTime: '2000-04-26 12:54:37',
|
|
||||||
status: false,
|
|
||||||
date: '1999-07-16',
|
|
||||||
time: '15:37',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 647222,
|
|
||||||
no: 3466012,
|
|
||||||
name: '尹艳',
|
|
||||||
avatar: 'http://dummyimage.com/400x400/7989f2/acf279&text=Brenda',
|
|
||||||
address: '离岛',
|
|
||||||
beginTime: '1994-12-25 10:58:49',
|
|
||||||
endTime: '1978-05-31 23:23:37',
|
|
||||||
status: false,
|
|
||||||
date: '2018-10-16',
|
|
||||||
time: '19:58',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
export default [
|
|
||||||
//表格数据列表
|
|
||||||
{
|
|
||||||
url: '/api/table/select',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: ({ query }) => {
|
|
||||||
const { page = 1, pageSize = 3 } = query;
|
|
||||||
const list = tableList(Number(page));
|
|
||||||
return resultSuccess({
|
|
||||||
page: Number(page),
|
|
||||||
pageSize: Number(pageSize),
|
|
||||||
pageCount: 2,
|
|
||||||
itemCount: 20,
|
|
||||||
list,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,130 +0,0 @@
|
|||||||
import { resultSuccess } from '../_util';
|
|
||||||
|
|
||||||
//超级管理员
|
|
||||||
const adminMenusList = [
|
|
||||||
{
|
|
||||||
path: '/dashboard',
|
|
||||||
name: 'Dashboard',
|
|
||||||
component: 'LAYOUT',
|
|
||||||
redirect: '/dashboard/console',
|
|
||||||
meta: {
|
|
||||||
icon: 'DashboardOutlined',
|
|
||||||
title: 'Dashboard',
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'console',
|
|
||||||
name: 'dashboard_console',
|
|
||||||
component: '/dashboard/console/console',
|
|
||||||
meta: {
|
|
||||||
title: '主控台',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'monitor',
|
|
||||||
name: 'dashboard_monitor',
|
|
||||||
component: '/dashboard/monitor/monitor',
|
|
||||||
meta: {
|
|
||||||
title: '监控页',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'workplace',
|
|
||||||
name: 'dashboard_workplace',
|
|
||||||
component: '/dashboard/workplace/workplace',
|
|
||||||
meta: {
|
|
||||||
hidden: true,
|
|
||||||
title: '工作台',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/list',
|
|
||||||
name: 'List',
|
|
||||||
component: 'LAYOUT',
|
|
||||||
redirect: '/list/basic-list',
|
|
||||||
meta: {
|
|
||||||
icon: 'TableOutlined',
|
|
||||||
title: '列表页面',
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'basic-list',
|
|
||||||
name: 'basic-list',
|
|
||||||
component: '/list/basicList/index',
|
|
||||||
meta: {
|
|
||||||
title: '基础列表',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
//普通管理员
|
|
||||||
const ordinaryMenusList = [
|
|
||||||
{
|
|
||||||
path: '/dashboard',
|
|
||||||
name: 'Dashboard',
|
|
||||||
component: 'LAYOUT',
|
|
||||||
redirect: '/dashboard/console',
|
|
||||||
meta: {
|
|
||||||
icon: 'DashboardOutlined',
|
|
||||||
title: 'Dashboard',
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: 'console',
|
|
||||||
name: 'dashboard_console',
|
|
||||||
component: '/dashboard/console/console',
|
|
||||||
meta: {
|
|
||||||
title: '主控台',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'monitor',
|
|
||||||
name: 'dashboard_monitor',
|
|
||||||
component: '/dashboard/monitor/monitor',
|
|
||||||
meta: {
|
|
||||||
title: '监控页',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'workplace',
|
|
||||||
name: 'dashboard_workplace',
|
|
||||||
component: '/dashboard/workplace/workplace',
|
|
||||||
meta: {
|
|
||||||
hidden: true,
|
|
||||||
title: '工作台',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const menuTableList = [
|
|
||||||
{
|
|
||||||
name: '',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: '/api/menus',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: () => {
|
|
||||||
//此处随机了,为了模拟不同角色权限
|
|
||||||
const randomNum = Math.floor(Math.random() * 2 + 1);
|
|
||||||
return randomNum === 1 ? resultSuccess(adminMenusList) : resultSuccess(ordinaryMenusList);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: '/api/menu/table',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: () => {
|
|
||||||
resultSuccess(menuTableList);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
import Mock from 'mockjs';
|
|
||||||
import { resultSuccess, doCustomTimes } from '../_util';
|
|
||||||
|
|
||||||
const Random = Mock.Random;
|
|
||||||
|
|
||||||
const token = Random.string('upper', 32, 32);
|
|
||||||
|
|
||||||
//超级管理员
|
|
||||||
const adminPermissions = [
|
|
||||||
{
|
|
||||||
label: '主控台',
|
|
||||||
value: 'dashboard_console',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '监控页',
|
|
||||||
value: 'dashboard_monitor',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '工作台',
|
|
||||||
value: 'dashboard_workplace',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '基础列表',
|
|
||||||
value: 'basic_list',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除用户',
|
|
||||||
value: 'delete_user',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
//普通管理员
|
|
||||||
const ordinaryPermissions = [
|
|
||||||
{
|
|
||||||
label: '主控台',
|
|
||||||
value: 'dashboard_console',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '监控页',
|
|
||||||
value: 'dashboard_monitor',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '工作台',
|
|
||||||
value: 'dashboard_workplace',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
const adminInfo = {
|
|
||||||
userId: '1',
|
|
||||||
username: 'admin',
|
|
||||||
realName: 'Admin',
|
|
||||||
avatar: Random.image(),
|
|
||||||
desc: 'manager',
|
|
||||||
password: Random.string('upper', 4, 16),
|
|
||||||
token,
|
|
||||||
role_type: 1, // 1 超级管理员 2 普通管理员
|
|
||||||
permissions: [], // 权限集合
|
|
||||||
};
|
|
||||||
|
|
||||||
const userList = (pageSize) => {
|
|
||||||
const result: any[] = [];
|
|
||||||
doCustomTimes(pageSize, () => {
|
|
||||||
result.push({
|
|
||||||
id: '@integer(10,9999)',
|
|
||||||
username: '@cname()',
|
|
||||||
avatar: Random.image('400x400', Random.color(), Random.color(), Random.first()),
|
|
||||||
account: 'M086611',
|
|
||||||
mobile: `188@integer(1000,9999)9999`,
|
|
||||||
email: '735@integer(1000,9999)02@qq.com',
|
|
||||||
'gender|1': [1, 2],
|
|
||||||
'status|1': ['normal', 'disable'],
|
|
||||||
'role|1': ['普通用户', '推广管理员', '发货管理员', '财务管理员'],
|
|
||||||
create_date: `@date('yyyy-MM-dd hh:mm:ss')`,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default [
|
|
||||||
{
|
|
||||||
url: '/api/login',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'post',
|
|
||||||
response: () => {
|
|
||||||
return resultSuccess({ token });
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: '/api/admin_info',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: () => {
|
|
||||||
// const token = getRequestToken(request);
|
|
||||||
// if (!token) return resultError('Invalid token');
|
|
||||||
//此处随机了,为了模拟不同角色权限
|
|
||||||
//const randomNum = Math.floor(Math.random() * 2 + 1);
|
|
||||||
const randomNum = 1;
|
|
||||||
adminInfo.permissions = (randomNum === 1 ? adminPermissions : ordinaryPermissions) as never[];
|
|
||||||
adminInfo.role_type = randomNum;
|
|
||||||
return resultSuccess(adminInfo);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
url: '/api/user_list',
|
|
||||||
timeout: 1000,
|
|
||||||
method: 'get',
|
|
||||||
response: ({ query }) => {
|
|
||||||
const { page = 1, pageSize = 10 } = query;
|
|
||||||
const list = userList(Number(pageSize));
|
|
||||||
return resultSuccess({
|
|
||||||
page: Number(page),
|
|
||||||
pageSize: Number(pageSize),
|
|
||||||
pageCount: 60,
|
|
||||||
itemCount: 60 * Number(pageSize),
|
|
||||||
list,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
Loading…
Reference in New Issue
Block a user