This commit is contained in:
wuyanwen 2020-01-06 14:47:21 +08:00
parent 66e4f8f74f
commit 9b591340a1
13 changed files with 0 additions and 2404 deletions

View File

@ -1,31 +0,0 @@
为首屏增加 加载动画
====
## 需求
> 为了缓解用户第一次访问时,加载 JS 过大所导致用户等待白屏时间过长导致的用户体验不好,进行的一个优化动效。
## 实现方案
1. 将 动画加载 dom 元素放在 #appVue 生命周期开始时,会自动清掉 #app 下的所有元素。
2. 将 动画加载 dom 元素放在 body 下Vue 生命周期开始时 App.vue (created, mounted) 调用 `@/utils/utll` 下的 removeLoadingAnimate(#id, timeout) 则会移除加载动画
最后一步:
将样式插入到 `public/index.html` 文件的 `<head></head>` 最好写成内联 `<style>动画样式</style>`
----
目前提供有两个样式,均在 `public/loading` 文件夹内。且 pro 已经默认使用了一套 loading 动画方案,可以直接参考 `public/index.html`
## 写在最后
目前 pro 有页面 overflow 显示出浏览器滚动条时,页面会抖动一下的问题。
欢迎各位提供能解决的方案和实现 demo。如果在条件允许的情况下建议请直接使用 pro 进行改造,也欢迎直接 PR 到 pro 的仓库

View File

@ -1,95 +0,0 @@
按需加载 减小打包
====
## 按需引入组件依赖
`Ant Design Pro Vue` 默认编码工作并不支持按需引入,不过可以通过以下操作结合 [Ant Design Of Vue](https://vuecomponent.github.io/ant-design-vue/docs/vue/introduce-cn/) 官方文档来进行按需引入。
- 增加项目按需引入依赖
- 修改引入组件方式
1. 增加按需引入所需依赖 `babel-plugin-import`
并且修改文件 `babel.config.js`
```ecmascript 6
module.exports = {
presets: [
'@vue/app'
],
plugins: [
[ "import", {
"libraryName": "ant-design-vue",
"libraryDirectory": "es",
"style": "css"
} ]
]
}
```
2. 修改引入组件方式 (注意,这只是一个例子,请完整引入你所需要的组件)
文件 `@/core/lazy_lib/component_use.js`
```javascript
import Vue from 'vue'
import {
Input,
Button,
Select,
Card,
Form,
Row,
Col,
Modal,
Table,
notification
} from 'ant-design-vue'
Vue.use(Input)
Vue.use(Button)
Vue.use(Select)
Vue.use(Card)
Vue.use(Form)
Vue.use(Row)
Vue.use(Col)
Vue.use(Modal)
Vue.use(Table)
Vue.use(notification)
Vue.prototype.$notification = notification;
```
3. 最后在 `main.js` 中引入 `@/core/lazy_use.js` 文件即可,如下
```javascript
import Vue from 'vue'
import App from './App'
// 引入 按需组件的统一引入文件
import './core/lazy_use'
import './style/index.less'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount('#app')
```
## 其他 减少打包大小
1. Ant Design Vue 1.2.x 版本起,采用的 ant-design 官方方案 svg Icon 组件,整个项目打包会变大很多,图标进行按需加载可参考 https://github.com/HeskeyBaozi/reduce-antd-icons-bundle-demo
2. moment 按需加载 可参考 https://github.com/jmblog/how-to-optimize-momentjs-with-webpack

View File

@ -1,28 +0,0 @@
多(页签)标签 模式
====
## 让框架支持打开的页面增加多标签,可随时切换
### 关于如何移除该功能 组件
1. 移除 `/src/layouts/BasicLayout.vue` L44, L69, L80
```vue
// L44
<multi-tab v-if="multiTab"></multi-tab>
// L69
import MultiTab from '@/components/MultiTab'
// L80
MultiTab,
```
2. 移除 `/src/config/defaultSettings.js` L25
3. 移除 `src/store/modules/app.js` L27, L76-L79, L118-L120
4. 移除 `src/utils/mixin.js` L21
5. 删除组件目录 `src/components/MultiTab`
> 以上 `L x` 均代表行N ,如 L3 = 行3

View File

@ -1,40 +0,0 @@
先增加依赖
```bash
// npm
$ npm install --save-dev webpack-bundle-analyzer
// or yarn
$ yarn add webpack-bundle-analyzer -D
```
配置文件 `vue.config.js` 增加 `configureWebpack.plugins` 参数
```
const path = require('path')
const webpack = require('webpack')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
function resolve (dir) {
return path.join(__dirname, dir)
}
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// 依赖大小分析工具
new BundleAnalyzerPlugin(),
]
},
...
}
```
启动 `cli``build` 命令进行项目编译,编译完成时,会自动运行一个 http://localhost:8888 的地址,完整显示了支持库依赖

View File

@ -1,23 +0,0 @@
import { isIE } from '@/utils/util'
// 判断环境不是 prod 或者 preview 是 true 时,加载 mock 服务
if (process.env.NODE_ENV !== 'production' || process.env.VUE_APP_PREVIEW === 'true') {
if (isIE()) {
console.error('ERROR: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.')
}
// 使用同步加载依赖
// 防止 vuex 中的 GetInfo 早于 mock 运行,导致无法 mock 请求返回结果
console.log('mock mounting')
const Mock = require('mockjs2')
require('./services/auth')
require('./services/user')
require('./services/manage')
require('./services/other')
require('./services/tagCloud')
require('./services/article')
Mock.setup({
timeout: 800 // setter delay time
})
console.log('mock mounted')
}

View File

@ -1,89 +0,0 @@
import Mock from 'mockjs2'
import { builder, getQueryParameters } from '../util'
const titles = [
'Alipay',
'Angular',
'Ant Design',
'Ant Design Pro',
'Bootstrap',
'React',
'Vue',
'Webpack'
]
const avatar = ['https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png',
'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png',
'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png'
]
const covers = [
'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png',
'https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png',
'https://gw.alipayobjects.com/zos/rmsportal/iXjVmWVHbCJAyqvDxdtx.png',
'https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png'
]
const owner = [
'付小小',
'吴加好',
'周星星',
'林东东',
'曲丽丽'
]
const content = '段落示意:蚂蚁金服设计平台 ant.design用最小的工作量无缝接入蚂蚁金服生态提供跨越设计与开发的体验解决方案。蚂蚁金服设计平台 ant.design用最小的工作量无缝接入蚂蚁金服生态提供跨越设计与开发的体验解决方案。'
const description = '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。'
const href = 'https://ant.design'
const article = (options) => {
const queryParameters = getQueryParameters(options)
console.log('queryParameters', queryParameters)
if (queryParameters && !queryParameters.count) {
queryParameters.count = 5
}
const data = []
for (let i = 0; i < queryParameters.count; i++) {
const tmpKey = i + 1
const num = parseInt(Math.random() * (4 + 1), 10)
data.push({
id: tmpKey,
avatar: avatar[num],
owner: owner[num],
content: content,
star: Mock.mock('@integer(1, 999)'),
percent: Mock.mock('@integer(1, 999)'),
like: Mock.mock('@integer(1, 999)'),
message: Mock.mock('@integer(1, 999)'),
description: description,
href: href,
title: titles[ i % 8 ],
updatedAt: Mock.mock('@datetime'),
members: [
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
name: '曲丽丽',
id: 'member1'
},
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
name: '王昭君',
id: 'member2'
},
{
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
name: '董娜娜',
id: 'member3'
}
],
activeUser: Math.ceil(Math.random() * 100000) + 100000,
newUser: Math.ceil(Math.random() * 1000) + 1000,
cover: parseInt(i / 4, 10) % 2 === 0 ? covers[i % 4] : covers[3 - (i % 4)]
})
}
return builder(data)
}
Mock.mock(/\/list\/article/, 'get', article)

View File

@ -1,50 +0,0 @@
import Mock from 'mockjs2'
import { builder, getBody } from '../util'
const username = ['admin', 'super']
// 强硬要求 ant.design 相同密码
// '21232f297a57a5a743894a0e4a801fc3',
const password = ['8914de686ab28dc22f30d3d8e107ff6c'] // admin, ant.design
const login = (options) => {
const body = getBody(options)
console.log('mock: body', body)
if (!username.includes(body.username) || !password.includes(body.password)) {
return builder({ isLogin: true }, '账户或密码错误', 401)
}
return builder({
'id': Mock.mock('@guid'),
'name': Mock.mock('@name'),
'username': 'admin',
'password': '',
'avatar': 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png',
'status': 1,
'telephone': '',
'lastLoginIp': '27.154.74.117',
'lastLoginTime': 1534837621348,
'creatorId': 'admin',
'createTime': 1497160610259,
'deleted': 0,
'roleId': 'admin',
'lang': 'zh-CN',
'token': '4291d7da9005377ec9aec4a71ea837f'
}, '', 200, { 'Custom-Header': Mock.mock('@guid') })
}
const logout = () => {
return builder({}, '[测试接口] 注销成功')
}
const smsCaptcha = () => {
return builder({ captcha: Mock.mock('@integer(10000, 99999)') })
}
const twofactor = () => {
return builder({ stepCode: Mock.mock('@integer(0, 1)') })
}
Mock.mock(/\/auth\/login/, 'post', login)
Mock.mock(/\/auth\/logout/, 'post', logout)
Mock.mock(/\/account\/sms/, 'post', smsCaptcha)
Mock.mock(/\/auth\/2step-code/, 'post', twofactor)

View File

@ -1,252 +0,0 @@
import Mock from 'mockjs2'
import { builder, getQueryParameters } from '../util'
const totalCount = 5701
const serverList = (options) => {
const parameters = getQueryParameters(options)
const result = []
const pageNo = parseInt(parameters.pageNo)
const pageSize = parseInt(parameters.pageSize)
const totalPage = Math.ceil(totalCount / pageSize)
const key = (pageNo - 1) * pageSize
const next = (pageNo >= totalPage ? (totalCount % pageSize) : pageSize) + 1
for (let i = 1; i < next; i++) {
const tmpKey = key + i
result.push({
key: tmpKey,
id: tmpKey,
no: 'No ' + tmpKey,
description: '这是一段描述',
callNo: Mock.mock('@integer(1, 999)'),
status: Mock.mock('@integer(0, 3)'),
updatedAt: Mock.mock('@datetime'),
editable: false
})
}
return builder({
pageSize: pageSize,
pageNo: pageNo,
totalCount: totalCount,
totalPage: totalPage,
data: result
})
}
const projects = () => {
return builder({
'data': [{
id: 1,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/WdGqmHpayyMjiEhcKoVE.png',
title: 'Alipay',
description: '那是一种内在的东西, 他们到达不了,也无法触及的',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 2,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/zOsKZmFRdUtvpqCImOVY.png',
title: 'Angular',
description: '希望是一个好东西,也许是最好的,好东西是不会消亡的',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 3,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/dURIMkkrRFpPgTuzkwnB.png',
title: 'Ant Design',
description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 4,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/sfjbOqnsXXJgNCjCzDBL.png',
title: 'Ant Design Pro',
description: '那时候我只会想自己想要什么,从不想自己拥有什么',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 5,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/siCrBXXhmvTQGWPNLBow.png',
title: 'Bootstrap',
description: '凛冬将至',
status: 1,
updatedAt: '2018-07-26 00:00:00'
},
{
id: 6,
cover: 'https://gw.alipayobjects.com/zos/rmsportal/ComBAopevLwENQdKWiIn.png',
title: 'Vue',
description: '生命就像一盒巧克力,结果往往出人意料',
status: 1,
updatedAt: '2018-07-26 00:00:00'
}
],
'pageSize': 10,
'pageNo': 0,
'totalPage': 6,
'totalCount': 57
})
}
const activity = () => {
return builder([{
id: 1,
user: {
nickname: '@name',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
},
project: {
name: '白鹭酱油开发组',
action: '更新',
event: '番组计划'
},
time: '2018-08-23 14:47:00'
},
{
id: 1,
user: {
nickname: '蓝莓酱',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png'
},
project: {
name: '白鹭酱油开发组',
action: '更新',
event: '番组计划'
},
time: '2018-08-23 09:35:37'
},
{
id: 1,
user: {
nickname: '@name',
avatar: '@image(64x64)'
},
project: {
name: '白鹭酱油开发组',
action: '创建',
event: '番组计划'
},
time: '2017-05-27 00:00:00'
},
{
id: 1,
user: {
nickname: '曲丽丽',
avatar: '@image(64x64)'
},
project: {
name: '高逼格设计天团',
action: '更新',
event: '六月迭代'
},
time: '2018-08-23 14:47:00'
},
{
id: 1,
user: {
nickname: '@name',
avatar: '@image(64x64)'
},
project: {
name: '高逼格设计天团',
action: 'created',
event: '六月迭代'
},
time: '2018-08-23 14:47:00'
},
{
id: 1,
user: {
nickname: '曲丽丽',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
},
project: {
name: '高逼格设计天团',
action: 'created',
event: '六月迭代'
},
time: '2018-08-23 14:47:00'
}
])
}
const teams = () => {
return builder([{
id: 1,
name: '科学搬砖组',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png'
},
{
id: 2,
name: '程序员日常',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png'
},
{
id: 1,
name: '设计天团',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png'
},
{
id: 1,
name: '中二少女团',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png'
},
{
id: 1,
name: '骗你学计算机',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png'
}
])
}
const radar = () => {
return builder([{
item: '引用',
'个人': 70,
'团队': 30,
'部门': 40
},
{
item: '口碑',
'个人': 60,
'团队': 70,
'部门': 40
},
{
item: '产量',
'个人': 50,
'团队': 60,
'部门': 40
},
{
item: '贡献',
'个人': 40,
'团队': 50,
'部门': 40
},
{
item: '热度',
'个人': 60,
'团队': 70,
'部门': 40
},
{
item: '引用',
'个人': 70,
'团队': 50,
'部门': 40
}
])
}
Mock.mock(/\/service/, 'get', serverList)
Mock.mock(/\/list\/search\/projects/, 'get', projects)
Mock.mock(/\/workplace\/activity/, 'get', activity)
Mock.mock(/\/workplace\/teams/, 'get', teams)
Mock.mock(/\/workplace\/radar/, 'get', radar)

View File

@ -1,974 +0,0 @@
import Mock from 'mockjs2'
import { builder } from '../util'
const orgTree = () => {
return builder([{
'key': 'key-01',
'title': '研发中心',
'icon': 'mail',
'children': [{
'key': 'key-01-01',
'title': '后端组',
'icon': null,
'group': true,
children: [{
'key': 'key-01-01-01',
'title': 'JAVA',
'icon': null
},
{
'key': 'key-01-01-02',
'title': 'PHP',
'icon': null
},
{
'key': 'key-01-01-03',
'title': 'Golang',
'icon': null
}
]
}, {
'key': 'key-01-02',
'title': '前端组',
'icon': null,
'group': true,
children: [{
'key': 'key-01-02-01',
'title': 'React',
'icon': null
},
{
'key': 'key-01-02-02',
'title': 'Vue',
'icon': null
},
{
'key': 'key-01-02-03',
'title': 'Angular',
'icon': null
}
]
}]
}, {
'key': 'key-02',
'title': '财务部',
'icon': 'dollar',
'children': [{
'key': 'key-02-01',
'title': '会计核算',
'icon': null
}, {
'key': 'key-02-02',
'title': '成本控制',
'icon': null
}, {
'key': 'key-02-03',
'title': '内部控制',
'icon': null,
'children': [{
'key': 'key-02-03-01',
'title': '财务制度建设',
'icon': null
},
{
'key': 'key-02-03-02',
'title': '会计核算',
'icon': null
}
]
}]
}])
}
const role = () => {
return builder({
'data': [{
'id': 'admin',
'name': '管理员',
'describe': '拥有所有权限',
'status': 1,
'creatorId': 'system',
'createTime': 1497160610259,
'deleted': 0,
'permissions': [{
'roleId': 'admin',
'permissionId': 'comment',
'permissionName': '评论管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'member',
'permissionName': '会员管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'menu',
'permissionName': '菜单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'import',
'describe': '导入',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'order',
'permissionName': '订单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'permission',
'permissionName': '权限管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'role',
'permissionName': '角色管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'test',
'permissionName': '测试权限',
'actions': '[]',
'actionEntitySet': [],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'user',
'permissionName': '用户管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'import',
'describe': '导入',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
},
{
'action': 'export',
'describe': '导出',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
}
]
},
{
'id': 'svip',
'name': 'SVIP',
'describe': '超级会员',
'status': 1,
'creatorId': 'system',
'createTime': 1532417744846,
'deleted': 0,
'permissions': [{
'roleId': 'admin',
'permissionId': 'comment',
'permissionName': '评论管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'member',
'permissionName': '会员管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'menu',
'permissionName': '菜单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'import',
'describe': '导入',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'order',
'permissionName': '订单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'permission',
'permissionName': '权限管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'role',
'permissionName': '角色管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'test',
'permissionName': '测试权限',
'actions': '[]',
'actionEntitySet': [],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'user',
'permissionName': '用户管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'import',
'describe': '导入',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'update',
'describe': '修改',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
}
]
},
{
'id': 'user',
'name': '普通会员',
'describe': '普通用户,只能查询',
'status': 1,
'creatorId': 'system',
'createTime': 1497160610259,
'deleted': 0,
'permissions': [{
'roleId': 'user',
'permissionId': 'comment',
'permissionName': '评论管理',
'actions': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"}]',
'actionEntitySet': [{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'user',
'permissionId': 'marketing',
'permissionName': '营销管理',
'actions': '[]',
'actionEntitySet': [],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'user',
'permissionId': 'member',
'permissionName': '会员管理',
'actions': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"}]',
'actionEntitySet': [{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'user',
'permissionId': 'menu',
'permissionName': '菜单管理',
'actions': '[]',
'actionEntitySet': [],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'user',
'permissionId': 'order',
'permissionName': '订单管理',
'actions': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"}]',
'actionEntitySet': [{
'action': 'query',
'describe': '查询',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'user',
'permissionId': 'permission',
'permissionName': '权限管理',
'actions': '[]',
'actionEntitySet': [],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'user',
'permissionId': 'role',
'permissionName': '角色管理',
'actions': '[]',
'actionEntitySet': [],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'user',
'permissionId': 'test',
'permissionName': '测试权限',
'actions': '[]',
'actionEntitySet': [],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'user',
'permissionId': 'user',
'permissionName': '用户管理',
'actions': '[]',
'actionEntitySet': [],
'actionList': null,
'dataAccess': null
}
]
}
],
'pageSize': 10,
'pageNo': 0,
'totalPage': 1,
'totalCount': 5
})
}
const permissionNoPager = () => {
return builder([{
'id': 'marketing',
'name': '营销管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': null,
'parents': null,
'type': null,
'deleted': 0,
'actions': [
'add',
'query',
'get',
'update',
'delete'
]
},
{
'id': 'member',
'name': '会员管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'query',
'get',
'update',
'delete'
]
},
{
'id': 'menu',
'name': '菜单管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'import',
'get',
'update'
]
},
{
'id': 'order',
'name': '订单管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'query',
'get',
'update',
'delete'
]
},
{
'id': 'permission',
'name': '权限管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get',
'update',
'delete'
]
},
{
'id': 'role',
'name': '角色管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get',
'update',
'delete'
]
},
{
'id': 'test',
'name': '测试权限',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get'
]
},
{
'id': 'user',
'name': '用户管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get'
]
}
])
}
const permissions = () => {
return builder({
'data': [{
'id': 'marketing',
'name': '营销管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': null,
'parents': null,
'type': null,
'deleted': 0,
'actions': [
'add',
'query',
'get',
'update',
'delete'
]
},
{
'id': 'member',
'name': '会员管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'query',
'get',
'update',
'delete'
]
},
{
'id': 'menu',
'name': '菜单管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'import',
'get',
'update'
]
},
{
'id': 'order',
'name': '订单管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'query',
'get',
'update',
'delete'
]
},
{
'id': 'permission',
'name': '权限管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get',
'update',
'delete'
]
},
{
'id': 'role',
'name': '角色管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get',
'update',
'delete'
]
},
{
'id': 'test',
'name': '测试权限',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get'
]
},
{
'id': 'user',
'name': '用户管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","describe":"新增","defaultCheck":false},{"action":"get","describe":"查询","defaultCheck":false}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get'
]
}
],
'pageSize': 10,
'pageNo': 0,
'totalPage': 1,
'totalCount': 5
})
}
Mock.mock(/\/org\/tree/, 'get', orgTree)
Mock.mock(/\/role/, 'get', role)
Mock.mock(/\/permission\/no-pager/, 'get', permissionNoPager)
Mock.mock(/\/permission/, 'get', permissions)

File diff suppressed because one or more lines are too long

View File

@ -1,770 +0,0 @@
import Mock from 'mockjs2'
import { builder } from '../util'
const info = (options) => {
console.log('options', options)
const userInfo = {
'id': '4291d7da9005377ec9aec4a71ea837f',
'name': '天野远子',
'username': 'admin',
'password': '',
'avatar': '/avatar2.jpg',
'status': 1,
'telephone': '',
'lastLoginIp': '27.154.74.117',
'lastLoginTime': 1534837621348,
'creatorId': 'admin',
'createTime': 1497160610259,
'merchantCode': 'TLif2btpzg079h15bk',
'deleted': 0,
'roleId': 'admin',
'role': {}
}
// role
const roleObj = {
'id': 'admin',
'name': '管理员',
'describe': '拥有所有权限',
'status': 1,
'creatorId': 'system',
'createTime': 1497160610259,
'deleted': 0,
'permissions': [{
'roleId': 'admin',
'permissionId': 'dashboard',
'permissionName': '仪表盘',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'query',
'describe': '查询',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'exception',
'permissionName': '异常页面权限',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'query',
'describe': '查询',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'result',
'permissionName': '结果权限',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'query',
'describe': '查询',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'profile',
'permissionName': '详细页权限',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'query',
'describe': '查询',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'table',
'permissionName': '表格权限',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'import',
'describe': '导入',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'form',
'permissionName': '表单权限',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'query',
'describe': '查询',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'order',
'permissionName': '订单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'query',
'describe': '查询',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'permission',
'permissionName': '权限管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'role',
'permissionName': '角色管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'table',
'permissionName': '桌子管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'query',
'describe': '查询',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}, {
'roleId': 'admin',
'permissionId': 'user',
'permissionName': '用户管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'import',
'describe': '导入',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}, {
'action': 'export',
'describe': '导出',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
}]
}
roleObj.permissions.push({
'roleId': 'admin',
'permissionId': 'support',
'permissionName': '超级模块',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"update","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"},{"action":"export","defaultCheck":false,"describe":"导出"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
}, {
'action': 'import',
'describe': '导入',
'defaultCheck': false
}, {
'action': 'get',
'describe': '详情',
'defaultCheck': false
}, {
'action': 'update',
'describe': '修改',
'defaultCheck': false
}, {
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}, {
'action': 'export',
'describe': '导出',
'defaultCheck': false
}],
'actionList': null,
'dataAccess': null
})
userInfo.role = roleObj
return builder(userInfo)
}
const userNav = (options) => {
const nav = [
// dashboard
{
'name': 'dashboard',
'parentId': 0,
'id': 1,
'meta': {
'icon': 'dashboard',
'title': '仪表盘',
'show': true
},
'component': 'RouteView',
'redirect': '/dashboard/workplace'
},
{
'name': 'workplace',
'parentId': 1,
'id': 7,
'meta': {
'title': '工作台',
'show': true
},
'component': 'Workplace'
},
{
'name': 'monitor',
'path': 'https://www.baidu.com/',
'parentId': 1,
'id': 3,
'meta': {
'title': '监控页(外部)',
'target': '_blank',
'show': true
}
},
{
'name': 'Analysis',
'parentId': 1,
'id': 2,
'meta': {
'title': '分析页',
'show': true
},
'component': 'Analysis',
'path': '/dashboard/analysis'
},
{
'name': 'tests',
'parentId': 1,
'id': 8,
'meta': {
'title': '测试功能',
'show': true
},
'component': 'TestWork'
},
// form
{
'name': 'form',
'parentId': 0,
'id': 10,
'meta': {
'icon': 'form',
'title': '表单页'
},
'redirect': '/form/base-form',
'component': 'PageView'
},
{
'name': 'basic-form',
'parentId': 10,
'id': 6,
'meta': {
'title': '基础表单'
},
'component': 'BasicForm'
},
{
'name': 'step-form',
'parentId': 10,
'id': 5,
'meta': {
'title': '分步表单'
},
'component': 'StepForm'
},
{
'name': 'advanced-form',
'parentId': 10,
'id': 4,
'meta': {
'title': '高级表单'
},
'component': 'AdvanceForm'
},
// list
{
'name': 'list',
'parentId': 0,
'id': 10010,
'meta': {
'icon': 'table',
'title': '列表页',
'show': true
},
'redirect': '/list/table-list',
'component': 'PageView'
},
{
'name': 'table-list',
'parentId': 10010,
'id': 10011,
'path': '/list/table-list/:pageNo([1-9]\\d*)?',
'meta': {
'title': '查询表格',
'show': true
},
'component': 'TableList'
},
{
'name': 'basic-list',
'parentId': 10010,
'id': 10012,
'meta': {
'title': '标准列表',
'show': true
},
'component': 'StandardList'
},
{
'name': 'card',
'parentId': 10010,
'id': 10013,
'meta': {
'title': '卡片列表',
'show': true
},
'component': 'CardList'
},
{
'name': 'search',
'parentId': 10010,
'id': 10014,
'meta': {
'title': '搜索列表',
'show': true
},
'redirect': '/list/search/article',
'component': 'SearchLayout'
},
{
'name': 'article',
'parentId': 10014,
'id': 10015,
'meta': {
'title': '搜索列表(文章)',
'show': true
},
'component': 'SearchArticles'
},
{
'name': 'project',
'parentId': 10014,
'id': 10016,
'meta': {
'title': '搜索列表(项目)',
'show': true
},
'component': 'SearchProjects'
},
{
'name': 'application',
'parentId': 10014,
'id': 10017,
'meta': {
'title': '搜索列表(应用)',
'show': true
},
'component': 'SearchApplications'
},
// profile
{
'name': 'profile',
'parentId': 0,
'id': 10018,
'meta': {
'title': '详情页',
'icon': 'profile',
'show': true
},
'redirect': '/profile/basic',
'component': 'RouteView'
},
{
'name': 'basic',
'parentId': 10018,
'id': 10019,
'meta': {
'title': '基础详情页',
'show': true
},
'component': 'ProfileBasic'
},
{
'name': 'advanced',
'parentId': 10018,
'id': 10020,
'meta': {
'title': '高级详情页',
'show': true
},
'component': 'ProfileAdvanced'
},
// result
{
'name': 'result',
'parentId': 0,
'id': 10021,
'meta': {
'title': '结果页',
'icon': 'check-circle-o',
'show': true
},
'redirect': '/result/success',
'component': 'PageView'
},
{
'name': 'success',
'parentId': 10021,
'id': 10022,
'meta': {
'title': '成功',
'hiddenHeaderContent': true,
'show': true
},
'component': 'ResultSuccess'
},
{
'name': 'fail',
'parentId': 10021,
'id': 10023,
'meta': {
'title': '失败',
'hiddenHeaderContent': true,
'show': true
},
'component': 'ResultFail'
},
// Exception
{
'name': 'exception',
'parentId': 0,
'id': 10024,
'meta': {
'title': '异常页',
'icon': 'warning',
'show': true
},
'redirect': '/exception/403',
'component': 'RouteView'
},
{
'name': '403',
'parentId': 10024,
'id': 10025,
'meta': {
'title': '403',
'show': true
},
'component': 'Exception403'
},
{
'name': '404',
'parentId': 10024,
'id': 10026,
'meta': {
'title': '404',
'show': true
},
'component': 'Exception404'
},
{
'name': '500',
'parentId': 10024,
'id': 10027,
'meta': {
'title': '500',
'show': true
},
'component': 'Exception500'
},
// account
{
'name': 'account',
'parentId': 0,
'id': 10028,
'meta': {
'title': '个人页',
'icon': 'user',
'show': true
},
'redirect': '/account/center',
'component': 'RouteView'
},
{
'name': 'center',
'parentId': 10028,
'id': 10029,
'meta': {
'title': '个人中心',
'show': true
},
'component': 'AccountCenter'
},
// 特殊三级菜单
{
'name': 'settings',
'parentId': 10028,
'id': 10030,
'meta': {
'title': '个人设置',
'hideHeader': true,
'hideChildren': true,
'show': true
},
'redirect': '/account/settings/base',
'component': 'AccountSettings'
},
{
'name': 'BaseSettings',
'path': '/account/settings/base',
'parentId': 10030,
'id': 10031,
'meta': {
'title': '基本设置',
'show': false
},
'component': 'BaseSettings'
},
{
'name': 'SecuritySettings',
'path': '/account/settings/security',
'parentId': 10030,
'id': 10032,
'meta': {
'title': '安全设置',
'show': false
},
'component': 'SecuritySettings'
},
{
'name': 'CustomSettings',
'path': '/account/settings/custom',
'parentId': 10030,
'id': 10033,
'meta': {
'title': '个性化设置',
'show': false
},
'component': 'CustomSettings'
},
{
'name': 'BindingSettings',
'path': '/account/settings/binding',
'parentId': 10030,
'id': 10034,
'meta': {
'title': '账户绑定',
'show': false
},
'component': 'BindingSettings'
},
{
'name': 'NotificationSettings',
'path': '/account/settings/notification',
'parentId': 10030,
'id': 10034,
'meta': {
'title': '新消息通知',
'show': false
},
'component': 'NotificationSettings'
}
]
const json = builder(nav)
console.log('json', json)
return json
}
Mock.mock(/\/api\/user\/info/, 'get', info)
Mock.mock(/\/api\/user\/nav/, 'get', userNav)

View File

@ -1,38 +0,0 @@
const responseBody = {
message: '',
timestamp: 0,
result: null,
code: 0
}
export const builder = (data, message, code = 0, headers = {}) => {
responseBody.result = data
if (message !== undefined && message !== null) {
responseBody.message = message
}
if (code !== undefined && code !== 0) {
responseBody.code = code
responseBody._status = code
}
if (headers !== null && typeof headers === 'object' && Object.keys(headers).length > 0) {
responseBody._headers = headers
}
responseBody.timestamp = new Date().getTime()
return responseBody
}
export const getQueryParameters = (options) => {
const url = options.url
const search = url.split('?')[1]
if (!search) {
return {}
}
return JSON.parse('{"' + decodeURIComponent(search)
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"') + '"}')
}
export const getBody = (options) => {
return options.body && JSON.parse(options.body)
}

View File

@ -1,5 +0,0 @@
module.exports = {
env: {
jest: true
}
}