新增个人信息界面和修改密码界面,待联调接口

pull/65/head
fengshuonan 4 years ago
parent e2f1c75d3f
commit da60c89600

@ -1,11 +1,16 @@
package cn.stylefeng.guns.modular.index.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.basic.SimpleRoleInfo;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.basic.SimpleUserInfo;
import cn.stylefeng.roses.kernel.menu.modular.service.SysMenuService;
import cn.stylefeng.roses.kernel.resource.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.system.modular.organization.entity.HrOrganization;
import cn.stylefeng.roses.kernel.system.modular.organization.service.HrOrganizationService;
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
import cn.stylefeng.roses.kernel.system.pojo.menu.layui.LayuiAppIndexMenus;
import lombok.extern.slf4j.Slf4j;
@ -32,6 +37,9 @@ public class IndexViewController {
@Resource
private SysUserService sysUserService;
@Resource
private HrOrganizationService hrOrganizationService;
/**
*
*
@ -64,6 +72,40 @@ public class IndexViewController {
return "/login.html";
}
/**
*
*
* @author fengshuonan
* @date 2020/12/29 21:53
*/
@GetResource(name = "个人中心界面", path = "/personal", requiredLogin = false)
public String personal(Model model) {
LoginUser loginUser = LoginContext.me().getLoginUser();
// 用户基本信息
SimpleUserInfo simpleUserInfo = loginUser.getSimpleUserInfo();
model.addAllAttributes(BeanUtil.beanToMap(simpleUserInfo));
// 角色名称
List<SimpleRoleInfo> simpleRoleInfoList = loginUser.getSimpleRoleInfoList();
if (ObjectUtil.isNotEmpty(simpleRoleInfoList)) {
String roleName = simpleRoleInfoList.get(0).getRoleName();
model.addAttribute("roleName", roleName);
}
// 组织机构名称
Long organizationId = loginUser.getOrganizationId();
HrOrganization hrOrganization = hrOrganizationService.getById(organizationId);
if (hrOrganization != null) {
model.addAttribute("orgName", hrOrganization.getOrgName());
}
// 渲染头像的url
model.addAttribute("avatar", sysUserService.getUserAvatarUrl(simpleUserInfo.getAvatar()));
return "/modular/index/personal_info.html";
}
/**
*
*
@ -72,7 +114,29 @@ public class IndexViewController {
*/
@GetResource(name = "锁屏界面", path = "/lock", requiredPermission = false)
public String lock() {
return "/modular/index/lock-screen.html";
return "/modular/index/lock_screen.html";
}
/**
*
*
* @author fengshuonan
* @date 2020/12/29 21:42
*/
@GetResource(name = "主题切换界面", path = "/theme", requiredPermission = false)
public String theme() {
return "/modular/index/theme.html";
}
/**
*
*
* @author fengshuonan
* @date 2020/12/29 21:42
*/
@GetResource(name = "修改密码界面", path = "/changePassword", requiredPermission = false)
public String changePassword() {
return "/modular/index/change_password.html";
}
}

@ -95,15 +95,12 @@
// 修改密码点击事件
$('#setPsw').click(function () {
//获取多语言
var langs = layui.data('system').lang;
admin.open({
id: 'pswForm',
type: 2,
title: langs.MENU_CHANGE_PASSWORD,
title: "修改密码",
shade: 0,
content: '${ctxPath}/system/user_chpwd'
content: '${ctxPath}/changePassword'
});
});

@ -38,7 +38,7 @@
</a>
<dl class="layui-nav-child">
<dd lay-unselect>
<a ew-href="${ctxPath}/system/user_info">个人中心</a>
<a ew-href="${ctxPath}/personal">个人中心</a>
</dd>
<dd lay-unselect>
<a id="setPsw">修改密码</a>
@ -52,7 +52,7 @@
</dl>
</li>
<li class="layui-nav-item" lay-unselect>
<a ew-event="theme" title="主题" data-url="${ctxPath}/system/theme"><i class="layui-icon layui-icon-more-vertical"></i></a>
<a ew-event="theme" title="主题" data-url="${ctxPath}/theme"><i class="layui-icon layui-icon-more-vertical"></i></a>
</li>
</ul>
</div>

@ -1,21 +1,21 @@
@layout("/layout/_container.html",{title:"修改密码",bg:"bg-white",js:["/assets/modular/frame/password.js"]}){
@layout("/layout/_container.html", {title:"修改密码", bg:"bg-white", js:["/assets/modular/frame/password.js"]}){
<div class="layui-form model-form" id="form-psw">
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_OLD_PASSWORD","旧密码")}:</label>
<label class="layui-form-label">旧密码:</label>
<div class="layui-input-block">
<input type="password" name="oldPassword" placeholder="请输入原始密码" class="layui-input"
lay-verType="tips" lay-verify="required" required/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_NEW_PASSWORD","新密码")}:</label>
<label class="layui-form-label">新密码:</label>
<div class="layui-input-block">
<input type="password" name="newPassword" placeholder="请输入新密码" class="layui-input"
lay-verType="tips" lay-verify="required|psw" required/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_RE_PASSWORD","确认密码")}:</label>
<label class="layui-form-label">确认密码:</label>
<div class="layui-input-block">
<input type="password" name="repeatPassword" placeholder="请再次输入新密码" class="layui-input"
lay-verType="tips" lay-verify="required|repsw" required/>
@ -23,8 +23,8 @@
</div>
<div class="layui-form-item">
<div class="layui-input-block text-right">
<button class="layui-btn" lay-filter="submit-psw" lay-submit>${lang.get("BTN_SAVE","保存")}</button>
<button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">${lang.get("BTN_CANCEL","取消")}</button>
<button class="layui-btn" lay-filter="submit-psw" lay-submit>保存</button>
<button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
</div>
</div>
</div>

@ -1,9 +1,9 @@
@layout("/layout/_container.html",{title:"个人中心",css:["/assets/modular/frame/user_info.css"],js:["/assets/modular/frame/user_info.js"]}){
@layout("/layout/_container.html", {title:"个人中心", css:["/assets/modular/frame/user_info.css"], js:["/assets/modular/frame/user_info.js"]}){
<div class="layui-body-header">
<span class="layui-body-header-title">${lang.get("MENU_PERSONAL_INFO","个人信息")}</span>
<span class="layui-body-header-title">个人信息</span>
<span class="layui-breadcrumb pull-right">
<a href="${ctxPath}/system/console">${lang.get("MENU_INDEX","首页")}</a>
<a><cite>${lang.get("MENU_PERSONAL_INFO","个人中心")}</cite></a>
<a href="${ctxPath}/system/console">首页</a>
<a><cite>个人中心</cite></a>
</span>
</div>
@ -18,18 +18,18 @@
<div class="user-info-head" id="imgHead">
<img id="avatarPreview" src="${avatar}"/>
</div>
<h2 style="padding-top: 20px;">${name}</h2>
<p style="padding-top: 8px;">${roleName!} ${deptName!}</p>
<h2 style="padding-top: 20px;">${realName!靓仔}</h2>
<p style="padding-top: 8px;">${roleName!角色空} ${orgName!组织机构空}</p>
</div>
<div class="layui-text" style="padding-top: 30px;">
<div class="info-list-item">
<i class="layui-icon layui-icon-notice"></i>
<p>${email!}</p>
<p>${email!'sn93@qq.com'}</p>
</div>
<div class="info-list-item">
<i class="layui-icon layui-icon-cellphone"></i>
<p>${phone!}</p>
<p>${phone!18200000000}</p>
</div>
<div class="info-list-item">
<i class="layui-icon layui-icon-location"></i>
@ -52,46 +52,46 @@
<div class="layui-tab layui-tab-brief" lay-filter="userInfoTab">
<ul class="layui-tab-title">
<li class="layui-this">${lang.get("MENU_BASE_INFO","基本信息")}</li>
<li>${lang.get("MENU_OTHER","其他")}</li>
<li class="layui-this">基本信息</li>
<li>其他</li>
</ul>
<div class="layui-tab-content">
<div class="layui-form layui-tab-item layui-show" lay-filter="userInfoForm">
<input type="hidden" name="userId"/>
<div class="layui-form user-info-form" style="max-width: 400px;padding-top: 25px;">
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_ACCOUNT","账号")}:</label>
<label class="layui-form-label">账号:</label>
<div class="layui-input-block">
<input type="text" name="account" class="layui-input layui-disabled" lay-verify="required" disabled/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_SEX","性别")}:</label>
<label class="layui-form-label">性别:</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="M" title="男">
<input type="radio" name="sex" value="F" title="女">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_EMAIL","邮箱")}:<span style="color: red;">*</span></label>
<label class="layui-form-label">邮箱:<span style="color: red;">*</span></label>
<div class="layui-input-block">
<input type="email" name="email" class="layui-input" lay-verify="required|email" required/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_NAME","姓名")}:<span style="color: red;">*</span></label>
<label class="layui-form-label">姓名:<span style="color: red;">*</span></label>
<div class="layui-input-block">
<input type="text" name="name" class="layui-input" lay-verify="required" required/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_BIRTHDAY","生日")}:</label>
<label class="layui-form-label">生日:</label>
<div class="layui-input-block">
<input type="text" id="birthday" name="birthday" class="layui-input"/>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">${lang.get("FIELD_PHONE","电话")}:</label>
<label class="layui-form-label">电话:</label>
<div class="layui-input-block">
<input type="text" name="phone" class="layui-input"/>
</div>
@ -99,7 +99,7 @@
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-filter="userInfoSubmit" lay-submit>
${lang.get("BTN_UPDATE_INFO","更新基本信息")}
更新基本信息
</button>
</div>
</div>
Loading…
Cancel
Save