Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kadycui
game-admin
提交
64acf552
game-admin
项目概览
kadycui
/
game-admin
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
game-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
64acf552
编写于
9月 19, 2023
作者:
kadycui
💻
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ADD: 角色管理
上级
f401a183
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
165 addition
and
3 deletion
+165
-3
src/api/role.js
src/api/role.js
+29
-0
src/pages/notice/list.vue
src/pages/notice/list.vue
+2
-3
src/pages/role/list.vue
src/pages/role/list.vue
+126
-0
src/router/index.js
src/router/index.js
+8
-0
未找到文件。
src/api/role.js
0 → 100644
浏览文件 @
64acf552
import
axios
from
'
@/axios
'
export
function
getRoleList
(
page
)
{
return
axios
.
get
(
`/admin/role/
${
page
}
`
)
}
export
function
createRole
(
data
)
{
return
axios
.
post
(
"
/admin/role
"
,
data
)
}
export
function
updateRole
(
id
,
data
)
{
return
axios
.
post
(
"
/admin/role/
"
+
id
,
data
)
}
export
function
deleteRole
(
id
)
{
return
axios
.
post
(
`/admin/role/
${
id
}
/delete`
)
}
export
function
updateRoleStatus
(
id
,
status
){
return
axios
.
post
(
`/admin/role/
${
id
}
/update_status`
,
{
status
})
}
\ No newline at end of file
src/pages/notice/list.vue
浏览文件 @
64acf552
...
...
@@ -48,7 +48,6 @@
<
script
setup
>
import
{
ref
,
reactive
,
computed
}
from
"
vue
"
import
{
getNoticeList
,
createNotice
,
...
...
@@ -88,8 +87,8 @@ const {
}
=
useInitForm
(
{
form
:
{
"
title
"
:
""
,
"
content
"
:
""
title
:
""
,
content
:
""
},
rules
:
{
title
:
[
...
...
src/pages/role/list.vue
0 → 100644
浏览文件 @
64acf552
<
template
>
<el-card
shadow=
"never"
class=
"border-0"
>
<!-- 新增 | 刷新 -->
<ListHeader
@
create=
"handleCreate"
@
refresh=
"getData"
/>
<el-table
:data=
"tableData"
stripe
style=
"width: 100%"
element-loading-text=
"加载中..."
element-loading-spinner=
"el-icon-loading"
v-loading=
"loading"
>
<el-table-column
prop=
"name"
label=
"角色名称"
/>
<el-table-column
prop=
"desc"
label=
"角色描述"
/>
<el-table-column
label=
"状态"
width=
"120"
>
<template
#default
="
{ row }">
<el-switch
:modelValue=
"row.status"
:active-value=
"1"
:inactive-value=
"0"
:loading=
"row.statusLoading"
:disabled=
"row.super == 1"
@
change=
"handleStatusChange($event, row)"
>
</el-switch>
</
template
>
</el-table-column>
<el-table-column
label=
"操作"
width=
"180"
align=
"center"
>
<
template
#default=
"scope"
>
<el-button
type=
"primary"
size=
"small"
text
@
click=
"handleEdit(scope.row)"
>
修改
</el-button>
<el-popconfirm
title=
"是否删除此角色?"
confirm-button-text=
"确认"
cancel-button-text=
"取消"
@
confirm=
"handleDelete(scope.row.id)"
>
<template
#reference
>
<el-button
text
type=
"primary"
size=
"small"
>
删除
</el-button>
</
template
>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
<div
class=
"flex items-center justify-center mt-5"
>
<el-pagination
background
layout=
"prev,pager, next"
:total=
"total"
:current-page=
"currentPage"
:page-size=
"limit"
@
current-change=
"getData"
/>
</div>
<FormDrawer
ref=
"formDrawerRef"
:title=
"drawerTitle"
@
submit=
"handleSubmit"
>
<el-form
:model=
"form"
ref=
"formRef"
:rules=
"rules"
label-width=
"80px"
:inline=
"false"
>
<el-form-item
label=
"角色名称"
prop=
"name"
>
<el-input
v-model=
"form.name"
placeholder=
"角色名称"
></el-input>
</el-form-item>
<el-form-item
label=
"角色描述"
prop=
"desc"
>
<el-input
v-model=
"form.desc"
placeholder=
"描述内容"
type=
"textarea"
:rows=
"5"
></el-input>
</el-form-item>
<el-form-item
label=
"角色状态"
prop=
"status"
>
<el-switch
v-model=
"form.status"
:active-value=
"1"
:inactive-value=
"0"
>
</el-switch>
</el-form-item>
</el-form>
</FormDrawer>
</el-card>
</template>
<
script
setup
>
import
{
getRoleList
,
createRole
,
updateRole
,
deleteRole
,
updateRoleStatus
}
from
"
@/api/role
"
import
FormDrawer
from
"
@/components/FormDrawer.vue
"
import
ListHeader
from
"
@/components/ListHeader.vue
"
import
{
useInitTable
,
useInitForm
}
from
"
@/composables/useCommon.js
"
const
{
tableData
,
loading
,
currentPage
,
total
,
limit
,
getData
,
handleDelete
,
handleStatusChange
}
=
useInitTable
({
getList
:
getRoleList
,
delete
:
deleteRole
,
updateStatus
:
updateRoleStatus
})
const
{
formDrawerRef
,
formRef
,
form
,
rules
,
drawerTitle
,
handleSubmit
,
handleCreate
,
handleEdit
}
=
useInitForm
(
{
form
:
{
name
:
""
,
desc
:
""
,
status
:
1
},
rules
:
{
name
:
[
{
required
:
true
,
message
:
'
角色名称不能为空
'
,
trigger
:
'
blur
'
}
],
},
getData
,
update
:
updateRole
,
create
:
createRole
})
</
script
>
\ No newline at end of file
src/router/index.js
浏览文件 @
64acf552
...
...
@@ -17,6 +17,7 @@ import SettingList from '@/pages/setting/base.vue'
import
CouponList
from
'
@/pages/coupon/list.vue
'
import
ManagerList
from
'
@/pages/manager/list.vue
'
import
AccessList
from
'
@/pages/access/list.vue
'
import
RoleList
from
'
@/pages/role/list.vue
'
...
...
@@ -187,6 +188,13 @@ const asyncRoutes = [{
title
:
"
菜单权限管理
"
}
},{
path
:
"
/role/list
"
,
name
:
"
/role/list
"
,
component
:
RoleList
,
meta
:
{
title
:
"
角色管理
"
}
}]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录