Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
76818dab
提交
76818dab
authored
3月 18, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
前端:修复管理员无分页的问题
上级
e2619ce5
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
56 行增加
和
17 行删除
+56
-17
validator.js
admin-web/helpers/validator.js
+11
-0
admin.js
admin-web/mock/admin.js
+2
-2
DictionaryText.js
admin-web/src/components/Dictionary/DictionaryText.js
+1
-0
adminList.js
admin-web/src/models/admin/adminList.js
+1
-0
AdminList.js
admin-web/src/pages/Admin/AdminList.js
+30
-4
AdminController.java
.../admin/application/controller/admins/AdminController.java
+3
-1
PassportController.java
...min/application/controller/admins/PassportController.java
+8
-9
OAuth2ServiceImpl.java
...java/cn/iocoder/mall/admin/service/OAuth2ServiceImpl.java
+0
-1
没有找到文件。
admin-web/helpers/validator.js
0 → 100644
浏览文件 @
76818dab
// 校验必须是英文或者数字
export
function
checkTypeWithEnglishAndNumbers
(
rule
,
value
,
callback
,
text
)
{
let
char
=
/^
[
a-zA-Z0-9
]
+$/
if
(
char
.
test
(
value
))
{
callback
()
}
else
{
callback
(
text
)
}
}
\ No newline at end of file
admin-web/mock/admin.js
浏览文件 @
76818dab
...
...
@@ -49,10 +49,10 @@ function getDictionaryTree(req, res) {
}
export
default
{
'GET /admin-api/admins/admin/menu_resource_tree'
:
getAdminMenu
,
'GET /admin-api/admins/admin/menu_resource_tree'
:
getAdminMenu
All
,
'GET /admin-api/admins/admin/url_resource_list'
:
getAdminUrls
,
'GET /admin-api/admins/resource/tree'
:
getResourceTree
,
'GET /admin-api/admins/role/page'
:
getQueryRole
,
'GET /admin-api/admins/admin/page'
:
getQueryRole
,
//
'GET /admin-api/admins/admin/page': getQueryRole,
'GET /admin-api/admins/data_dict/tree'
:
getDictionaryTree
,
};
admin-web/src/components/Dictionary/DictionaryText.js
浏览文件 @
76818dab
...
...
@@ -5,6 +5,7 @@ export default class DictionaryText extends PureComponent {
componentDidMount
()
{}
render
()
{
debugger
;
const
{
dicKey
,
dicValue
}
=
this
.
props
;
return
(
<
DictionaryContext
.
Consumer
>
...
...
admin-web/src/models/admin/adminList.js
浏览文件 @
76818dab
...
...
@@ -82,6 +82,7 @@ export default {
payload
:
{
list
:
admins
,
count
,
pageNo
:
payload
.
pageNo
+
1
},
});
},
...
...
admin-web/src/pages/Admin/AdminList.js
浏览文件 @
76818dab
...
...
@@ -3,10 +3,12 @@
import
React
,
{
PureComponent
,
Fragment
}
from
'react'
;
import
{
connect
}
from
'dva'
;
import
{
Card
,
Form
,
Input
,
Button
,
Modal
,
message
,
Table
,
Divider
,
Tree
,
Spin
}
from
'antd'
;
import
{
checkTypeWithEnglishAndNumbers
}
from
'../../../helpers/validator'
import
PageHeaderWrapper
from
'@/components/PageHeaderWrapper'
;
import
styles
from
'./AdminList.less'
;
import
moment
from
"moment"
;
import
Pagination
from
"antd/es/pagination"
;
const
FormItem
=
Form
.
Item
;
const
{
TreeNode
}
=
Tree
;
...
...
@@ -44,18 +46,24 @@ const CreateForm = Form.create()(props => {
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"用户名"
>
{
form
.
getFieldDecorator
(
'username'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入用户名!'
,
min
:
2
}],
rules
:
[{
required
:
true
,
message
:
'请输入用户名!'
},
{
max
:
16
,
min
:
6
,
message
:
'长度为6-16位'
},
{
validator
:
(
rule
,
value
,
callback
)
=>
checkTypeWithEnglishAndNumbers
(
rule
,
value
,
callback
,
'数字以及字母'
)}
],
initialValue
:
initValues
.
username
,
})(
<
Input
placeholder
=
"请输入"
/>
)}
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"昵称"
>
{
form
.
getFieldDecorator
(
'nickname'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入昵称!'
,
min
:
2
}],
rules
:
[{
required
:
true
,
message
:
'请输入昵称!'
},
{
max
:
10
,
message
:
'姓名最大长度为10'
}],
initialValue
:
initValues
.
nickname
,
})(
<
Input
placeholder
=
"请输入"
/>
)}
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"密码"
>
{
form
.
getFieldDecorator
(
'password'
,
{
rules
:
[{
required
:
modalType
===
'add'
,
message
:
'请填写密码'
},
// 添加时,必须输入密码
{
max
:
16
,
min
:
6
,
message
:
'长度为6-18位'
}],
initialValue
:
initValues
.
password
,
})(
<
Input
placeholder
=
"请输入"
type
=
"password"
/>
)}
<
/FormItem
>
...
...
@@ -304,9 +312,21 @@ class ResourceList extends PureComponent {
});
};
onPageChange
=
(
page
=
{})
=>
{
const
{
dispatch
}
=
this
.
props
;
// debugger;
dispatch
({
type
:
'adminList/query'
,
payload
:
{
pageNo
:
page
-
1
,
pageSize
:
10
,
}
});
}
render
()
{
const
{
list
,
data
}
=
this
.
props
;
const
{
roleList
,
roleCheckedKeys
,
roleAssignLoading
}
=
data
;
const
{
count
,
pageNo
,
pageSize
,
roleList
,
roleCheckedKeys
,
roleAssignLoading
}
=
data
;
const
{
modalVisible
,
modalType
,
...
...
@@ -335,7 +355,7 @@ class ResourceList extends PureComponent {
title
:
'状态'
,
dataIndex
:
'status'
,
render
(
val
)
{
return
<
span
>
{
status
[
val
]}
<
/span>
;
return
<
span
>
{
status
[
val
]}
<
/span>;
/
/
TODO
芋艿,此处要改
},
},
{
...
...
@@ -386,6 +406,12 @@ class ResourceList extends PureComponent {
columns
=
{
columns
}
dataSource
=
{
list
}
rowKey
=
"id"
pagination
=
{{
current
:
pageNo
,
pageSize
:
pageSize
,
total
:
count
,
onChange
:
this
.
onPageChange
}}
/
>
<
/Card
>
<
CreateForm
{...
parentMethods
}
modalVisible
=
{
modalVisible
}
/
>
...
...
admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/AdminController.java
浏览文件 @
76818dab
...
...
@@ -42,6 +42,8 @@ public class AdminController {
// =========== 当前管理员相关的资源 API ===========
// TODO 功能:当前管理员
@SuppressWarnings
(
"Duplicates"
)
@GetMapping
(
"/menu_resource_tree"
)
@ApiOperation
(
value
=
"获得当前登陆的管理员拥有的菜单权限"
,
notes
=
"以树结构返回"
)
...
...
@@ -120,7 +122,7 @@ public class AdminController {
public
CommonResult
<
Boolean
>
update
(
@RequestParam
(
"id"
)
Integer
id
,
@RequestParam
(
"username"
)
String
username
,
@RequestParam
(
"nickname"
)
String
nickname
,
@RequestParam
(
"password"
)
String
password
)
{
@RequestParam
(
value
=
"password"
,
required
=
false
)
String
password
)
{
AdminUpdateDTO
adminUpdateDTO
=
new
AdminUpdateDTO
().
setId
(
id
).
setUsername
(
username
).
setNickname
(
nickname
).
setPassword
(
password
);
return
adminService
.
updateAdmin
(
AdminSecurityContextHolder
.
getContext
().
getAdminId
(),
adminUpdateDTO
);
}
...
...
admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/PassportController.java
浏览文件 @
76818dab
...
...
@@ -3,17 +3,17 @@ package cn.iocoder.mall.admin.application.controller.admins;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
cn.iocoder.mall.admin.api.OAuth2Service
;
import
cn.iocoder.mall.admin.api.bo.OAuth2AccessTokenBO
;
import
cn.iocoder.mall.admin.application.convert.AdminConvert
;
import
cn.iocoder.mall.admin.application.convert.PassportConvert
;
import
cn.iocoder.mall.admin.application.vo.AdminInfoVO
;
import
cn.iocoder.mall.admin.application.vo.PassportLoginVO
;
import
cn.iocoder.mall.admin.sdk.context.AdminSecurityContextHolder
;
import
com.alibaba.dubbo.config.annotation.Reference
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"admins/passport"
)
...
...
@@ -35,10 +35,8 @@ public class PassportController {
return
PassportConvert
.
INSTANCE
.
convert
(
result
);
}
// TODO 艿艿:后续继续完善
@GetMapping
(
"/info"
)
public
CommonResult
<
AdminInfoVO
>
info
()
{
return
CommonResult
.
success
(
AdminConvert
.
INSTANCE
.
convert
(
AdminSecurityContextHolder
.
getContext
()));
}
// TODO 功能 logout
// TODO 功能 refresh_token
}
\ No newline at end of file
admin/admin-service-impl/src/main/java/cn/iocoder/mall/admin/service/OAuth2ServiceImpl.java
浏览文件 @
76818dab
...
...
@@ -77,7 +77,6 @@ public class OAuth2ServiceImpl implements OAuth2Service {
}
// 获得管理员拥有的角色
List
<
AdminRoleDO
>
adminRoleDOs
=
adminService
.
getAdminRoles
(
accessTokenDO
.
getAdminId
());
// TODO 芋艿,有个 bug ,要排除掉已经失效的角色
return
CommonResult
.
success
(
OAuth2Convert
.
INSTANCE
.
convertToAuthentication
(
accessTokenDO
,
adminRoleDOs
));
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论