Skip to content

Commit

Permalink
新增角色设置,部门设置。优化首页以及登录跳转提示
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Jan 9, 2018
1 parent a13d778 commit 7f2cdcc
Show file tree
Hide file tree
Showing 12 changed files with 589 additions and 158 deletions.
4 changes: 2 additions & 2 deletions src/api/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function login(username, password) {

export function getInfo(token) {
return fetch({
url: '/user/userinfo',
url: '/admin/userinfo',
method: 'post',
data: {
auth:token
Expand All @@ -23,7 +23,7 @@ export function getInfo(token) {

export function logout() {
return fetch({
url: '/user/logout',
url: '/admin/logout',
method: 'post'
})
}
39 changes: 39 additions & 0 deletions src/api/system/dept.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import fetch from '@/utils/fetch'
export function GetDepts(){
return fetch({
url: '/admin/pulldeptlist',
method: 'post'
})
}

export function DeleteDept(ID){
return fetch({
url: '/admin/Deldept',
method: 'post',
params:{ID}
})
}

export function GetDeptDetail(ID){
return fetch({
url: '/admin/PulldeptDetail',
method: 'post',
params:{ID}
})
}

export function SaveNewDept(data){
return fetch({
url: '/admin/SaveNewdept',
method: 'post',
data
})
}

export function UpdateDept(data){
return fetch({
url: '/admin/Updatedept',
method: 'post',
data
})
}
39 changes: 39 additions & 0 deletions src/api/system/role.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import fetch from '@/utils/fetch'
export function GetRoles(){
return fetch({
url: '/admin/pullrolelist',
method: 'post'
})
}

export function DeleteRole(ID){
return fetch({
url: '/admin/Delrole',
method: 'post',
params:{ID}
})
}

export function GetRoleDetail(ID){
return fetch({
url: '/admin/PullroleDetail',
method: 'post',
params:{ID}
})
}

export function SaveNewRole(data){
return fetch({
url: '/admin/SaveNewrole',
method: 'post',
data
})
}

export function UpdateRole(data){
return fetch({
url: '/admin/Updaterole',
method: 'post',
data
})
}
10 changes: 5 additions & 5 deletions src/api/system/users.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import fetch from '@/utils/fetch'
export function GetUsers(){
return fetch({
url: '/user/pulluserlist',
url: '/admin/pulluserlist',
method: 'post'
})
}

export function DeleteUser(ID){
return fetch({
url: '/user/DelUser',
url: '/admin/DelUser',
method: 'post',
params:{ID}
})
}

export function GetUsersDetail(ID){
return fetch({
url: '/user/PullUsersDetail',
url: '/admin/PullUsersDetail',
method: 'post',
params:{ID}
})
}

export function SaveNewUsers(data){
return fetch({
url: '/user/SaveNewUsers',
url: '/admin/SaveNewUsers',
method: 'post',
data
})
}

export function UpdateUsers(data){
return fetch({
url: '/user/UpdateUsers',
url: '/admin/UpdateUsers',
method: 'post',
data
})
Expand Down
16 changes: 10 additions & 6 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ export const constantRouterMap = [
name: 'Dashboard',
hidden: true,
children: [{ path: 'dashboard', component: _import('dashboard/index') }]
},

{ path: '*', redirect: '/404', hidden: true }

}
]

export default new Router({
Expand All @@ -38,14 +35,21 @@ export default new Router({
})

export const asyncRouterMap = [

{
path: '/system',
component: Layout,
redirect: 'noredirect',
name: '系统设置',
icon: 'zujian',
meta: { role: ['system']},
children: [
{ path: 'index', name: '用户设置', icon: 'zonghe', component: _import('system/users') }
{ path: 'users', name: '用户设置', icon: 'icons', component: _import('system/users'),meta: { role: ['system'] }},

{ path: 'role', name: '角色设置', icon: 'icons', component: _import('system/role'),meta: { role: ['system'] }},
{ path: 'dept', name: '部门设置', icon: 'icons', component: _import('system/dept'),meta: { role: ['system'] }},


]
},

Expand All @@ -55,7 +59,7 @@ export const asyncRouterMap = [
redirect: '/table/index',
icon: 'tubiao',
noDropdown: true,
children: [{ path: 'index', name: 'Table', component: _import('table/index'), meta: { role: ['admin'] }}]
children: [{ path: 'index', name: 'Table', component: _import('table/index'), meta: { role: ['user'] }}]
},

{ path: '*', redirect: '/404', hidden: true }
Expand Down
16 changes: 14 additions & 2 deletions src/views/dashboard/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<template>
<div class="dashboard-container">
<div class='dashboard-text'>name:{{name}}</div>
<div class='dashboard-text'>role:<span v-for='role in roles' :key='role'>{{role}}</span></div>
<div class="dashboard-title">Anshare Vue Admin</div>
<div class='dashboard-text'>用户:{{name}}</div>
<div class='dashboard-text'>角色:<span v-for='role in roles' :key='role'>{{role}}</span></div>

</div>
</template>

Expand All @@ -20,10 +22,20 @@ export default {

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard {
&-title{
text-align: center;
font-family: inherit;
font-size:50px;
}
&-container {
text-align: center;
margin: 30px;
}
&-text {
text-align: center;
margin: 30px;
font-size: 30px;
line-height: 46px;
}
Expand Down
11 changes: 11 additions & 0 deletions src/views/layout/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ export default {
sidebar() {
return this.$store.state.app.sidebar
}
},
created(){
this.$notify({
title: '欢迎回来',
type:'success',
duration:2000,
customClass:'.notify',
message: this.$store.getters.name
});
}
}
</script>
Expand Down Expand Up @@ -77,5 +86,7 @@ export default {
transition: all .28s ease-out;
margin-left: 200px;
}
}
</style>
2 changes: 1 addition & 1 deletion src/views/layout/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default {
this.$store.dispatch('ToggleSideBar')
},
logout() {
this.$store.dispatch('LogOut').then(() => {
this.$store.dispatch('FedLogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug
})
}
Expand Down
Loading

0 comments on commit 7f2cdcc

Please sign in to comment.