Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
29214f68
Commit
29214f68
authored
Nov 10, 2018
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新详情页面
parent
26cc96f5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
6 deletions
+87
-6
src/main/java/cn/stylefeng/guns/modular/system/controller/SystemController.java
+29
-0
src/main/webapp/WEB-INF/system/user/user_view.html
+7
-6
src/main/webapp/assets/modular/system/user/user_view.js
+51
-0
No files found.
src/main/java/cn/stylefeng/guns/modular/system/controller/SystemController.java
View file @
29214f68
...
@@ -16,14 +16,18 @@
...
@@ -16,14 +16,18 @@
package
cn
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
package
cn
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.stylefeng.guns.core.common.constant.DefaultAvatar
;
import
cn.stylefeng.guns.core.common.constant.DefaultAvatar
;
import
cn.stylefeng.guns.core.common.constant.factory.ConstantFactory
;
import
cn.stylefeng.guns.core.shiro.ShiroKit
;
import
cn.stylefeng.guns.core.shiro.ShiroKit
;
import
cn.stylefeng.guns.core.shiro.ShiroUser
;
import
cn.stylefeng.guns.core.shiro.ShiroUser
;
import
cn.stylefeng.guns.modular.system.factory.UserFactory
;
import
cn.stylefeng.guns.modular.system.model.FileInfo
;
import
cn.stylefeng.guns.modular.system.model.FileInfo
;
import
cn.stylefeng.guns.modular.system.model.User
;
import
cn.stylefeng.guns.modular.system.model.User
;
import
cn.stylefeng.guns.modular.system.service.IFileInfoService
;
import
cn.stylefeng.guns.modular.system.service.IFileInfoService
;
import
cn.stylefeng.guns.modular.system.service.IUserService
;
import
cn.stylefeng.guns.modular.system.service.IUserService
;
import
cn.stylefeng.roses.core.base.controller.BaseController
;
import
cn.stylefeng.roses.core.base.controller.BaseController
;
import
cn.stylefeng.roses.core.reqres.response.ResponseData
;
import
cn.stylefeng.roses.core.util.ToolUtil
;
import
cn.stylefeng.roses.core.util.ToolUtil
;
import
cn.stylefeng.roses.kernel.model.exception.RequestEmptyException
;
import
cn.stylefeng.roses.kernel.model.exception.RequestEmptyException
;
import
cn.stylefeng.roses.kernel.model.exception.ServiceException
;
import
cn.stylefeng.roses.kernel.model.exception.ServiceException
;
...
@@ -40,6 +44,8 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -40,6 +44,8 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* 通用控制器
* 通用控制器
...
@@ -146,4 +152,27 @@ public class SystemController extends BaseController {
...
@@ -146,4 +152,27 @@ public class SystemController extends BaseController {
return
null
;
return
null
;
}
}
/**
* 获取当前用户详情
*/
@RequestMapping
(
"/currentUserInfo"
)
@ResponseBody
public
Object
getUserInfo
()
{
ShiroUser
currentUser
=
ShiroKit
.
getUser
();
if
(
currentUser
==
null
)
{
throw
new
ServiceException
(
CoreExceptionEnum
.
NO_CURRENT_USER
);
}
User
user
=
userService
.
selectById
(
currentUser
.
getId
());
Map
<
String
,
Object
>
map
=
UserFactory
.
removeUnSafeFields
(
user
);
HashMap
<
Object
,
Object
>
hashMap
=
CollectionUtil
.
newHashMap
();
hashMap
.
putAll
(
map
);
hashMap
.
put
(
"roleName"
,
ConstantFactory
.
me
().
getRoleName
(
user
.
getRoleid
()));
hashMap
.
put
(
"deptName"
,
ConstantFactory
.
me
().
getDeptName
(
user
.
getDeptid
()));
return
ResponseData
.
success
(
hashMap
);
}
}
}
src/main/webapp/WEB-INF/system/user/user_view.html
View file @
29214f68
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
@ * phone : 电话
@ * phone : 电话
@ * deptName : 部门名称
@ * deptName : 部门名称
@ **/
@ **/
@layout("/common/_container.html",{plugins:["cropper"],js:["/assets/modular/system/user/user_view.js"]}){
@layout("/common/_container.html",{plugins:["cropper"
,"laydate"
],js:["/assets/modular/system/user/user_view.js"]}){
<div
class=
"row"
>
<div
class=
"row"
>
<div
class=
"col-lg-4 col-xlg-3 col-md-5"
>
<div
class=
"col-lg-4 col-xlg-3 col-md-5"
>
<div
class=
"card"
>
<div
class=
"card"
>
...
@@ -57,11 +57,11 @@
...
@@ -57,11 +57,11 @@
@ **/
@ **/
<div
class=
"tab-pane active"
id=
"personal"
role=
"tabpanel"
>
<div
class=
"tab-pane active"
id=
"personal"
role=
"tabpanel"
>
<div
class=
"card-block"
>
<div
class=
"card-block"
>
<
form
class=
"form-horizontal form-material"
>
<
div
class=
"form-horizontal form-material"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-md-12"
>
账号
</label>
<label
class=
"col-md-12"
>
账号
</label>
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
>
<input
v-model=
"account"
type=
"text"
placeholder=
""
class=
"form-control form-control-line"
autocomplete=
"false"
>
<input
v-model=
"account"
disabled
type=
"text"
placeholder=
""
class=
"form-control form-control-line"
autocomplete=
"false"
>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
...
@@ -89,7 +89,8 @@
...
@@ -89,7 +89,8 @@
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-md-12"
>
出生日期
</label>
<label
class=
"col-md-12"
>
出生日期
</label>
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
>
<input
v-model=
"birthday"
type=
"text"
placeholder=
""
class=
"form-control form-control-line"
autocomplete=
"false"
>
<input
v-model=
"birthday"
type=
"hidden"
class=
"form-control form-control-line"
autocomplete=
"false"
>
<input
id=
"dateSelect"
type=
"text"
class=
"form-control"
autocomplete=
"off"
>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
...
@@ -100,10 +101,10 @@
...
@@ -100,10 +101,10 @@
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"col-sm-12"
>
<div
class=
"col-sm-12"
>
<button
class=
"btn btn-success waves-effect"
>
更新个人信息
</button>
<button
class=
"btn btn-success waves-effect"
\@
click=
"submit"
>
更新个人信息
</button>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
...
...
src/main/webapp/assets/modular/system/user/user_view.js
View file @
29214f68
var
UserViewPage
=
{
data
:
{
account
:
""
,
sex
:
""
,
email
:
""
,
name
:
""
,
birthday
:
""
,
phone
:
""
}
};
/**
* 更新个人信息
*/
UserViewPage
.
submit
=
function
()
{
//注意!vue的model绑定和layui有冲突!手动赋值一下!
UserViewPage
.
data
.
birthday
=
Feng
.
getLaydate
();
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/mgr/edit"
,
function
(
data
)
{
Feng
.
success
(
"修改成功!"
);
},
function
(
data
)
{
Feng
.
error
(
"修改失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
UserViewPage
.
data
);
ajax
.
start
();
};
$
(
function
()
{
$
(
function
()
{
/**
* 用户详情的逻辑
*/
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/system/currentUserInfo"
);
var
result
=
ajax
.
start
();
UserViewPage
.
data
=
result
.
data
;
UserViewPage
.
app
=
new
Vue
({
el
:
'#personal'
,
data
:
UserViewPage
.
data
,
methods
:
{
submit
:
function
()
{
UserViewPage
.
submit
();
}
}
});
Feng
.
initLaydate
(
UserViewPage
.
data
.
birthday
);
/**
* 剪辑头像的逻辑
*/
'use strict'
;
'use strict'
;
var
console
=
window
.
console
||
{
var
console
=
window
.
console
||
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment