Przeglądaj źródła

若依开源1.1.2发布

RuoYi 7 lat temu
rodzic
commit
9d18d298e7
33 zmienionych plików z 419 dodań i 65 usunięć
  1. 4 2
      pom.xml
  2. 5 5
      sql/ry_20180506.sql
  3. 12 0
      src/main/java/com/ruoyi/common/utils/security/ShiroUtils.java
  4. 5 0
      src/main/java/com/ruoyi/framework/web/controller/BaseController.java
  5. 119 0
      src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java
  6. 3 27
      src/main/java/com/ruoyi/project/system/user/controller/UserController.java
  7. 9 1
      src/main/java/com/ruoyi/project/system/user/service/IUserService.java
  8. 12 1
      src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java
  9. 1 1
      src/main/resources/application.yml
  10. BIN
      src/main/resources/static/img/a1.jpg
  11. BIN
      src/main/resources/static/img/a2.jpg
  12. BIN
      src/main/resources/static/img/a3.jpg
  13. BIN
      src/main/resources/static/img/a4.jpg
  14. BIN
      src/main/resources/static/img/a6.jpg
  15. BIN
      src/main/resources/static/img/a7.jpg
  16. BIN
      src/main/resources/static/img/a8.jpg
  17. BIN
      src/main/resources/static/img/a9.jpg
  18. 0 0
      src/main/resources/static/img/profilel.jpg
  19. 1 1
      src/main/resources/static/ruoyi/css/RuoYi.css
  20. 1 1
      src/main/resources/static/ruoyi/system/dept/add.js
  21. 1 1
      src/main/resources/static/ruoyi/system/dept/edit.js
  22. 1 1
      src/main/resources/static/ruoyi/system/dict/type/add.js
  23. 1 1
      src/main/resources/static/ruoyi/system/dict/type/edit.js
  24. 1 1
      src/main/resources/static/ruoyi/system/menu/add.js
  25. 1 1
      src/main/resources/static/ruoyi/system/menu/edit.js
  26. 1 1
      src/main/resources/static/ruoyi/system/role/add.js
  27. 1 1
      src/main/resources/static/ruoyi/system/role/edit.js
  28. 1 1
      src/main/resources/static/ruoyi/system/user/add.js
  29. 2 2
      src/main/resources/templates/include.html
  30. 25 3
      src/main/resources/templates/main.html
  31. 90 0
      src/main/resources/templates/system/user/profile/edit.html
  32. 9 13
      src/main/resources/templates/system/user/profile/profile.html
  33. 113 0
      src/main/resources/templates/system/user/profile/resetPwd.html

+ 4 - 2
pom.xml

@@ -5,8 +5,8 @@
 
 	<groupId>com.ruoyi</groupId>
 	<artifactId>RuoYi</artifactId>
-	<version>1.1.1</version>
-	<packaging>war</packaging>
+	<version>1.1.2</version>
+	<packaging>jar</packaging>
 
 	<name>RuoYi</name>
 	<description>若依管理系统</description>
@@ -43,12 +43,14 @@
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter</artifactId>
+			<!--
 			 <exclusions>
                 <exclusion>
                     <artifactId>spring-boot-starter-tomcat</artifactId>
                     <groupId>org.springframework.boot</groupId>
                 </exclusion>
             </exclusions> 
+             -->
 		</dependency>
 
 		<!-- SpringBoot 测试 -->

+ 5 - 5
sql/ry_20180505.sql → sql/ry_20180506.sql

@@ -25,10 +25,10 @@ insert into sys_dept values(100,  0,   '若依集团', 0, '马云', '15011112221
 insert into sys_dept values(101,  100, '研发部门', 1, '马研', '15011112222', 'ry@qq.com', 0, 'admin', '2018-03-01', 'ry', '2018-03-01');
 insert into sys_dept values(102,  100, '市场部门', 2, '马市', '15011112223', 'ry@qq.com', 0, 'admin', '2018-03-01', 'ry', '2018-03-01');
 insert into sys_dept values(103,  100, '测试部门', 3, '马测', '15011112224', 'ry@qq.com', 0, 'admin', '2018-03-01', 'ry', '2018-03-01');
-insert into sys_dept values(104,  100, '财务部门', 4, '马财', '15011112225', 'ry@qq.com', 1, 'admin', '2018-03-01', 'ry', '2018-03-01');
-insert into sys_dept values(105,  100, '运维部门', 5, '马运', '15011112226', 'ry@qq.com', 1, 'admin', '2018-03-01', 'ry', '2018-03-01');
+insert into sys_dept values(104,  100, '财务部门', 4, '马财', '15011112225', 'ry@qq.com', 0, 'admin', '2018-03-01', 'ry', '2018-03-01');
+insert into sys_dept values(105,  100, '运维部门', 5, '马运', '15011112226', 'ry@qq.com', 0, 'admin', '2018-03-01', 'ry', '2018-03-01');
 insert into sys_dept values(106,  101, '研发一部', 1, '马一', '15011112227', 'ry@qq.com', 0, 'admin', '2018-03-01', 'ry', '2018-03-01');
-insert into sys_dept values(107,  101, '研发二部', 2, '马二', '15011112228', 'ry@qq.com', 1, 'admin', '2018-03-01', 'ry', '2018-03-01');
+insert into sys_dept values(107,  101, '研发二部', 2, '马二', '15011112228', 'ry@qq.com', 0, 'admin', '2018-03-01', 'ry', '2018-03-01');
 insert into sys_dept values(108,  102, '市场一部', 1, '马一', '15011112229', 'ry@qq.com', 0, 'admin', '2018-03-01', 'ry', '2018-03-01');
 insert into sys_dept values(109,  102, '市场二部', 2, '马二', '15011112210', 'ry@qq.com', 1, 'admin', '2018-03-01', 'ry', '2018-03-01');
 
@@ -61,8 +61,8 @@ create table sys_user (
 -- ----------------------------
 -- 初始化-用户信息表数据
 -- ----------------------------
-insert into sys_user values(1, 106, 'admin', '若依', 'yzz_ivy@163.com', '15088888888', '0', 'img/a5.jpg', '29c67a30398638269fe600f73a054934', '111111', 'N', 1, '维护中', 'admin', '2018-03-01', 'ry', '2018-03-01');
-insert into sys_user values(2, 108, 'ry',    '若依', 'ry@163.com',      '15288888888', '1', 'img/a5.jpg', '8e6d98b90472783cc73c17047ddccf36', '222222', 'N', 1, '锁定中', 'admin', '2018-03-01', 'ry', '2018-03-01');
+insert into sys_user values(1, 106, 'admin', '若依', 'yzz_ivy@163.com', '15088888888', '0', 'img/a5.jpg', '29c67a30398638269fe600f73a054934', '111111', 'N', 0, '维护中', 'admin', '2018-03-01', 'ry', '2018-03-01');
+insert into sys_user values(2, 108, 'ry',    '若依', 'ry@163.com',      '15288888888', '1', 'img/a5.jpg', '8e6d98b90472783cc73c17047ddccf36', '222222', 'N', 0, '锁定中', 'admin', '2018-03-01', 'ry', '2018-03-01');
 
 
 -- ----------------------------

+ 12 - 0
src/main/java/com/ruoyi/common/utils/security/ShiroUtils.java

@@ -1,6 +1,8 @@
 package com.ruoyi.common.utils.security;
 
 import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.apache.shiro.subject.SimplePrincipalCollection;
 import org.apache.shiro.subject.Subject;
 
 import com.ruoyi.project.system.user.domain.User;
@@ -28,6 +30,16 @@ public class ShiroUtils
         return (User) getSubjct().getPrincipal();
     }
 
+    public static void setUser(User user)
+    {
+        Subject subject = getSubjct();
+        PrincipalCollection principalCollection = subject.getPrincipals();
+        String realmName = principalCollection.getRealmNames().iterator().next();
+        PrincipalCollection newPrincipalCollection = new SimplePrincipalCollection(user, realmName);
+        // 重新加载Principal
+        subject.runAs(newPrincipalCollection);
+    }
+
     public static Long getUserId()
     {
         return getUser().getUserId().longValue();

+ 5 - 0
src/main/java/com/ruoyi/framework/web/controller/BaseController.java

@@ -58,6 +58,11 @@ public class BaseController
     {
         return ShiroUtils.getUser();
     }
+    
+    public void setUser(User user)
+    {
+        ShiroUtils.setUser(user);
+    }
 
     public Long getUserId()
     {

+ 119 - 0
src/main/java/com/ruoyi/project/system/user/controller/ProfileController.java

@@ -0,0 +1,119 @@
+package com.ruoyi.project.system.user.controller;
+
+import org.apache.shiro.crypto.hash.Md5Hash;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.Message;
+import com.ruoyi.project.system.user.domain.User;
+import com.ruoyi.project.system.user.service.IUserService;
+
+/**
+ * 个人信息 业务处理
+ * 
+ * @author ruoyi
+ */
+@Controller
+@RequestMapping("/system/user/profile")
+public class ProfileController extends BaseController
+{
+    private String prefix = "system/user/profile";
+
+    @Autowired
+    private IUserService userService;
+
+    /**
+     * 个人信息
+     */
+    @GetMapping()
+    public String profile(Model model)
+    {
+        User user = getUser();
+        String sex = user.getSex();
+        if ("0".equals(sex))
+        {
+            user.setSex("性别:男");
+        }
+        else if ("1".equals(sex))
+        {
+            user.setSex("性别:女");
+        }
+        String roleGroup = userService.selectUserRoleGroup(user.getUserId());
+        String postGroup = userService.selectUserPostGroup(user.getUserId());
+        model.addAttribute("user", user);
+        model.addAttribute("roleGroup", roleGroup);
+        model.addAttribute("postGroup", postGroup);
+        return prefix + "/profile";
+    }
+
+    @RequestMapping("/checkPassword")
+    @ResponseBody
+    public boolean checkPassword(String password)
+    {
+        User user = getUser();
+        String encrypt = new Md5Hash(user.getLoginName() + password + user.getSalt()).toHex().toString();
+        if (user.getPassword().equals(encrypt))
+        {
+            return true;
+        }
+        return false;
+    }
+
+    @Log(title = "系统管理", action = "个人信息-重置密码")
+    @GetMapping("/resetPwd/{userId}")
+    public String resetPwd(@PathVariable("userId") Long userId, Model model)
+    {
+        User user = userService.selectUserById(userId);
+        model.addAttribute("user", user);
+        return prefix + "/resetPwd";
+    }
+
+    @Log(title = "系统管理", action = "个人信息-重置密码")
+    @PostMapping("/resetPwd")
+    @ResponseBody
+    public Message resetPwd(User user)
+    {
+        int rows = userService.resetUserPwd(user);
+        if (rows > 0)
+        {
+            setUser(userService.selectUserById(user.getUserId()));
+            return Message.ok();
+        }
+        return Message.error();
+    }
+
+    /**
+     * 修改用户
+     */
+    @Log(title = "系统管理", action = "个人信息-修改用户")
+    @GetMapping("/edit/{userId}")
+    public String edit(@PathVariable("userId") Long userId, Model model)
+    {
+        User user = userService.selectUserById(userId);
+        model.addAttribute("user", user);
+        return prefix + "/edit";
+    }
+
+    /**
+     * 修改用户
+     */
+    @Log(title = "系统管理", action = "个人信息-保存用户")
+    @PostMapping("/update")
+    @ResponseBody
+    public Message update(User user)
+    {
+        if (userService.updateUser(user) > 0)
+        {
+            setUser(userService.selectUserById(user.getUserId()));
+            return Message.ok();
+        }
+        return Message.error();
+    }
+}

+ 3 - 27
src/main/java/com/ruoyi/project/system/user/controller/UserController.java

@@ -109,7 +109,7 @@ public class UserController extends BaseController
     @ResponseBody
     public Message resetPwd(User user)
     {
-        int rows = userService.updateUser(user);
+        int rows = userService.resetUserPwd(user);
         if (rows > 0)
         {
             return Message.ok();
@@ -152,10 +152,10 @@ public class UserController extends BaseController
     }
 
     /**
-     * 保存
+     * 保存用户
      */
     @RequiresPermissions("system:user:save")
-    @Log(title = "系统管理", action = "部门管理-保存部门")
+    @Log(title = "系统管理", action = "用户管理-保存用户")
     @PostMapping("/save")
     @Transactional(rollbackFor = Exception.class)
     @ResponseBody
@@ -183,28 +183,4 @@ public class UserController extends BaseController
         return uniqueFlag;
     }
 
-    /**
-     * 个人信息
-     */
-    @GetMapping("/profile")
-    public String profile(Model model)
-    {
-        User user = getUser();
-        String sex = user.getSex();
-        if ("0".equals(sex))
-        {
-            user.setSex("性别:男");
-        }
-        else if ("1".equals(sex))
-        {
-            user.setSex("性别:女");
-        }
-        String roleGroup = userService.selectUserRoleGroup(user.getUserId());
-        String postGroup = userService.selectUserPostGroup(user.getUserId());
-        model.addAttribute("user", user);
-        model.addAttribute("roleGroup", roleGroup);
-        model.addAttribute("postGroup", postGroup);
-        return prefix + "/profile";
-    }
-
 }

+ 9 - 1
src/main/java/com/ruoyi/project/system/user/service/IUserService.java

@@ -58,7 +58,7 @@ public interface IUserService
      * @return 结果
      */
     public int saveUser(User user);
-
+    
     /**
      * 修改用户信息
      * 
@@ -67,6 +67,14 @@ public interface IUserService
      */
     public int updateUser(User user);
 
+    /**
+     * 修改用户密码信息
+     * 
+     * @param user 用户信息
+     * @return 结果
+     */
+    public int resetUserPwd(User user);
+
     /**
      * 校验用户名称是否唯一
      * 

+ 12 - 1
src/main/java/com/ruoyi/project/system/user/service/UserServiceImpl.java

@@ -162,8 +162,19 @@ public class UserServiceImpl implements IUserService
      * @param user 用户信息
      * @return 结果
      */
-    @Override
     public int updateUser(User user)
+    {
+        return userDao.updateUser(user);
+    }
+
+    /**
+     * 修改用户密码
+     * 
+     * @param user 用户信息
+     * @return 结果
+     */
+    @Override
+    public int resetUserPwd(User user)
     {
         user.randomSalt();
         user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));

+ 1 - 1
src/main/resources/application.yml

@@ -1,7 +1,7 @@
 # 项目名称、版本、版权年份
 ruoyi:
   name: RuoYi
-  version: 1.1.1
+  version: 1.1.2
   copyrightYear: 2018
 
 #开发环境配置

BIN
src/main/resources/static/img/a1.jpg


BIN
src/main/resources/static/img/a2.jpg


BIN
src/main/resources/static/img/a3.jpg


BIN
src/main/resources/static/img/a4.jpg


BIN
src/main/resources/static/img/a6.jpg


BIN
src/main/resources/static/img/a7.jpg


BIN
src/main/resources/static/img/a8.jpg


BIN
src/main/resources/static/img/a9.jpg


+ 0 - 0
src/main/resources/static/img/a5.jpg → src/main/resources/static/img/profilel.jpg


+ 1 - 1
src/main/resources/static/ruoyi/css/RuoYi.css

@@ -1,5 +1,5 @@
 /*!
- *   ruoyi.css v1.1.1
+ *   ruoyi.css
  *   Author: Ruoyi
  */
 

+ 1 - 1
src/main/resources/static/ruoyi/system/dept/add.js

@@ -5,7 +5,7 @@ $("#form-dept-add").validate({
 			remote: {
                 url: ctx + "system/dept/checkDeptNameUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
                 	"deptName" : function() {
                         return $("input[name='deptName']").val();

+ 1 - 1
src/main/resources/static/ruoyi/system/dept/edit.js

@@ -5,7 +5,7 @@ $("#form-dept-edit").validate({
 			remote: {
                 url: ctx + "system/dept/checkDeptNameUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
                 	"deptId": function() {
                         return $("input[name='deptId']").val();

+ 1 - 1
src/main/resources/static/ruoyi/system/dict/type/add.js

@@ -9,7 +9,7 @@ $("#form-dict-add").validate({
 			remote: {
                 url: ctx + "system/dict/checkDictTypeUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
                 	name : function() {
                         return $.trim($("#dictType").val());

+ 1 - 1
src/main/resources/static/ruoyi/system/dict/type/edit.js

@@ -9,7 +9,7 @@ $("#form-dict-edit").validate({
 			remote: {
                 url: ctx + "system/dict/checkDictTypeUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
                 	dictId : function() {
                         return $.trim($("#dictId").val());

+ 1 - 1
src/main/resources/static/ruoyi/system/menu/add.js

@@ -5,7 +5,7 @@ $("#form-menu-add").validate({
 			remote: {
                 url: ctx + "system/menu/checkMenuNameUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
                 	"menuName" : function() {
                         return $.trim($("#menuName").val());

+ 1 - 1
src/main/resources/static/ruoyi/system/menu/edit.js

@@ -10,7 +10,7 @@ $("#form-menu-edit").validate({
 			remote: {
                 url: ctx + "system/menu/checkMenuNameUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
                 	"menuId": function() {
                         return $("input[name='menuId']").val();

+ 1 - 1
src/main/resources/static/ruoyi/system/role/add.js

@@ -23,7 +23,7 @@ $("#form-role-add").validate({
 			remote: {
                 url: ctx + "system/role/checkRoleNameUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
                 	"roleName" : function() {
                         return $.trim($("#roleName").val());

+ 1 - 1
src/main/resources/static/ruoyi/system/role/edit.js

@@ -23,7 +23,7 @@ $("#form-role-edit").validate({
 			remote: {
                 url: ctx + "system/role/checkRoleNameUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
 					"roleId": function() {
 					    return $("input[name='roleId']").val();

+ 1 - 1
src/main/resources/static/ruoyi/system/user/add.js

@@ -6,7 +6,7 @@ $("#form-user-add").validate({
 			remote: {
                 url: ctx + "system/user/checkUserNameUnique",
                 type: "post",
-                dataType: "text",
+                dataType: "json",
                 data: {
                 	name : function() {
                         return $.trim($("#loginName").val());

+ 2 - 2
src/main/resources/templates/include.html

@@ -33,8 +33,8 @@
 	<script src="../static/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js" th:src="@{/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js}"></script>
 	<script src="../static/ajax/libs/bootstrap-table/extensions/export/tableExport.js" th:src="@{/ajax/libs/bootstrap-table/extensions/export/tableExport.js}"></script>
 	<script src="../static/ajax/libs/layer/layer.min.js" th:src="@{/ajax/libs/layer/layer.min.js}"></script>
-	<script src="../static/ruoyi/js/common.js?v=1.1.1" th:src="@{/ruoyi/js/common.js?v=1.1.1}"></script>
-	<script src="../static/ruoyi/js/ry-ui.js?v=1.1.1" th:src="@{/ruoyi/js/ry-ui.js?v=1.1.1}"></script>
+	<script src="../static/ruoyi/js/common.js?v=1.1.2" th:src="@{/ruoyi/js/common.js?v=1.1.2}"></script>
+	<script src="../static/ruoyi/js/ry-ui.js?v=1.1.2" th:src="@{/ruoyi/js/ry-ui.js?v=1.1.2}"></script>
 	<script th:inline="javascript"> var ctx = [[@{/}]]; </script>
 	<script src="http://tajs.qq.com/stats?sId=62048022"></script>
 </div>

+ 25 - 3
src/main/resources/templates/main.html

@@ -45,8 +45,8 @@
                 <a class="btn btn-success btn-outline" href="https://gitee.com/y_project/RuoYi" target="_blank">
                     <i class="fa fa-cloud"> </i> 访问码云
                 </a>
-                <a class="btn btn-white btn-bitbucket" href="https://www.oschina.net/p/ruoyi" target="_blank">
-                    <i class="fa fa-home"></i> 访问博客
+                <a class="btn btn-white btn-bitbucket" href="http://ruoyi.club/" target="_blank">
+                    <i class="fa fa-home"></i> 访问主页
                 </a>
             </p>
         </div>
@@ -94,13 +94,35 @@
                     <div class="ibox-content no-padding">
                         <div class="panel-body">
                             <div class="panel-group" id="version">
+                            <div class="panel panel-default">
+                            	<div class="panel-heading">
+                                        <h5 class="panel-title">
+                                                <a data-toggle="collapse" data-parent="#version" href="#v11">v1.1.2</a><code class="pull-right">2018.05.07</code>
+                                            </h5>
+                                    </div>
+                                    <div id="v11" class="panel-collapse collapse in">
+                                        <div class="panel-body">
+                                            <ol>
+                                            	<li>新增个人信息修改</li>
+												<li>菜单存在子菜单不允许删除</li>
+												<li>菜单分配角色不允许删除</li>
+												<li>角色分配人员不允许删除</li>
+												<li>岗位使用后不允许删除</li>
+												<li>保证用户的数据完整性加入事物</li>
+												<li>新增环境使用手册、数据建模</li>
+												<li>Thymeleaf升级到3.0</li>
+												<li>支持非ROOT部署</li>
+                                            </ol>
+                                        </div>
+                                    </div>
+                                </div>
                                 <div class="panel panel-default">
                             	<div class="panel-heading">
                                         <h5 class="panel-title">
                                                 <a data-toggle="collapse" data-parent="#version" href="#v11">v1.1.1</a><code class="pull-right">2018.04.23</code>
                                             </h5>
                                     </div>
-                                    <div id="v11" class="panel-collapse collapse in">
+                                    <div id="v11" class="panel-collapse collapse">
                                         <div class="panel-body">
                                             <ol>
                                             	<li>新增表单构建器</li>

+ 90 - 0
src/main/resources/templates/system/user/profile/edit.html

@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.w3.org/1999/xhtml">
+<meta charset="utf-8">
+<head th:include="include :: header"></head>
+<body class="white-bg">
+	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+		<form class="form-horizontal m" id="form-user-edit">
+			<input name="userId"  type="hidden"  th:value="${user.userId}" />
+			<div class="form-group">
+				<label class="col-sm-3 control-label ">登录名称:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="text" readonly="true" th:value="${user.loginName}"/>
+				</div>
+			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label">部门名称:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="text" readonly="true" th:value="${user.dept.deptName}">
+				</div>
+			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label">用户名称:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="text" name="userName" id="userName" th:value="${user.userName}">
+				</div>
+			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label">邮箱:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="text" name="email" th:value="${user.email}">
+				</div>
+			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label">手机:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="text" name="phonenumber" id="phonenumber" th:value="${user.phonenumber}">
+				</div>
+			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label">性别:</label>
+				<div class="col-sm-8">
+					<div class="radio radio-info radio-inline">
+						<input type="radio" id="radio1" th:field="*{user.sex}" name="sex" value="0">
+						<label for="radio1">男</label>
+					</div>
+					<div class="radio radio-danger radio-inline">
+						<input type="radio" id="radio2" th:field="*{user.sex}" name="sex" value="1">
+						<label for="radio2">女</label>
+					</div>
+				</div>
+			</div>
+			
+			<div class="form-group">
+				<div class="form-control-static col-sm-offset-9">
+					<button type="submit" class="btn btn-primary">提交</button>
+					<button th:onclick="'javascript:layer_close()'" class="btn btn-danger" type="button">关闭</button>
+				</div>
+			</div>
+		</form>
+	</div>
+	<div th:include="include::footer"></div>
+	<script>
+		$("#form-user-edit").validate({
+			rules:{
+				userName:{
+					required:true,
+				},
+				password:{
+					required:true,
+					minlength: 6
+				},
+				email:{
+					required:true,
+					email:true
+				},
+				phonenumber:{
+					required:true,
+				},
+			},
+			submitHandler:function(form){
+				update();
+			}
+		});
+		
+		function update() {
+			_ajax_save(ctx + "system/user/profile/update", $("#form-user-edit").serialize());
+		}
+	</script>
+</body>
+</html>

+ 9 - 13
src/main/resources/templates/system/user/profile.html → src/main/resources/templates/system/user/profile/profile.html

@@ -25,9 +25,8 @@
                             <i class="fa fa-edit"></i>
                         </a>
                         <ul class="dropdown-menu dropdown-user">
-                            <li><a href="javascript:editProfile()">修改信息</a></li>
-                            <li><a href="javascript:editHead()">修改头像</a></li>
-                            <li><a href="javascript:editPasswod()">修改密码</a></li>
+                            <li><a href="javascript:edit()">修改信息</a></li>
+                            <li><a href="javascript:resetPwd()">修改密码</a></li>
                         </ul>
                        
                     </div>
@@ -35,7 +34,7 @@
                     <div class="contact-box">
 	                        <div class="col-sm-4">
 	                            <div class="text-center">
-	                                <img alt="image" class="img-circle m-t-xs img-responsive" src="/img/a5.jpg">
+	                                <img alt="image" class="img-circle m-t-xs img-responsive" src="/img/profilel.jpg">
 	                                <div class="m-t-xs font-bold">CEO</div>
 	                            </div>
 	                        </div>
@@ -60,17 +59,14 @@
     <script>
         var userId = [[${user.userId}]];
 	    /*用户信息-修改*/
-	    function editProfile() {
-	        var url = ctx + "system/user/edit/" + userId;
+	    function edit() {
+	        var url = ctx + "system/user/profile/edit/" + userId;
 	        layer_showAuto("修改用户", url);
 	    }
-	    /*用户头像-修改*/
-	    function editHead() {
-	    	$.modalAlert("敬请期待", "success");
-	    }
-	    /*用户密码-修改*/
-	    function editPasswod() {
-	    	$.modalAlert("敬请期待", "success");
+	    /*用户管理-重置密码*/
+	    function resetPwd() {
+	        var url = ctx + 'system/user/profile/resetPwd/' + userId;
+	        layer_show("重置密码", url, '800', '500');
 	    }
 	</script>
 </body>

+ 113 - 0
src/main/resources/templates/system/user/profile/resetPwd.html

@@ -0,0 +1,113 @@
+<!DOCTYPE html>
+<html xmlns:th="http://www.w3.org/1999/xhtml">
+<meta charset="utf-8">
+<head th:include="include :: header"></head>
+<body class="white-bg">
+	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
+		<form class="form-horizontal m" id="form-user-resetPwd">
+			<input name="userId"  type="hidden"  th:value="${user.userId}" />
+			<div class="form-group">
+				<label class="col-sm-3 control-label ">登录名称:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="text" readonly="true" name="loginName" th:value="${user.loginName}"/>
+				</div>
+			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label">旧密码:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="password" name="oldPassword" id="oldPassword">
+				</div>
+			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label">新密码:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="password" name="password" id="password">
+				</div>
+			</div>
+			<div class="form-group">
+				<label class="col-sm-3 control-label">再次确认:</label>
+				<div class="col-sm-8">
+					<input class="form-control" type="password" name="confirm" id="confirm">
+				</div>
+			</div>
+			<div class="form-group">
+				<div class="form-control-static col-sm-offset-9">
+					<button type="submit" class="btn btn-primary">提交</button>
+					<button th:onclick="'javascript:layer_close()'" class="btn btn-danger" type="button">关闭</button>
+				</div>
+			</div>
+		</form>
+	</div>
+	<div th:include="include :: footer"></div>
+
+	<script>
+		$("#form-user-resetPwd").validate({
+			rules:{
+				oldPassword:{
+					required:true,
+					minlength: 6,
+					remote: {
+	                    url: ctx + "system/user/profile/checkPassword",
+	                    type: "get",
+	                    dataType: "json",
+	                    data: {
+	                        password: function() {
+	                            return $("input[name='oldPassword']").val();
+	                        }
+	                    }
+	                }
+				},
+				password: {
+	                required: true,
+	                minlength: 6
+	            },
+	            confirm: {
+	                required: true,
+	                equalTo: "#password"
+	            }
+			},
+			messages: {
+	            oldPassword: {
+	                required: "请输入原密码",
+	                remote: "原密码错误"
+	            },
+	            password: {
+	                required: "请输入新密码",
+	                minlength: "密码不能小于6个字符"
+	            },
+	            confirm: {
+	                required: "请再次输入新密码",
+	                equalTo: "两次密码输入不一致"
+	            }
+
+	        },
+			submitHandler:function(form){
+				resetPwd();
+			}
+		});
+		
+		function resetPwd() {
+			$.ajax({
+				cache : true,
+				type : "post",
+				url : ctx + "system/user/profile/resetPwd",
+				data : $('#form-user-resetPwd').serialize(),
+				async : false,
+				error : function(request) {
+					parent.layer.alert("系统错误");
+				},
+				success : function(data) {
+					if (data.code == 0) {
+						parent.layer.msg("修改成功,正在刷新数据请稍后……",{icon:1,time: 500,shade: [0.1,'#fff']},function(){
+							window.parent.location.reload();
+						});
+					} else {
+						parent.layer.alert(data.m , {icon: 2,title:"系统提示"});
+					}
+				}
+			});
+		}
+	</script>
+</body>
+
+</html>