【更新】优化样式,剔除多余代码,移除mock

This commit is contained in:
小诺 2021-05-05 00:02:39 +08:00 committed by 15099670051
parent eb7c4e182a
commit 7116d314b5
17 changed files with 180 additions and 2297 deletions

View File

@ -8,12 +8,12 @@
<div v-if="mode === 'sidemenu'" class="header">
<a-menu
style="height: 55px"
style="height: 55px; border-bottom: 0px;"
mode="horizontal"
:default-selected-keys="this.defApp"
>
<a-icon v-if="device==='mobile'" class="trigger" :type="collapsed ? 'menu-fold' : 'menu-unfold'" @click="toggle"/>
<a-icon v-else class="trigger" :type="collapsed ? 'menu-unfold' : 'menu-fold'" @click="toggle"/>
<a-icon v-else class="trigger" :type="collapsed ? 'menu-unfold' : 'menu-fold'" @click="toggle" style="padding-left: 20px; padding-right: 20px;"/>
<a-menu-item v-for="(item) in userInfo.apps" :key="item.code" style="top:0px; line-height: 55px; padding-left: 10px; padding-right: 10px" @click="switchApp(item.code)">
{{ item.name }}

View File

@ -136,7 +136,7 @@ export default {
const panes = pages.map(page => {
return (
<a-tab-pane
style={{ height: 0 }}
style={{ height: 0, background: '#8999ee', color: '#899ee' }}
tab={this.renderTabPane(page.meta.customTitle || page.meta.title, page.fullPath)}
key={page.fullPath} closable={pages.length > 1}
>
@ -148,9 +148,10 @@ export default {
<div class="ant-pro-multi-tab-wrapper">
<a-tabs
hideAdd
tabBarGutter={-1}
type={'editable-card'}
v-model={this.activeKey}
tabBarStyle={{ background: '#FFF', margin: 0, paddingLeft: '16px', paddingTop: '1px' }}
tabBarStyle={{ background: '#FFF', margin: 0, paddingLeft: '0px', paddingTop: '0px' }}
{...{ on: { edit: onEdit } }}>
{panes}
</a-tabs>

View File

@ -1,9 +1,6 @@
import { message } from 'ant-design-vue/es'
// import defaultSettings from '../defaultSettings';
import themeColor from './themeColor.js'
// let lessNodesAppended
const colorList = [
{
key: '薄暮', color: '#F5222D'
@ -40,65 +37,6 @@ const updateTheme = newPrimaryColor => {
})
}
/*
const updateTheme = primaryColor => {
// Don't compile less in production!
/* if (process.env.NODE_ENV === 'production') {
return;
} * /
// Determine if the component is remounted
if (!primaryColor) {
return
}
const hideMessage = message.loading('正在编译主题', 0)
function buildIt () {
if (!window.less) {
return
}
setTimeout(() => {
window.less
.modifyVars({
'@primary-color': primaryColor
})
.then(() => {
hideMessage()
})
.catch(() => {
message.error('Failed to update theme')
hideMessage()
})
}, 200)
}
if (!lessNodesAppended) {
// insert less.js and color.less
const lessStyleNode = document.createElement('link')
const lessConfigNode = document.createElement('script')
const lessScriptNode = document.createElement('script')
lessStyleNode.setAttribute('rel', 'stylesheet/less')
lessStyleNode.setAttribute('href', '/color.less')
lessConfigNode.innerHTML = `
window.less = {
async: true,
env: 'production',
javascriptEnabled: true
};
`
lessScriptNode.src = 'https://gw.alipayobjects.com/os/lib/less.js/3.8.1/less.min.js'
lessScriptNode.async = true
lessScriptNode.onload = () => {
buildIt()
lessScriptNode.onload = null
}
document.body.appendChild(lessStyleNode)
document.body.appendChild(lessConfigNode)
document.body.appendChild(lessScriptNode)
lessNodesAppended = true
} else {
buildIt()
}
}
*/
const updateColorWeak = colorWeak => {
// document.body.className = colorWeak ? 'colorWeak' : '';
const app = document.body.querySelector('#app')

View File

@ -13,11 +13,10 @@ import {
DEFAULT_CONTENT_WIDTH_TYPE,
DEFAULT_MULTI_TAB
} from '@/store/mutation-types'
import config from '@/config/defaultSettings'
export default function Initializer () {
// console.log(`API_URL: ${process.env.VUE_APP_API_BASE_URL}`)
store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true))
store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, config.navTheme))
store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, config.layout))
@ -29,6 +28,4 @@ export default function Initializer () {
store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, config.primaryColor))
store.commit('TOGGLE_MULTI_TAB', Vue.ls.get(DEFAULT_MULTI_TAB, config.multiTab))
store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
// last step
}

View File

@ -1,4 +1,3 @@
/**
* 该文件是为了按需加载剔除掉了一些不需要的框架组件
* 减少了编译支持库包大小

View File

@ -1,4 +1,3 @@
// with polyfills
import 'core-js/stable'
import 'regenerator-runtime/runtime'
import Vue from 'vue'
@ -6,16 +5,13 @@ import App from './App.vue'
import router from './router'
import store from './store/'
import { VueAxios } from './utils/request'
// WARNING: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.
import './mock'
import bootstrap from './core/bootstrap'
import './core/lazy_use'
import './permission' // permission control
import './utils/filter' // global filter
import './permission'
import './utils/filter'
import './components/global.less'
import { Dialog } from '@/components'
import { hasBtnPermission } from './utils/permissions' // button permission
import { hasBtnPermission } from './utils/permissions'
import { sysApplication } from './utils/applocation'
Vue.use(VueAxios)

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('[antd-pro] ERROR: `mockjs` NOT SUPPORT `IE` PLEASE DO NOT USE IN `production` ENV.')
}
// 使用同步加载依赖
// 防止 vuex 中的 GetInfo 早于 mock 运行导致无法 mock 请求返回结果
console.log('[antd-pro] 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('[antd-pro] mock mounted')
}

View File

@ -1,89 +0,0 @@
import Mock from 'mockjs2'
import { builder, getQueryParameters } from '../util'
const titles = [
'Alipay',
'Angular',
'Ant Design',
'Snowy',
'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: 'Snowy',
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,973 +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":"edit","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': 'edit',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}],
'actionList': ['delete', 'edit'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'member',
'permissionName': '会员管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","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': 'edit',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': ['query', 'get', 'edit', 'delete'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'menu',
'permissionName': '菜单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","defaultCheck":false,"describe":"修改"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'import',
'describe': '导入',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'edit',
'describe': '修改',
'defaultCheck': false
}
],
'actionList': ['add', 'import'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'order',
'permissionName': '订单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","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': 'edit',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': ['query', 'add', 'get'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'permission',
'permissionName': '权限管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'edit',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': ['add', 'get', 'edit', 'delete'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'role',
'permissionName': '角色管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'edit',
'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":"edit","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': 'edit',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
},
{
'action': 'export',
'describe': '导出',
'defaultCheck': false
}
],
'actionList': ['add', 'get'],
'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":"edit","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': 'edit',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': ['add', 'get', 'delete'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'member',
'permissionName': '会员管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","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': ['add', 'query', 'get'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'menu',
'permissionName': '菜单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","defaultCheck":false,"describe":"修改"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'import',
'describe': '导入',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
}
],
'actionList': ['add', 'get'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'order',
'permissionName': '订单管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","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': 'edit',
'describe': '修改',
'defaultCheck': false
}
],
'actionList': ['add', 'query'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'permission',
'permissionName': '权限管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'get',
'describe': '详情',
'defaultCheck': false
},
{
'action': 'edit',
'describe': '修改',
'defaultCheck': false
}
],
'actionList': ['add', 'get', 'edit'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'role',
'permissionName': '角色管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'actionEntitySet': [{
'action': 'add',
'describe': '新增',
'defaultCheck': false
},
{
'action': 'edit',
'describe': '修改',
'defaultCheck': false
},
{
'action': 'delete',
'describe': '删除',
'defaultCheck': false
}
],
'actionList': null,
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'test',
'permissionName': '测试权限',
'actions': '[]',
'actionEntitySet': [],
'actionList': ['add', 'edit'],
'dataAccess': null
},
{
'roleId': 'admin',
'permissionId': 'user',
'permissionName': '用户管理',
'actions': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"import","defaultCheck":false,"describe":"导入"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"edit","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': 'edit',
'describe': '修改',
'defaultCheck': false
}
],
'actionList': ['add'],
'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': ['query'],
'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":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': null,
'parents': null,
'type': null,
'deleted': 0,
'actions': [
'add',
'query',
'get',
'edit',
'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":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'query',
'get',
'edit',
'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":"edit","defaultCheck":false,"describe":"修改"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'import',
'get',
'edit'
]
},
{
'id': 'order',
'name': '订单管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'query',
'get',
'edit',
'delete'
]
},
{
'id': 'permission',
'name': '权限管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get',
'edit',
'delete'
]
},
{
'id': 'role',
'name': '角色管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get',
'edit',
'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":"edit","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":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': null,
'parents': null,
'type': null,
'deleted': 0,
'actions': [
'add',
'query',
'get',
'edit',
'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":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'query',
'get',
'edit',
'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":"edit","defaultCheck":false,"describe":"修改"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'import',
'get',
'edit'
]
},
{
'id': 'order',
'name': '订单管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"query","defaultCheck":false,"describe":"查询"},{"action":"get","defaultCheck":false,"describe":"详情"},{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'query',
'get',
'edit',
'delete'
]
},
{
'id': 'permission',
'name': '权限管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get',
'edit',
'delete'
]
},
{
'id': 'role',
'name': '角色管理',
'describe': null,
'status': 1,
'actionData': '[{"action":"add","defaultCheck":false,"describe":"新增"},{"action":"get","defaultCheck":false,"describe":"查询"},{"action":"edit","defaultCheck":false,"describe":"修改"},{"action":"delete","defaultCheck":false,"describe":"删除"}]',
'sptDaTypes': null,
'optionalFields': '[]',
'parents': null,
'type': 'default',
'deleted': 0,
'actions': [
'add',
'get',
'edit',
'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.vue',
'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': '仪表盘77',
'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.vue',
'parentId': 0,
'id': 10,
'meta': {
'icon': 'form.vue',
'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

@ -96,7 +96,6 @@
<script>
import { PageView, RouteView } from '@/layouts'
import { AppPage, ArticlePage, ProjectPage } from './page'
import { mapGetters } from 'vuex'
export default {
@ -141,10 +140,33 @@ export default {
...mapGetters(['nickname', 'avatar']),
getTeams () {
this.$http.get('/workplace/teams').then(res => {
this.teams = res.result
this.teamSpinning = false
})
this.teams = [{
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'
}
]
this.teamSpinning = false
},
handleTabChange (key, type) {

View File

@ -45,11 +45,39 @@ export default {
},
methods: {
getList () {
this.$http.get('/list/article').then(res => {
console.log('res', res)
this.data = res.result
this.loading = false
})
this.data = [
{
updatedAt: '2021-05-01 12:00:00',
title: '小诺',
owner: '俞宝山',
description: 'snowy是小诺团队产品',
href: 'https://xiaonuo.vip',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/ZiESqWwCXBRQoaPONSJe.png',
name: '曲丽丽',
id: 'member1'
},
{
updatedAt: '2021-05-01 12:00:00',
title: '小诺',
owner: '徐玉祥',
description: 'snowy是小诺团队产品',
href: 'https://xiaonuo.vip',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/tBOxZPlITHqwlGjsJWaF.png',
name: '王昭君',
id: 'member2'
},
{
updatedAt: '2021-05-01 12:00:00',
title: '小诺',
owner: '董夏雨',
description: 'snowy是小诺团队产品',
href: 'https://xiaonuo.vip',
avatar: 'https://gw.alipayobjects.com/zos/rmsportal/sBxjgqiuHMGRkIjqlQCd.png',
name: '董娜娜',
id: 'member3'
}
]
this.loading = false
},
loadMore () {
this.loadingMore = false

View File

@ -64,11 +64,117 @@ export default {
console.log(`selected ${value}`)
},
getList () {
this.$http.get('/list/article', { params: { count: 8 } }).then(res => {
console.log('res', res)
this.data = res.result
this.loading = false
})
this.data = [
{
id: '123',
cover: 'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png',
content: '段落示意:蚂蚁金服设计平台 ant.design用最小的工作量无缝接入蚂蚁金服生态提供跨越设计与开发的体验解决方案。',
message: '消息',
description: '小诺框架产品',
href: 'https://xiaonuo.vip',
title: '小诺',
updatedAt: '2021-05-01 12:00:00',
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'
}
]
},
{
id: '1234',
cover: 'https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png',
content: '段落示意:蚂蚁金服设计平台 ant.design用最小的工作量无缝接入蚂蚁金服生态提供跨越设计与开发的体验解决方案。',
message: '消息',
description: '小诺框架产品',
href: 'https://xiaonuo.vip',
title: '小诺',
updatedAt: '2021-05-01 12:00:00',
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'
}
]
},
{
id: '12345',
cover: 'https://gw.alipayobjects.com/zos/rmsportal/iXjVmWVHbCJAyqvDxdtx.png',
content: '段落示意:蚂蚁金服设计平台 ant.design用最小的工作量无缝接入蚂蚁金服生态提供跨越设计与开发的体验解决方案。',
message: '消息',
description: '小诺框架产品',
href: 'https://xiaonuo.vip',
title: '小诺',
updatedAt: '2021-05-01 12:00:00',
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'
}
]
},
{
id: '1236',
cover: 'https://gw.alipayobjects.com/zos/rmsportal/gLaIAoVWTtLbBWZNYEMg.png',
content: '段落示意:蚂蚁金服设计平台 ant.design用最小的工作量无缝接入蚂蚁金服生态提供跨越设计与开发的体验解决方案。',
message: '消息',
description: '小诺框架产品',
href: 'https://xiaonuo.vip',
title: '小诺',
updatedAt: '2021-05-01 12:00:00',
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'
}
]
}
]
this.loading = false
}
}
}