Skip to content

Commit

Permalink
add mock,未完待续
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongzhenlong committed Sep 26, 2017
1 parent 2ecf333 commit ec0f654
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"animate.css": "3.5.2",
"axios": "^0.16.2",
"babel-polyfill": "^6.23.0",
"echarts": "^3.7.1",
"echarts": "^3.5.1",
"element-ui": "^1.4.3",
"eventsource-polyfill": "^0.9.6",
"font-awesome": "^4.7.0",
Expand Down
5 changes: 0 additions & 5 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ export const SYS_USER_PAGE = CONTEXT + '/sys/user/page';
export const SYS_USER_ROLE = CONTEXT + '/sys/user/roleIds';
export const SYS_SET_USER_ROLE = CONTEXT + '/sys/user/setRoles';


export const UPLOAD_FORM_FILE = CONTEXT + '/upload/imageUpload';
export const UPLOAD_FORM_FILE_TEMP = CONTEXT + '/upload/formFile';
export const UPLOAD_FORM_FILE_BATCH = CONTEXT + '/upload/batch';

export const MSG_TOP_TEN = CONTEXT + '/messageList';
export const TEST_DATA = CONTEXT + '/static/data/data.json';

14 changes: 10 additions & 4 deletions src/components/sideMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<el-menu :default-active="onRoutes"
:default-openeds="onRouteKeys"
class="el-menu-vertical-demo"
theme="dark" router :collapse="sidebar.collapsed&&!device.isMobile" @select="handleSelect">
theme="light" router :collapse="sidebar.collapsed&&!device.isMobile" @select="handleSelect">
<template v-for="item in menuList">
<sub-menu :param="item"></sub-menu>
</template>
Expand All @@ -16,7 +16,7 @@
<el-menu :default-active="onRoutes"
:default-openeds="onRouteKeys"
class="el-menu-vertical-demo"
theme="dark" router :collapse="sidebar.collapsed&&!device.isMobile" @select="handleSelect">
theme="light" router :collapse="sidebar.collapsed&&!device.isMobile" @select="handleSelect">
<template v-for="item in menuList">
<sub-menu :param="item"></sub-menu>
</template>
Expand Down Expand Up @@ -112,7 +112,7 @@
}
.main-sidebar {
background-color: #324157;
background-color: #ffffff;
position: fixed;
top: 50px;
left: 0;
Expand All @@ -129,6 +129,12 @@
.expandSide {
width: 230px;
}
.el-menu,.el-submenu .el-menu{
background-color: #ffffff;
}
.el-menu-item:hover,.el-submenu .el-menu-item:hover,.el-submenu__title:hover{
background-color: #eeeeee;
}
.el-menu-vertical-demo .el-submenu .el-menu-item {
height: 45px;
Expand All @@ -149,7 +155,7 @@
}
.vue-scrollbar{
background-color: #324157 !important;
background-color: #ffffff !important;
height: calc(100vh - 50px)
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ axios.interceptors.response.use(
error => {
if (error.response) {
//全局ajax错误信息提示
// Element.MessageBox({type:"error",message:error.response.data,title:"温馨提示"});
Element.MessageBox({type:"error",message:error.response.data,title:"温馨提示"});
}
return Promise.reject(error);
});
Expand Down
77 changes: 76 additions & 1 deletion src/mock/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,86 @@ let listData = Mock.mock({
],
})

const resourceList = [{"id":52,"parentId":null,"sort":0,"name":"登录","code":"/login","type":3,"usable":"1","remarks":"","children":[]},
{"id":68,"parentId":null,"sort":0,"name":"仪表盘","code":"/index","type":1,"usable":"1","remarks":"","children":[]},
{"id":69,"parentId":null,"sort":0,"name":"系统管理","code":"/sys","type":1,"usable":"1","remarks":"","children":[{"id":82,"parentId":69,"sort":0,"name":"资源管理","code":"/sys/resource","type":1,"usable":"1","remarks":"","children":[{"id":99,"parentId":82,"sort":0,"name":"/sys/resource/get","code":"/sys/resource/get","type":3,"usable":"1","remarks":"","children":[]},
{"id":100,"parentId":82,"sort":0,"name":"/sys/resource/update","code":"/sys/resource/update","type":3,"usable":"1","remarks":"","children":[]},
{"id":101,"parentId":82,"sort":0,"name":"/sys/resource/delete","code":"/sys/resource/delete","type":3,"usable":"1","remarks":"","children":[]},
{"id":102,"parentId":82,"sort":0,"name":"/sys/resource/add","code":"/sys/resource/add","type":3,"usable":"1","remarks":"","children":[]},
{"id":103,"parentId":82,"sort":0,"name":"/sys/resource/page","code":"/sys/resource/page","type":3,"usable":"1","remarks":"","children":[]},
{"id":104,"parentId":82,"sort":0,"name":"/sys/resource/list","code":"/sys/resource/list","type":3,"usable":"1","remarks":"","children":[]},
{"id":105,"parentId":82,"sort":0,"name":"/sys/resource/list2","code":"/sys/resource/list2","type":3,"usable":"1","remarks":"","children":[]}]},
{"id":70,"parentId":69,"sort":1,"name":"菜单管理","code":"/sys/menuList","type":1,"usable":"1","remarks":"","children":[{"id":83,"parentId":70,"sort":0,"name":"/sys/menu/get","code":"/sys/menu/get","type":3,"usable":"1","remarks":"","children":[]},
{"id":84,"parentId":70,"sort":0,"name":"/sys/menu/update","code":"/sys/menu/update","type":3,"usable":"1","remarks":"","children":[]},
{"id":85,"parentId":70,"sort":0,"name":"/sys/menu/delete","code":"/sys/menu/delete","type":3,"usable":"1","remarks":"","children":[]},
{"id":86,"parentId":70,"sort":0,"name":"/sys/menu/add","code":"/sys/menu/add","type":3,"usable":"1","remarks":"","children":[]},
{"id":87,"parentId":70,"sort":0,"name":"/sys/menu/page","code":"/sys/menu/page","type":3,"usable":"1","remarks":"","children":[]},
{"id":88,"parentId":70,"sort":0,"name":"/sys/menu/list","code":"/sys/menu/list","type":3,"usable":"1","remarks":"","children":[]},
{"id":89,"parentId":70,"sort":0,"name":"/sys/menu/list2","code":"/sys/menu/list2","type":3,"usable":"1","remarks":"","children":[]}]},
{"id":71,"parentId":69,"sort":3,"name":"角色管理","code":"/sys/roleList","type":1,"usable":"1","remarks":"","children":[{"id":90,"parentId":71,"sort":0,"name":"/sys/role/get","code":"/sys/role/get","type":3,"usable":"1","remarks":"","children":[]},
{"id":91,"parentId":71,"sort":0,"name":"/sys/role/update","code":"/sys/role/update","type":3,"usable":"1","remarks":"","children":[]},
{"id":92,"parentId":71,"sort":0,"name":"/sys/role/delete","code":"/sys/role/delete","type":3,"usable":"1","remarks":"","children":[]},
{"id":93,"parentId":71,"sort":0,"name":"/sys/role/add","code":"/sys/role/add","type":3,"usable":"1","remarks":"","children":[]},
{"id":94,"parentId":71,"sort":0,"name":"/sys/role/page","code":"/sys/role/page","type":3,"usable":"1","remarks":"","children":[]},
{"id":95,"parentId":71,"sort":0,"name":"/sys/role/list","code":"/sys/role/list","type":3,"usable":"1","remarks":"","children":[]},
{"id":96,"parentId":71,"sort":0,"name":"/sys/role/list2","code":"/sys/role/list2","type":3,"usable":"1","remarks":"","children":[]},
{"id":97,"parentId":71,"sort":0,"name":"/sys/role/resources","code":"/sys/role/resources","type":3,"usable":"1","remarks":"","children":[]},
{"id":98,"parentId":71,"sort":0,"name":"/sys/role/setResources","code":"/sys/role/setResources","type":3,"usable":"1","remarks":"","children":[]}]},
{"id":72,"parentId":69,"sort":6,"name":"用户管理","code":"/sys/userList","type":1,"usable":"1","remarks":"","children":[{"id":106,"parentId":72,"sort":0,"name":"/sys/user/get","code":"/sys/user/get","type":3,"usable":"1","remarks":"","children":[]},
{"id":107,"parentId":72,"sort":0,"name":"/sys/user/add","code":"/sys/user/add","type":3,"usable":"1","remarks":"","children":[]},
{"id":108,"parentId":72,"sort":0,"name":"/sys/user/update","code":"/sys/user/update","type":3,"usable":"1","remarks":"","children":[]},
{"id":109,"parentId":72,"sort":0,"name":"/sys/user/delete","code":"/sys/user/delete","type":3,"usable":"1","remarks":"","children":[]},
{"id":110,"parentId":72,"sort":0,"name":"/sys/user/page","code":"/sys/user/page","type":3,"usable":"1","remarks":"","children":[]},
{"id":111,"parentId":72,"sort":0,"name":"/sys/user/roleIds","code":"/sys/user/roleIds","type":3,"usable":"1","remarks":"","children":[]},
{"id":112,"parentId":72,"sort":0,"name":"/sys/user/setRoles","code":"/sys/user/setRoles","type":3,"usable":"1","remarks":"","children":[]}]}]}]

let database = listData.data
const menuList = [
{"id":1,"parentId":null,"sort":0,"name":"仪表盘","href":"/index","icon":"fa fa-dashboard","children":[],
"isShow":"1"},
{"id":31,"parentId":null,"sort":1,"name":"测试1","href":"/test/1","icon":"fa fa-upload","children":
[
{"id":92,"parentId":31,"sort":0,"name":"测试1-1","href":"/test/1/1","icon":"fa fa-bank","children":[
{"id":912,"parentId":92,"sort":0,"name":"测试1-1-1","href":"/test/1/1/1","icon":"fa fa-bank","children":[],"isShow":"1"},
{"id":913,"parentId":92,"sort":0,"name":"测试1-1-2","href":"/test/1/1/2","icon":"fa fa-area-chart","children":[],"isShow":"1"}
],"isShow":"1"},
{"id":93,"parentId":31,"sort":0,"name":"测试1-2","href":"/test/1/2","icon":"fa fa-area-chart","children":[],"isShow":"1"}
]
,"isShow":"1"},
{"id":102,"parentId":null,"sort":3,"name":"测试2","href":"/test/2","icon":"fa fa-download","children":
[
{"id":103,"parentId":102,"sort":0,"name":"测试2-1","href":"/test/2/1","icon":"fa fa-image","children":[],"isShow":"1"}
]
,"isShow":"1"},
{"id":6,"parentId":null,"sort":6,"name":"系统管理","href":"/sys","icon":"fa fa-cog","children":
[
{"id":108,"parentId":6,"sort":0,"name":" 资源管理","href":"/sys/resource","icon":"fa fa-database","children":[],"isShow":"1"},
{"id":7,"parentId":6,"sort":1,"name":"菜单管理","href":"/sys/menuList","icon":"fa fa-navicon","children":[],"isShow":"1"},
{"id":8,"parentId":6,"sort":2,"name":"角色管理","href":"/sys/roleList","icon":"fa fa-universal-access","children":[],"isShow":"1"},
{"id":9,"parentId":6,"sort":3,"name":"用户管理","href":"/sys/userList","icon":"fa fa-user-plus","children":[],"isShow":"1"}
]
,"isShow":"1"}]

const roleList = [
{"id":26,"delFlag":0,"parentId":null,"sort":0,"name":"超级管理员","enName":"super_manager","usable":"1","remarks":"","children":[]},
{"id":27,"delFlag":0,"parentId":null,"sort":1,"name":"客服主管","enName":"server_manager","usable":"1","remarks":"","children":[
{"id":28,"delFlag":0,"parentId":27,"sort":0,"name":"售后客服","enName":"server1","usable":"1","remarks":"","children":[]},
{"id":29,"delFlag":0,"parentId":27,"sort":1,"name":"售前客服","enName":"server2","usable":"1","remarks":"","children":[]}
]}
]

let database = listData.data

module.exports = {
'GET /messageList': function (req, res) {
res.status(200).json(database)
},
'GET /sys/resource/list':function (req, res) {
res.status(200).json(resourceList)
},
'GET /sys/menu/list':function (req, res) {
res.status(200).json(menuList)
},
'GET /sys/role/list':function (req, res) {
res.status(200).json(roleList)
},
}
2 changes: 1 addition & 1 deletion src/mock/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let usersListData = Mock.mock({
email: '@email',
createTime: '@datetime',
avatar () {
return Mock.Random.image('100x100', Mock.Random.color(), '#757575', 'png', this.name.substr(0, 1))
return Mock.Random.image('100x100', Mock.Random.color(), '#757575', 'png', this.nickName.substr(0, 1))
},
delFlag:0,
status:1,
Expand Down
33 changes: 18 additions & 15 deletions src/pages/layout/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<el-dropdown-menu>
<ul class="message-list">
<li v-for="item in list"><!-- start message -->
<router-link :to="{path:'/img/process/result',query:{id:item.entityId}}">
<router-link :to="{path:'/sys/message',query:{id:item.id}}">
<p>{{item.title}}</p>
</router-link>
</li>
Expand Down Expand Up @@ -143,6 +143,7 @@
.main-header a {
text-decoration: none;
color: #108ee9;
}
.main-header {
Expand All @@ -152,6 +153,7 @@
z-index: 9999;
animation-name: slideInDown;
animation-fill-mode: both;
color: #108ee9;
}
.main-header .navbar .sidebar-toggle {
Expand All @@ -168,7 +170,7 @@
}
.main-header .navbar .sidebar-toggle:hover {
color: #fff;
/*color: #fff;*/
}
.main-header .logo {
Expand Down Expand Up @@ -208,8 +210,9 @@
border: none;
min-height: 50px;
border-radius: 0;
background-color: #3c8dbc;
color: #ffffff;
/*background-color: #3c8dbc;*/
background-color: #ffffff;
/*color: #ffffff;*/
}
.layout-top-nav .main-header .navbar {
Expand All @@ -226,31 +229,31 @@
}
.main-header .navbar .sidebar-toggle {
color: #ffffff;
/*color: #ffffff;*/
display: block;
}
.main-header .navbar .sidebar-toggle:hover {
color: #f6f6f6;
/*color: #f6f6f6;*/
background: rgba(0, 0, 0, 0.1);
}
.main-header .navbar .sidebar-toggle {
color: #fff;
/*color: #fff;*/
}
.main-header .navbar .sidebar-toggle:hover {
background-color: #367fa9;
/*background-color: #367fa9;*/
}
.main-header .logo {
background-color: #367fa9;
color: #ffffff;
/*background-color: #367fa9;*/
/*color: #ffffff;*/
border-bottom: 0 solid transparent;
}
.main-header .logo:hover {
background-color: #357ca5;
/*background-color: #357ca5;*/
}
@media (max-width: 800px) {
Expand All @@ -277,8 +280,8 @@
display: none;
}
.main-header.closeLogo .sidebar-toggle {
background-color: #367fa9;
color: #f6f6f6;
/*background-color: #367fa9;*/
/*color: #f6f6f6;*/
background: rgba(0, 0, 0, 0.1);
}
Expand All @@ -296,7 +299,7 @@
.navbar-custom-menu .el-dropdown-link{
cursor: pointer;
color: #ffffff;
/*color: #ffffff;*/
height: 50px;
padding: 13px 5px;
min-width: 50px;
Expand Down Expand Up @@ -324,7 +327,7 @@
.el-dropdown-menu .header-pic{
text-align: center;
background-color: #3c8dbc;
background-color: #108ee9;
padding: 20px;
}
.el-dropdown-menu .header-pic img{
Expand Down
4 changes: 2 additions & 2 deletions src/pages/sys/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@
}
},
load(){
this.$http.get(api.TEST_DATA)
this.$http.get(api.SYS_MENU_LIST)
.then(res => {
this.menuTree = res.data.menuList;
this.menuTree = res.data;
}).catch((error) => {
console.log(error)
})
Expand Down
3 changes: 1 addition & 2 deletions src/pages/sys/resource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,8 @@
}
},
load(){
this.$http.get(api.TEST_DATA)
this.$http.get(api.SYS_RESOURCE_LIST)
.then(res=>{
res.data = res.data.resourceList;
this.resourceTree = [];
this.resourceTree.push(...res.data)
}).catch((error) => {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/sys/role.vue
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@
})
},
load(){
this.$http.get(api.TEST_DATA)
this.$http.get(api.SYS_ROLE_LIST)
.then(res => {
res.data = res.data.roleList;
this.roleTree = [];
this.roleTree.push(...res.data)
}).catch((error) => {
Expand Down
4 changes: 2 additions & 2 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ const store = new Vuex.Store({
//异步的函数
toggleLoading: ({commit}) => commit(types.TOGGLE_LOADING),
loadMenuList: ({commit}) => {
Vue.axios.get(api.TEST_DATA).then(res => {
commit(types.LOAD_MENU, res.data.menuList);
Vue.axios.get(api.SYS_MENU_LIST).then(res => {
commit(types.LOAD_MENU, res.data);
}).catch(exp => commit(types.LOAD_MENU, defaultMenu));
},
changeCurrentMenu: ({state,commit},{path,matched,fullPath}) => {
Expand Down

0 comments on commit ec0f654

Please sign in to comment.