This commit is contained in:
13693
mock/controller/area.js
Normal file
13693
mock/controller/area.js
Normal file
File diff suppressed because it is too large
Load Diff
2296
mock/controller/defaultIcon.js
Normal file
2296
mock/controller/defaultIcon.js
Normal file
File diff suppressed because it is too large
Load Diff
87
mock/controller/departmentManagement.js
Normal file
87
mock/controller/departmentManagement.js
Normal file
@@ -0,0 +1,87 @@
|
||||
const List = [
|
||||
{
|
||||
id: 'root',
|
||||
createTime: '@datetime',
|
||||
name: '根节点',
|
||||
order: 0,
|
||||
children: [
|
||||
{
|
||||
id: '1',
|
||||
parentId: 'root',
|
||||
parentName: '根节点',
|
||||
createTime: '@datetime',
|
||||
name: '桃花坞',
|
||||
order: 0,
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
parentId: 'root',
|
||||
parentName: '根节点',
|
||||
createTime: '@datetime',
|
||||
name: '少林寺',
|
||||
order: 1,
|
||||
children: [
|
||||
{
|
||||
id: '@uuid',
|
||||
parentId: '2',
|
||||
parentName: '少林寺',
|
||||
createTime: '@datetime',
|
||||
name: '达摩院',
|
||||
order: 0,
|
||||
},
|
||||
{
|
||||
id: '@uuid',
|
||||
parentId: '2',
|
||||
parentName: '少林寺',
|
||||
createTime: '@datetime',
|
||||
name: '戒律堂',
|
||||
order: 1,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/departmentManagement/getList',
|
||||
type: 'get',
|
||||
response: (config) => {
|
||||
const { name, pageNo = 1, pageSize = 20 } = config.query
|
||||
const mockList = List.filter(
|
||||
(item) => !(name && !item.name.includes(name))
|
||||
)
|
||||
const list = mockList.filter(
|
||||
(item, index) =>
|
||||
index < pageSize * pageNo &&
|
||||
index >= pageSize * (pageNo - 1)
|
||||
)
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list, ...{ total: mockList.length } },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/departmentManagement/doEdit',
|
||||
type: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/departmentManagement/doDelete',
|
||||
type: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
114
mock/controller/dictionaryManagement.js
Normal file
114
mock/controller/dictionaryManagement.js
Normal file
@@ -0,0 +1,114 @@
|
||||
module.exports = [
|
||||
{
|
||||
url: '/dictionaryManagement/getTree',
|
||||
type: 'get',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: {
|
||||
total: 999,
|
||||
list: [
|
||||
{
|
||||
id: 'root',
|
||||
key: 'root',
|
||||
label: '全部字典',
|
||||
children: [
|
||||
{
|
||||
id: '@id',
|
||||
key: 'sex',
|
||||
label: '性别',
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
key: 'type',
|
||||
label: '类型',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/dictionaryManagement/getList',
|
||||
type: 'get',
|
||||
response: (config) => {
|
||||
const { key, parentKey } = config.query
|
||||
const list1 = [
|
||||
{
|
||||
parentKey: 'sex',
|
||||
id: '@id',
|
||||
lable: '性别',
|
||||
key: '1',
|
||||
value: '男',
|
||||
},
|
||||
{
|
||||
parentKey: 'sex',
|
||||
id: '@id',
|
||||
lable: '性别',
|
||||
key: '2',
|
||||
value: '女',
|
||||
},
|
||||
]
|
||||
const list2 = [
|
||||
{
|
||||
parentKey: 'type',
|
||||
id: '@id',
|
||||
lable: '类型',
|
||||
key: '1',
|
||||
value: '新闻',
|
||||
},
|
||||
{
|
||||
parentKey: 'type',
|
||||
id: '@id',
|
||||
lable: '类型',
|
||||
key: '2',
|
||||
value: '知识',
|
||||
},
|
||||
]
|
||||
if (parentKey) {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: {
|
||||
list: parentKey === 'sex' ? list1 : list2,
|
||||
},
|
||||
}
|
||||
}
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: {
|
||||
list:
|
||||
!key || key === 'root'
|
||||
? []
|
||||
: key === 'sex'
|
||||
? list1
|
||||
: list2,
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/dictionaryManagement/doEdit',
|
||||
type: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/dictionaryManagement/doDelete',
|
||||
type: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
115
mock/controller/goods.js
Normal file
115
mock/controller/goods.js
Normal file
@@ -0,0 +1,115 @@
|
||||
const List = [
|
||||
{
|
||||
uuid: '@uuid',
|
||||
image: 'https://cn.vitejs.dev/logo-with-shadow.png',
|
||||
title: 'Shop Vite',
|
||||
price: '敬请期待',
|
||||
label: ['极简', 'vite'],
|
||||
company: 'vdp',
|
||||
url: 'https://vuejs-core.cn/shop-vite',
|
||||
description: '全新一代前端框架',
|
||||
},
|
||||
{
|
||||
uuid: '@uuid',
|
||||
icon: 'dashboard-2-line',
|
||||
title: 'Dash' + 'board Pro',
|
||||
price: 'Admin Pro + Admin Plus 1299版' + '本赠品',
|
||||
label: ['敬请期待', '人工智能', '科技风'],
|
||||
company: 'vdp',
|
||||
url: 'https://vuejs-core.cn/dashboard-pro',
|
||||
description: 'Admin Pro + Adm' + 'in Plus 1299版本赠品',
|
||||
},
|
||||
{
|
||||
uuid: '@uuid',
|
||||
image:
|
||||
'https://p3-armor.byteimg.com/tos-cn-i-49unhts6dw/dfdba' +
|
||||
'5317c0c20ce20e64fac8' +
|
||||
'03d52bc.svg~tplv-49unhts6dw-image.image',
|
||||
title: 'vue-admin-arco',
|
||||
price: '免费',
|
||||
label: ['vue3', 'arco-design', 'MIT协议'],
|
||||
company: 'vab',
|
||||
url: 'https://github.com/zxwk1998/vue-admin-arco',
|
||||
description:
|
||||
'在字节跳动' +
|
||||
'arco-desi' +
|
||||
'gn-pro-vue基础上修改的' +
|
||||
'vue3版本,仅供学' +
|
||||
'习参考',
|
||||
},
|
||||
{
|
||||
uuid: '@uuid',
|
||||
svg: 'https://gcore.jsdelivr.net/gh/zxwk1998/image/logo/vab.svg',
|
||||
title: 'vue-admin-better',
|
||||
price: '免费',
|
||||
label: ['vue', 'element-ui', 'MIT协议'],
|
||||
company: 'vab',
|
||||
url: 'https://github.com/zxwk1998/vue-admin-better',
|
||||
description: '绝佳的开源、' + '企业级、' + '中后台前端框架',
|
||||
},
|
||||
{
|
||||
uuid: '@uuid',
|
||||
svg: 'https://gcore.jsdelivr.net/gh/zxwk1998/image/logo/vdb.svg',
|
||||
title: 'vue-datav-beautiful-pro',
|
||||
price: 'Admin Pro + Adm' + 'in Plus 1299版本赠品',
|
||||
label: ['数据大屏'],
|
||||
company: 'vdb',
|
||||
url: 'https://github.com/vue-datav-beautiful',
|
||||
description: '立志做' + '国内最好' + '的数据大屏应用',
|
||||
},
|
||||
{
|
||||
uuid: '@uuid',
|
||||
image: 'https://xuqu.gitee.io/common/logo.png',
|
||||
title: 'uview',
|
||||
price: '免费',
|
||||
label: ['uniapp', '跨平台', '组件'],
|
||||
company: '言信网络',
|
||||
url: 'http://uviewui.com',
|
||||
description:
|
||||
'跨 7 端移动端框架,全面的组件和便' +
|
||||
'捷的工具会让您信手拈来,如鱼得水',
|
||||
},
|
||||
{
|
||||
uuid: '@uuid',
|
||||
title: 'form-generator',
|
||||
image: 'https://mrhj.gitee.io/form-generator/img/logo.e1bc3747.png',
|
||||
price: '免费',
|
||||
label: ['element-ui', '表单设计器'],
|
||||
company: 'form-generator',
|
||||
url: 'https://mrhj.gitee.io/form-generator',
|
||||
description: 'Element UI表单设' + '计及代码生成器',
|
||||
},
|
||||
{
|
||||
uuid: '@uuid',
|
||||
title: 'OPSLI',
|
||||
image: 'https://www.opsli.com/static/images/favicon.ico',
|
||||
price: '免费',
|
||||
label: ['spring-boot', 'vue-admin-better'],
|
||||
company: 'OPSLI',
|
||||
url: 'https://www.op' + 'sli.com',
|
||||
description: 'vue-admin-better开源' + '版结合spring boot的最佳实践',
|
||||
},
|
||||
]
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/goods/getList',
|
||||
type: 'get',
|
||||
response(config) {
|
||||
const { title, pageNo = 1, pageSize = 20 } = config.query
|
||||
const mockList = List.filter(
|
||||
(item) => !(title && !item.title.includes(title))
|
||||
)
|
||||
const list = mockList.filter(
|
||||
(item, index) =>
|
||||
index < pageSize * pageNo &&
|
||||
index >= pageSize * (pageNo - 1)
|
||||
)
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list, ...{ total: mockList.length } },
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
53
mock/controller/menuManagement.js
Normal file
53
mock/controller/menuManagement.js
Normal file
@@ -0,0 +1,53 @@
|
||||
module.exports = [
|
||||
{
|
||||
url: '/menuManagement/getTree',
|
||||
type: 'get',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: {
|
||||
total: 999,
|
||||
list: [
|
||||
{
|
||||
id: 'root',
|
||||
label: '全部角色',
|
||||
children: [
|
||||
{
|
||||
id: '@id',
|
||||
role: 'admin',
|
||||
label: 'admin角色',
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
role: 'editor',
|
||||
label: 'editor角色',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/menuManagement/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/menuManagement/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
36
mock/controller/notice.js
Normal file
36
mock/controller/notice.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const List = [
|
||||
{
|
||||
email: '@email',
|
||||
image: 'https://i.gtimg.cn/club/item/face/img/8/15918_100.gif',
|
||||
notice: 'Github开源地址:<a target="_blank" href="https://github.com/zxwk1998/vue-admin-better">点我</a>',
|
||||
},
|
||||
{
|
||||
email: '@email',
|
||||
image: 'https://i.gtimg.cn/club/item/face/img/0/15640_100.gif',
|
||||
notice: 'Admin Pro:<a target="_blank" href="https://vuejs-core.cn/admin-pro">点我</a>',
|
||||
},
|
||||
{
|
||||
email: '@email',
|
||||
image: 'https://i.gtimg.cn/club/item/face/img/9/15919_100.gif',
|
||||
notice: 'Admin Plus:<a target="_blank" href="https://vuejs-core.cn/admin-plus">点我</a>',
|
||||
},
|
||||
{
|
||||
email: '@email',
|
||||
image: 'https://i.gtimg.cn/club/item/face/img/8/15918_100.gif',
|
||||
notice: 'Shop Vite:<a target="_blank" href="https://vuejs-core.cn/shop-vite">点我</a>',
|
||||
},
|
||||
]
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/notice/getList',
|
||||
type: 'get',
|
||||
response: () => {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list: List, total: List.length },
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
46
mock/controller/refreshToken.js
Normal file
46
mock/controller/refreshToken.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const { Random } = require('mockjs')
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/expireToken',
|
||||
type: 'get',
|
||||
response: (config) => {
|
||||
const authorization =
|
||||
config.headers.authorization || config.headers.Authorization
|
||||
const arr = authorization.split('-')
|
||||
const tokenTime = parseInt(arr[arr.length - 1])
|
||||
|
||||
if (Date.now() - tokenTime > 5000)
|
||||
return {
|
||||
code: 402,
|
||||
msg: '令牌已过期',
|
||||
}
|
||||
else
|
||||
return {
|
||||
code: 200,
|
||||
msg: '令牌未过期',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/refreshToken',
|
||||
type: 'get',
|
||||
response: (config) => {
|
||||
const authorization =
|
||||
config.headers.authorization || config.headers.Authorization
|
||||
let token = ''
|
||||
if (authorization.includes('admin-token'))
|
||||
token = `admin-token-${Random.guid()}-${Date.now()}`
|
||||
if (authorization.includes('editor-token'))
|
||||
token = `editor-token-${Random.guid()}-${Date.now()}`
|
||||
if (authorization.includes('test-token'))
|
||||
token = `test-token-${Random.guid()}-${Date.now()}`
|
||||
|
||||
return {
|
||||
code: 200,
|
||||
msg: '刷新Token成功',
|
||||
data: { token },
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
55
mock/controller/roleManagement.js
Normal file
55
mock/controller/roleManagement.js
Normal file
@@ -0,0 +1,55 @@
|
||||
const List = [
|
||||
{
|
||||
id: '@id',
|
||||
role: 'admin',
|
||||
btnRolesCheckedList: ['read:system', 'write:system', 'delete:system'],
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
role: 'editor',
|
||||
btnRolesCheckedList: ['read:system', 'write:system'],
|
||||
},
|
||||
]
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/roleManagement/getList',
|
||||
type: 'get',
|
||||
response(config) {
|
||||
const { role, pageNo = 1, pageSize = 20 } = config.query
|
||||
const mockList = List.filter(
|
||||
(item) => !(role && !item.title.includes(role))
|
||||
)
|
||||
const list = mockList.filter(
|
||||
(item, index) =>
|
||||
index < pageSize * pageNo &&
|
||||
index >= pageSize * (pageNo - 1)
|
||||
)
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list, ...{ total: mockList.length } },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/roleManagement/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/roleManagement/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
1019
mock/controller/router.js
Normal file
1019
mock/controller/router.js
Normal file
File diff suppressed because it is too large
Load Diff
20
mock/controller/search.js
Normal file
20
mock/controller/search.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const List = [
|
||||
{
|
||||
url: 'https://www.bing.com/search?q=vue+admin+plus%e5%ae%98%e7%bd%91&qs=HS&pq=vue+admin+plus&sk=HS1&sc=10-14&cvid=B01F4326D6724F76B568CBF127648BB8&FORM=QBRE&sp=2&lq=0&rdr=1&rdrig=7414F5AB9CF241C78B8CC476818B3569',
|
||||
value: '官网',
|
||||
},
|
||||
]
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/search/getList',
|
||||
type: 'get',
|
||||
response: () => {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list: List },
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
47
mock/controller/systemLog.js
Normal file
47
mock/controller/systemLog.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const { mock } = require('mockjs')
|
||||
|
||||
const List = []
|
||||
const count = 50
|
||||
for (let i = 0; i < count; i++) {
|
||||
List.push(
|
||||
mock({
|
||||
uuid: '@uuid',
|
||||
id: '@id',
|
||||
account: '@account(1, 2)',
|
||||
'type|1': ['操作日志', '数据库日志', '系统日志'],
|
||||
'account|1': ['admin', 'editor', 'test'],
|
||||
'executeResult|1': [
|
||||
'登录成功',
|
||||
'登录成功',
|
||||
'登录失败',
|
||||
'接口异常',
|
||||
'dos攻击',
|
||||
],
|
||||
ip: '@ip',
|
||||
datetime: '@datetime',
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/systemLog/getList',
|
||||
type: 'get',
|
||||
response: (config) => {
|
||||
const { account, pageNo = 1, pageSize = 20 } = config.query
|
||||
const mockList = List.filter(
|
||||
(item) => !(account && !item.account.includes(account))
|
||||
)
|
||||
const list = mockList.filter(
|
||||
(item, index) =>
|
||||
index < pageSize * pageNo &&
|
||||
index >= pageSize * (pageNo - 1)
|
||||
)
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list, ...{ total: mockList.length } },
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
68
mock/controller/table.js
Normal file
68
mock/controller/table.js
Normal file
@@ -0,0 +1,68 @@
|
||||
const { mock } = require('mockjs')
|
||||
const { handleRandomImage } = require('../utils')
|
||||
|
||||
const List = []
|
||||
const count = 50
|
||||
for (let i = 0; i < count; i++) {
|
||||
List.push(
|
||||
mock({
|
||||
uuid: '@uuid',
|
||||
id: '@id',
|
||||
title: '@title(1, 2)',
|
||||
description: '@csentence',
|
||||
'status|1': ['published', 'draft', 'deleted'],
|
||||
author: '@cname',
|
||||
datetime: '@datetime',
|
||||
pageViews: '@integer(300, 5000)',
|
||||
img: handleRandomImage(228, 228),
|
||||
switch: '@boolean',
|
||||
percent: '@integer(80,99)',
|
||||
'rate|1': [1, 2, 3, 4, 5],
|
||||
'type|1': [0, 1],
|
||||
percentage: '@integer(0,100)',
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/table/getList',
|
||||
type: 'get',
|
||||
response(config) {
|
||||
const { title, pageNo = 1, pageSize = 20 } = config.query
|
||||
const mockList = List.filter(
|
||||
(item) => !(title && !item.title.includes(title))
|
||||
)
|
||||
const list = mockList.filter(
|
||||
(item, index) =>
|
||||
index < pageSize * pageNo &&
|
||||
index >= pageSize * (pageNo - 1)
|
||||
)
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list, ...{ total: mockList.length } },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/table/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/table/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
47
mock/controller/taskManagement.js
Normal file
47
mock/controller/taskManagement.js
Normal file
@@ -0,0 +1,47 @@
|
||||
const { mock } = require('mockjs')
|
||||
|
||||
const List = []
|
||||
const count = 50
|
||||
for (let i = 0; i < count; i++) {
|
||||
List.push(
|
||||
mock({
|
||||
uuid: '@uuid',
|
||||
id: '@id',
|
||||
taskName: '@account(1, 2)',
|
||||
'status|1': [0, 1],
|
||||
'account|1': ['admin', 'editor', 'test'],
|
||||
'executeResult|1': [
|
||||
'登录成功',
|
||||
'登录成功',
|
||||
'登录失败',
|
||||
'接口异常',
|
||||
'dos攻击',
|
||||
],
|
||||
ip: '@ip',
|
||||
datetime: '@datetime',
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/taskManagement/getList',
|
||||
type: 'get',
|
||||
response: (config) => {
|
||||
const { account, pageNo = 1, pageSize = 20 } = config.query
|
||||
const mockList = List.filter(
|
||||
(item) => !(account && !item.account.includes(account))
|
||||
)
|
||||
const list = mockList.filter(
|
||||
(item, index) =>
|
||||
index < pageSize * pageNo &&
|
||||
index >= pageSize * (pageNo - 1)
|
||||
)
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list, ...{ total: mockList.length } },
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
125
mock/controller/user.js
Normal file
125
mock/controller/user.js
Normal file
@@ -0,0 +1,125 @@
|
||||
const { Random } = require('mockjs')
|
||||
|
||||
const tokens = {
|
||||
admin: `admin-token-${Random.guid()}-${Date.now()}`,
|
||||
editor: `editor-token-${Random.guid()}-${Date.now()}`,
|
||||
test: `test-token-${Random.guid()}-${Date.now()}`,
|
||||
}
|
||||
const username2role = {
|
||||
admin: ['Admin'],
|
||||
editor: ['Editor'],
|
||||
test: ['Admin', 'Editor'],
|
||||
}
|
||||
const role2permission = {
|
||||
Admin: ['read:system', 'write:system', 'delete:system'],
|
||||
Editor: ['read:system', 'write:system'],
|
||||
Test: ['read:system'],
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/publicKey',
|
||||
type: 'get',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: {
|
||||
mockServer: true,
|
||||
publicKey:
|
||||
'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBT2vr+dhZElF73FJ6xiP181txKWUSNLPQQlid6DUJhGAOZblluafIdLmnUyKE8mMHhT3R+Ib3ssZcJku6Hn72yHYj/qPkCGFv0eFo7G+GJfDIUeDyalBN0QsuiE/XzPHJBuJDfRArOiWvH0BXOv5kpeXSXM8yTt5Na1jAYSiQ/wIDAQAB',
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/login',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { username } = config.body
|
||||
const token = tokens[username]
|
||||
if (!token)
|
||||
return {
|
||||
code: 500,
|
||||
msg: '帐户或密码不正确',
|
||||
}
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { token },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/socialLogin',
|
||||
type: 'post',
|
||||
response(config) {
|
||||
const { code } = config.body
|
||||
if (!code)
|
||||
return {
|
||||
code: 500,
|
||||
msg: '未成功获取Token',
|
||||
}
|
||||
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { token: tokens['admin'] },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/register',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟注册成功',
|
||||
data: { token: tokens['editor'] },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/userInfo',
|
||||
type: 'get',
|
||||
response(config) {
|
||||
const authorization =
|
||||
config.headers.authorization || config.headers.Authorization
|
||||
if (!authorization.startsWith('Bearer '))
|
||||
return {
|
||||
code: 401,
|
||||
msg: '令牌无效',
|
||||
}
|
||||
const _authorization = authorization.replace('Bearer ', '')
|
||||
const isTrue = _authorization.includes('-token-')
|
||||
const username = isTrue
|
||||
? _authorization.split('-token-')[0]
|
||||
: 'admin'
|
||||
const roles = username2role[username] || []
|
||||
const permissions = [
|
||||
...new Set(roles.flatMap((role) => role2permission[role])),
|
||||
]
|
||||
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: {
|
||||
username,
|
||||
roles,
|
||||
permissions,
|
||||
avatar: 'https://i.gtimg.cn/club/item/face/img/2/16022_100.gif',
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/logout',
|
||||
type: 'get',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
69
mock/controller/userManagement.js
Normal file
69
mock/controller/userManagement.js
Normal file
@@ -0,0 +1,69 @@
|
||||
const List = [
|
||||
{
|
||||
id: '@id',
|
||||
username: 'admin',
|
||||
password: 'admin',
|
||||
email: '@email',
|
||||
roles: ['admin'],
|
||||
datatime: '@datetime',
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
username: 'editor',
|
||||
password: 'editor',
|
||||
email: '@email',
|
||||
roles: ['editor'],
|
||||
datatime: '@datetime',
|
||||
},
|
||||
{
|
||||
id: '@id',
|
||||
username: 'test',
|
||||
password: 'test',
|
||||
email: '@email',
|
||||
roles: ['admin', 'editor'],
|
||||
datatime: '@datetime',
|
||||
},
|
||||
]
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/userManagement/getList',
|
||||
type: 'get',
|
||||
response(config) {
|
||||
const { username, pageNo = 1, pageSize = 20 } = config.query
|
||||
const mockList = List.filter(
|
||||
(item) => !(username && !item.username.includes(username))
|
||||
)
|
||||
const list = mockList.filter(
|
||||
(item, index) =>
|
||||
index < pageSize * pageNo &&
|
||||
index >= pageSize * (pageNo - 1)
|
||||
)
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data: { list, ...{ total: mockList.length } },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/userManagement/doEdit',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/userManagement/doDelete',
|
||||
type: 'post',
|
||||
response() {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟删除成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
365
mock/controller/workflow.js
Normal file
365
mock/controller/workflow.js
Normal file
@@ -0,0 +1,365 @@
|
||||
const data = {
|
||||
nodes: [
|
||||
{
|
||||
id: '742356ea-762b-4899-b96a-bd567e3c4361',
|
||||
type: 'start',
|
||||
x: 220,
|
||||
y: 170,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
},
|
||||
{
|
||||
id: 'dacda6b6-48d3-4dff-911d-287704eb23d8',
|
||||
type: 'rect',
|
||||
x: 350,
|
||||
y: 170,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
text: {
|
||||
x: 350,
|
||||
y: 170,
|
||||
value: '基础节点',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: '49106603-2b88-4b2c-b1e8-723c1f2210bd',
|
||||
type: 'user',
|
||||
x: 530,
|
||||
y: 170,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
text: {
|
||||
x: 530,
|
||||
y: 220,
|
||||
value: '自定义节点',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: '647fa2bc-98ee-40cf-99c5-4756c0bc130d',
|
||||
type: 'push',
|
||||
x: 690,
|
||||
y: 170,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
text: {
|
||||
x: 690,
|
||||
y: 220,
|
||||
value: '可添加下一个节点/节点组',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: '37e7bac3-8804-4237-abe9-7b6065c207e9',
|
||||
type: 'download',
|
||||
x: 690,
|
||||
y: 320,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
},
|
||||
{
|
||||
id: '6bb4396f-54c9-4b1c-b34c-87ef004f2e29',
|
||||
type: 'user',
|
||||
x: 840,
|
||||
y: 320,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
},
|
||||
{
|
||||
id: 'abf76937-63b8-493c-a978-a4a58bc4f6b8',
|
||||
type: 'push',
|
||||
x: 840,
|
||||
y: 470,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
},
|
||||
{
|
||||
id: 'b119f24f-2669-4a90-a837-afd853b2ffcc',
|
||||
type: 'end',
|
||||
x: 990,
|
||||
y: 320,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
},
|
||||
{
|
||||
id: '60326ad9-cae2-4a85-ae98-d340fb7bd67f',
|
||||
type: 'end',
|
||||
x: 990,
|
||||
y: 470,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
},
|
||||
{
|
||||
id: '414fe028-3609-4450-b0f4-e5aca7705e8c',
|
||||
type: 'download',
|
||||
x: 860,
|
||||
y: 170,
|
||||
properties: {},
|
||||
baseType: 'node',
|
||||
text: {
|
||||
x: 860,
|
||||
y: 220,
|
||||
value: '自定义节点-设置颜色',
|
||||
},
|
||||
},
|
||||
],
|
||||
edges: [
|
||||
{
|
||||
id: '00f55245-513e-43a2-9cb0-adb61b01adc8',
|
||||
type: 'polyline',
|
||||
sourceNodeId: '742356ea-762b-4899-b96a-bd567e3c4361',
|
||||
targetNodeId: 'dacda6b6-48d3-4dff-911d-287704eb23d8',
|
||||
startPoint: {
|
||||
x: 240,
|
||||
y: 170,
|
||||
},
|
||||
endPoint: {
|
||||
x: 300,
|
||||
y: 170,
|
||||
},
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{
|
||||
x: 240,
|
||||
y: 170,
|
||||
},
|
||||
{
|
||||
x: 300,
|
||||
y: 170,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'bbf9754f-603e-48e4-85fe-84ed44459a6a',
|
||||
type: 'polyline',
|
||||
sourceNodeId: 'dacda6b6-48d3-4dff-911d-287704eb23d8',
|
||||
targetNodeId: '49106603-2b88-4b2c-b1e8-723c1f2210bd',
|
||||
startPoint: {
|
||||
x: 400,
|
||||
y: 170,
|
||||
},
|
||||
endPoint: {
|
||||
x: 495,
|
||||
y: 170,
|
||||
},
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{
|
||||
x: 400,
|
||||
y: 170,
|
||||
},
|
||||
{
|
||||
x: 495,
|
||||
y: 170,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: '12bb443b-4070-4a08-ad4d-2755ee856f0d',
|
||||
type: 'polyline',
|
||||
sourceNodeId: '49106603-2b88-4b2c-b1e8-723c1f2210bd',
|
||||
targetNodeId: '647fa2bc-98ee-40cf-99c5-4756c0bc130d',
|
||||
startPoint: {
|
||||
x: 565,
|
||||
y: 170,
|
||||
},
|
||||
endPoint: {
|
||||
x: 655,
|
||||
y: 170,
|
||||
},
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{
|
||||
x: 565,
|
||||
y: 170,
|
||||
},
|
||||
{
|
||||
x: 655,
|
||||
y: 170,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: '33fa3c09-9c29-4cb7-8373-67d537b8b623',
|
||||
type: 'polyline',
|
||||
sourceNodeId: '647fa2bc-98ee-40cf-99c5-4756c0bc130d',
|
||||
targetNodeId: '37e7bac3-8804-4237-abe9-7b6065c207e9',
|
||||
startPoint: {
|
||||
x: 690,
|
||||
y: 205,
|
||||
},
|
||||
endPoint: {
|
||||
x: 690,
|
||||
y: 295,
|
||||
},
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{
|
||||
x: 690,
|
||||
y: 205,
|
||||
},
|
||||
{
|
||||
x: 690,
|
||||
y: 295,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: '2b5a5e89-005e-4fda-9a44-dc795050534f',
|
||||
type: 'polyline',
|
||||
sourceNodeId: '37e7bac3-8804-4237-abe9-7b6065c207e9',
|
||||
targetNodeId: '6bb4396f-54c9-4b1c-b34c-87ef004f2e29',
|
||||
startPoint: {
|
||||
x: 715,
|
||||
y: 320,
|
||||
},
|
||||
endPoint: {
|
||||
x: 805,
|
||||
y: 320,
|
||||
},
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{
|
||||
x: 715,
|
||||
y: 320,
|
||||
},
|
||||
{
|
||||
x: 805,
|
||||
y: 320,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: '62b54f8a-bcfd-494b-9144-5aeb09ca77a1',
|
||||
type: 'polyline',
|
||||
sourceNodeId: '6bb4396f-54c9-4b1c-b34c-87ef004f2e29',
|
||||
targetNodeId: 'b119f24f-2669-4a90-a837-afd853b2ffcc',
|
||||
startPoint: {
|
||||
x: 875,
|
||||
y: 320,
|
||||
},
|
||||
endPoint: {
|
||||
x: 970,
|
||||
y: 320,
|
||||
},
|
||||
properties: {},
|
||||
text: {
|
||||
x: 920,
|
||||
y: 310,
|
||||
value: 'Y',
|
||||
},
|
||||
pointsList: [
|
||||
{
|
||||
x: 875,
|
||||
y: 320,
|
||||
},
|
||||
{
|
||||
x: 970,
|
||||
y: 320,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'ba816d4a-5785-4911-9f78-03933f1463a1',
|
||||
type: 'polyline',
|
||||
sourceNodeId: '6bb4396f-54c9-4b1c-b34c-87ef004f2e29',
|
||||
targetNodeId: 'abf76937-63b8-493c-a978-a4a58bc4f6b8',
|
||||
startPoint: {
|
||||
x: 840,
|
||||
y: 355,
|
||||
},
|
||||
endPoint: {
|
||||
x: 840,
|
||||
y: 435,
|
||||
},
|
||||
properties: {},
|
||||
text: {
|
||||
x: 850,
|
||||
y: 400,
|
||||
value: 'N',
|
||||
},
|
||||
pointsList: [
|
||||
{
|
||||
x: 840,
|
||||
y: 355,
|
||||
},
|
||||
{
|
||||
x: 840,
|
||||
y: 435,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: '2b3007ed-7a13-4db7-a1ea-6691d7564c34',
|
||||
type: 'polyline',
|
||||
sourceNodeId: 'abf76937-63b8-493c-a978-a4a58bc4f6b8',
|
||||
targetNodeId: '60326ad9-cae2-4a85-ae98-d340fb7bd67f',
|
||||
startPoint: {
|
||||
x: 875,
|
||||
y: 470,
|
||||
},
|
||||
endPoint: {
|
||||
x: 970,
|
||||
y: 470,
|
||||
},
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{
|
||||
x: 875,
|
||||
y: 470,
|
||||
},
|
||||
{
|
||||
x: 970,
|
||||
y: 470,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: '262e2263-6c8c-4a38-b223-97848e9b5767',
|
||||
type: 'polyline',
|
||||
sourceNodeId: '647fa2bc-98ee-40cf-99c5-4756c0bc130d',
|
||||
targetNodeId: '414fe028-3609-4450-b0f4-e5aca7705e8c',
|
||||
startPoint: {
|
||||
x: 725,
|
||||
y: 170,
|
||||
},
|
||||
endPoint: {
|
||||
x: 835,
|
||||
y: 170,
|
||||
},
|
||||
properties: {},
|
||||
pointsList: [
|
||||
{
|
||||
x: 725,
|
||||
y: 170,
|
||||
},
|
||||
{
|
||||
x: 835,
|
||||
y: 170,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
url: '/workflow/getList',
|
||||
type: 'get',
|
||||
response: () => {
|
||||
return {
|
||||
code: 200,
|
||||
msg: 'success',
|
||||
data,
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
url: '/workflow/doEdit',
|
||||
type: 'post',
|
||||
response: () => {
|
||||
return {
|
||||
code: 200,
|
||||
msg: '模拟保存成功',
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user