Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
nizhengjia888
gin-vue-admin
提交
ef433ef4
G
gin-vue-admin
项目概览
nizhengjia888
/
gin-vue-admin
与 Fork 源项目一致
Fork自
FLIPPED-AURORA / gin-vue-admin
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gin-vue-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ef433ef4
编写于
12月 12, 2019
作者:
Mr.奇淼(
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
前端ui调整
上级
211b1f2d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
72 addition
and
117 deletion
+72
-117
QMPlusServer/controller/api/sys_api.go
QMPlusServer/controller/api/sys_api.go
+0
-19
QMPlusServer/controller/api/sys_authority.go
QMPlusServer/controller/api/sys_authority.go
+0
-20
QMPlusServer/init/registTable/regist_table.go
QMPlusServer/init/registTable/regist_table.go
+0
-1
QMPlusServer/model/sysModel/sys_api.go
QMPlusServer/model/sysModel/sys_api.go
+1
-1
QMPlusServer/model/sysModel/sys_api_authority.go
QMPlusServer/model/sysModel/sys_api_authority.go
+0
-35
QMPlusServer/router/sys_api.go
QMPlusServer/router/sys_api.go
+0
-2
QMPlusVuePage/src/view/layout/aside/index.vue
QMPlusVuePage/src/view/layout/aside/index.vue
+11
-3
QMPlusVuePage/src/view/layout/index.vue
QMPlusVuePage/src/view/layout/index.vue
+60
-36
未找到文件。
QMPlusServer/controller/api/sys_api.go
浏览文件 @
ef433ef4
...
...
@@ -60,25 +60,6 @@ type AuthAndPathIn struct {
ApiIds
[]
uint
`json:"apiIds"`
}
// @Tags SysApi
// @Summary 创建api和角色关系
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.AuthAndPathIn true "创建api和角色关系"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /api/setAuthAndApi [post]
func
SetAuthAndApi
(
c
*
gin
.
Context
)
{
var
authAndPathIn
AuthAndPathIn
_
=
c
.
BindJSON
(
&
authAndPathIn
)
err
:=
new
(
sysModel
.
SysApiAuthority
)
.
SetAuthAndApi
(
authAndPathIn
.
AuthorityId
,
authAndPathIn
.
ApiIds
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"添加失败:%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"添加成功"
,
gin
.
H
{})
}
}
//条件搜索后端看此api
// @Tags SysApi
...
...
QMPlusServer/controller/api/sys_authority.go
浏览文件 @
ef433ef4
...
...
@@ -89,23 +89,3 @@ type GetAuthorityId struct {
AuthorityId
string
`json:"authorityId"`
}
// @Tags authority
// @Summary 获取本角色所有有权限的apiId
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body api.GetAuthorityId true "获取本角色所有有权限的apiId"
// @Success 200 {string} json "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /authority/getAuthAndApi [post]
func
GetAuthAndApi
(
c
*
gin
.
Context
){
var
idInfo
GetAuthorityId
_
=
c
.
BindJSON
(
&
idInfo
)
err
,
apis
:=
new
(
sysModel
.
SysApiAuthority
)
.
GetAuthAndApi
(
idInfo
.
AuthorityId
)
if
err
!=
nil
{
servers
.
ReportFormat
(
c
,
false
,
fmt
.
Sprintf
(
"获取数据失败,%v"
,
err
),
gin
.
H
{})
}
else
{
servers
.
ReportFormat
(
c
,
true
,
"获取数据成功"
,
gin
.
H
{
"apis"
:
apis
,
})
}
}
\ No newline at end of file
QMPlusServer/init/registTable/regist_table.go
浏览文件 @
ef433ef4
...
...
@@ -12,7 +12,6 @@ func RegistTable(db *gorm.DB) {
sysModel
.
SysAuthority
{},
sysModel
.
SysMenu
{},
sysModel
.
SysApi
{},
sysModel
.
SysApiAuthority
{},
sysModel
.
SysBaseMenu
{},
dbModel
.
ExaFileUploadAndDownload
{},
sysModel
.
SysWorkflow
{},
...
...
QMPlusServer/model/sysModel/sys_api.go
浏览文件 @
ef433ef4
...
...
@@ -27,7 +27,7 @@ func (a *SysApi) CreateApi() (err error) {
func
(
a
*
SysApi
)
DeleteApi
()
(
err
error
)
{
err
=
qmsql
.
DEFAULTDB
.
Delete
(
a
)
.
Error
err
=
qmsql
.
DEFAULTDB
.
Where
(
"api_id = ?"
,
a
.
ID
)
.
Unscoped
()
.
Delete
(
&
SysApiAuthority
{})
.
Error
new
(
CasbinModel
)
.
clearCasbin
(
1
,
a
.
Path
)
return
err
}
...
...
QMPlusServer/model/sysModel/sys_api_authority.go
已删除
100644 → 0
浏览文件 @
211b1f2d
package
sysModel
import
(
"github.com/jinzhu/gorm"
"main/init/qmsql"
)
type
SysApiAuthority
struct
{
gorm
.
Model
AuthorityId
string
Authority
SysAuthority
`gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
//其实没有关联的必要
ApiId
uint
Api
SysApi
}
//创建角色api关联关系
func
(
a
*
SysApiAuthority
)
SetAuthAndApi
(
authId
string
,
apisid
[]
uint
)
(
err
error
)
{
for
_
,
v
:=
range
apisid
{
err
=
qmsql
.
DEFAULTDB
.
Create
(
&
SysApiAuthority
{
AuthorityId
:
authId
,
ApiId
:
v
})
.
Error
if
err
!=
nil
{
return
err
}
}
return
nil
}
// 获取角色api关联关系
func
(
a
*
SysApiAuthority
)
GetAuthAndApi
(
authId
string
)
(
err
error
,
apiIds
[]
uint
)
{
var
apis
[]
SysApiAuthority
err
=
qmsql
.
DEFAULTDB
.
Where
(
"authority_id = ?"
,
authId
)
.
Find
(
&
apis
)
.
Error
for
_
,
v
:=
range
apis
{
apiIds
=
append
(
apiIds
,
v
.
ApiId
)
}
return
nil
,
apiIds
}
\ No newline at end of file
QMPlusServer/router/sys_api.go
浏览文件 @
ef433ef4
...
...
@@ -11,12 +11,10 @@ func InitApiRouter(Router *gin.Engine)(R gin.IRoutes) {
{
ApiRouter
.
POST
(
"createApi"
,
api
.
CreateApi
)
//创建Api
ApiRouter
.
POST
(
"deleteApi"
,
api
.
DeleteApi
)
//删除Api
ApiRouter
.
POST
(
"setAuthAndApi"
,
api
.
SetAuthAndApi
)
// 设置api和角色关系
ApiRouter
.
POST
(
"getApiList"
,
api
.
GetApiList
)
//获取Api列表
ApiRouter
.
POST
(
"getApiById"
,
api
.
GetApiById
)
//获取单条Api消息
ApiRouter
.
POST
(
"updataApi"
,
api
.
UpdataApi
)
//更新api
ApiRouter
.
POST
(
"getAllApis"
,
api
.
GetAllApis
)
// 获取所有api
ApiRouter
.
POST
(
"getAuthAndApi"
,
api
.
GetAuthAndApi
)
// 获取api和auth关系
}
return
ApiRouter
}
QMPlusVuePage/src/view/layout/aside/index.vue
浏览文件 @
ef433ef4
...
...
@@ -4,20 +4,23 @@
<i
class=
"el-icon-arrow-right"
v-if=
"isCollapse"
></i>
<i
class=
"el-icon-arrow-left"
v-else
></i>
</div>
<el-scrollbar
style=
"height:calc(100vh -
52
px)"
>
<transition
name=
"el-zoom-in-top"
>
<el-scrollbar
style=
"height:calc(100vh -
60
px)"
>
<el-menu
:collapse-transition=
"true"
:class=
"['el-menu-vertical',!isCollapse&&'noCollapse']"
:collapse=
"isCollapse"
:default-active=
"active"
@
select=
"selectMenuItem"
unique-opened
background-color=
"#0F3D5F"
text-color=
"#bbb"
active-text-color=
"#fff"
>
<template
v-for=
"item in asyncRouters[0].children"
>
<aside-component
:key=
"item.name"
:routerInfo=
"item"
v-if=
"!item.hidden"
/>
</
template
>
</el-menu>
</transition>
</el-scrollbar>
</div>
</template>
...
...
@@ -58,6 +61,11 @@ export default {
</
script
>
<
style
lang=
"scss"
>
.el-scrollbar
{
.el-scrollbar__view
{
height
:
100%
;
}
}
.menu-info
{
.menu-contorl
{
line-height
:
52px
;
...
...
QMPlusVuePage/src/view/layout/index.vue
浏览文件 @
ef433ef4
<
template
>
<el-container
class=
"layout-cont"
>
<el-header
class=
"header-cont"
>
<h1
class=
"fl-left left-box"
>
<img
:src=
"require('@/assets/logo.png')"
height=
"40"
width=
"40"
>
Gin-Vue-Admin
</h1>
<div
class=
"fl-right right-box"
>
<el-dropdown>
<span
class=
"el-dropdown-link"
>
<img
:src=
"userInfo.headerImg"
height=
"30"
width=
"30"
/>
{{
userInfo
.
nickName
}}
<i
class=
"el-icon-arrow-down"
></i>
</span>
<el-dropdown-menu
class=
"dropdown-group"
slot=
"dropdown"
>
<el-dropdown-item>
<span>
更多信息
<el-badge
is-dot
/>
</span>
</el-dropdown-item>
<el-dropdown-item
@
click.native=
"toPerson"
icon=
"el-icon-s-custom"
>
个人信息
</el-dropdown-item>
<el-dropdown-item
@
click.native=
"LoginOut"
icon=
"el-icon-table-lamp"
>
登 出
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</el-header>
<el-container>
<el-aside
class=
"main-cont main-left"
>
<h1
class=
"admin-title"
:class=
"isCollapse&&'collapse'"
>
<img
:src=
"require('@/assets/logo.png')"
height=
"40"
width=
"40"
/>
Gin-Vue-Admin
</h1>
<Aside
class=
"aside"
/>
</el-aside>
<!-- 分块滑动功能 -->
<el-main
class=
"main-cont main-right"
>
<el-header
class=
"header-cont"
>
<div
class=
"fl-right right-box"
>
<el-dropdown>
<span
class=
"el-dropdown-link"
>
<img
:src=
"userInfo.headerImg"
height=
"30"
width=
"30"
/>
{{
userInfo
.
nickName
}}
<i
class=
"el-icon-arrow-down"
></i>
</span>
<el-dropdown-menu
class=
"dropdown-group"
slot=
"dropdown"
>
<el-dropdown-item>
<span>
更多信息
<el-badge
is-dot
/>
</span>
</el-dropdown-item>
<el-dropdown-item
@
click.native=
"toPerson"
icon=
"el-icon-s-custom"
>
个人信息
</el-dropdown-item>
<el-dropdown-item
@
click.native=
"LoginOut"
icon=
"el-icon-table-lamp"
>
登 出
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</el-header>
<!-- 当前面包屑用路由自动生成可根据需求修改 -->
<el-breadcrumb
class=
"breadcrumb"
separator-class=
"el-icon-arrow-right"
>
<el-breadcrumb-item
...
...
@@ -50,17 +52,21 @@ import Aside from '@/view/layout/aside'
import
{
mapGetters
,
mapMutations
}
from
'
vuex
'
export
default
{
name
:
'
Layout
'
,
data
(){
return
{
isCollapse
:
false
}
},
components
:
{
Aside
},
methods
:
{
...
mapMutations
(
'
user
'
,
[
'
LoginOut
'
]),
totalCollapse
()
{
this
.
$bus
.
emit
(
'
totalCollapse
'
)
},
toPerson
(){
this
.
$router
.
push
({
name
:
"
person
"
})
toPerson
()
{
this
.
$router
.
push
({
name
:
'
person
'
})
}
},
computed
:
{
...
...
@@ -71,6 +77,15 @@ export default {
matched
()
{
return
this
.
$route
.
matched
}
},
created
(){
this
.
$bus
.
on
(
'
totalCollapse
'
,
()
=>
{
this
.
isCollapse
=
!
this
.
isCollapse
console
.
log
(
this
.
isCollapse
)
})
},
beforeDestroy
()
{
this
.
$bus
.
off
(
'
totalCollapse
'
)
}
}
</
script
>
...
...
@@ -88,12 +103,6 @@ $mainHight: calc(100vh - 52px);
padding-bottom
:
17px
;
}
.layout-cont
{
.left-box
{
vertical-align
:
middle
;
img
{
vertical-align
:
middle
;
}
}
.right-box
{
text-align
:
center
;
vertical-align
:
middle
;
...
...
@@ -126,7 +135,6 @@ $mainHight: calc(100vh - 52px);
&
.el-main
{
overflow
:
auto
;
padding
:
0px
10px
;
margin
:
0px
0px
0px
12px
;
background
:
#fff
;
}
height
:
$mainHight
!
important
;
...
...
@@ -153,19 +161,35 @@ $mainHight: calc(100vh - 52px);
}
.el-menu-vertical
{
height
:
calc
(
100vh
-
6
9
px
)
!
important
;
height
:
calc
(
100vh
-
6
0
px
)
!
important
;
visibility
:
auto
;
&
.noCollapse
{
&
:not
(
.el-menu--collapse
)
{
width
:
250px
;
}
}
&
::-webkit-scrollbar
{
display
:
none
;
}
&
.main-left
{
width
:
auto
!
important
;
.admin-title
{
padding-left
:
10px
;
font-size
:
18px
;
vertical-align
:
middle
;
width
:
240px
;
background
:
#0F3D5F
;
color
:
#fff
;
img
{
vertical-align
:
middle
;
}
height
:
60px
;
line-height
:
60px
;
&
.collapse
{
width
:
53px
;
}
}
}
background
:
blueviolet
;
}
}
</
style
>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录