From 8ca3de2f0d7e8c03b34e837ea6fec417101b3742 Mon Sep 17 00:00:00 2001 From: qi Date: Tue, 3 Sep 2019 04:45:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=9B=B4=E6=96=B0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E8=B5=84=E6=96=99=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lq/cms/web/IndexController.java | 9 +++ .../com/lq/cms/web/sys/UserController.java | 14 +++- src/main/profile/dev/jdbc.properties | 2 +- src/main/profile/dev/redis.properties | 2 +- .../WEB-INF/views/jsp/cms/main/head.jsp | 24 +++++- .../WEB-INF/views/jsp/cms/main/userEdit.jsp | 71 +++++++++++++++++- .../WEB-INF/views/jsp/cms/sys/user/edit.jsp | 14 +--- .../views/jsp/cms/wechat/rule/index.jsp | 2 - .../resources/code/images/uploadIcon.png | Bin 0 -> 702 bytes .../webapp/resources/code/js/imageUtil.js | 12 +++ 10 files changed, 129 insertions(+), 21 deletions(-) create mode 100644 src/main/webapp/resources/code/images/uploadIcon.png create mode 100644 src/main/webapp/resources/code/js/imageUtil.js diff --git a/src/main/java/com/lq/cms/web/IndexController.java b/src/main/java/com/lq/cms/web/IndexController.java index 600c40b..9af6c0a 100755 --- a/src/main/java/com/lq/cms/web/IndexController.java +++ b/src/main/java/com/lq/cms/web/IndexController.java @@ -22,6 +22,7 @@ import org.apache.shiro.session.Session; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; @@ -109,4 +110,12 @@ public class IndexController { return ajaxResult; } + @RequestMapping("/userEdit") + public String toUserEdit(Model model){ + Subject subject = SecurityUtils.getSubject(); + SysUser sysUser = (SysUser) subject.getPrincipal(); + model.addAttribute("sysUser",sysUser); + return "cms/main/userEdit"; + } + } diff --git a/src/main/java/com/lq/cms/web/sys/UserController.java b/src/main/java/com/lq/cms/web/sys/UserController.java index c133ca2..ac133ed 100755 --- a/src/main/java/com/lq/cms/web/sys/UserController.java +++ b/src/main/java/com/lq/cms/web/sys/UserController.java @@ -133,7 +133,6 @@ public class UserController { if (sysUser!=null&&sysUser.getId()!=null){ sysUserService.delete(sysUser.getId()); } - return ajaxResult; } @@ -145,7 +144,6 @@ public class UserController { String fileType = FileUtil.fileFormat(multipartFile.getOriginalFilename()); newFileName = "user/"+uuid.toString()+"."+fileType; File newFile = new File(FILE_LOAD_PATH +newFileName); - if (!newFile.exists()){ newFile.mkdirs(); } @@ -173,7 +171,6 @@ public class UserController { sysUserService.update(sysUser); subject.logout(); SecurityUtils.getSecurityManager().logout(subject); - }else { ajaxResult.setSuccess(false); ajaxResult.setMsg("旧密码不正确!,请重新输入."); @@ -186,4 +183,15 @@ public class UserController { } + public AjaxResult updateUser(SysUser sysUser){ + Subject subject = SecurityUtils.getSubject(); + SysUser loginUser =(SysUser)subject.getPrincipal(); + if (loginUser!=null){ + BeanUtil.copyNotNull(loginUser,sysUser); + sysUserService.update(loginUser); + } + return new AjaxResult(); + } + + } diff --git a/src/main/profile/dev/jdbc.properties b/src/main/profile/dev/jdbc.properties index cf92f01..2087517 100644 --- a/src/main/profile/dev/jdbc.properties +++ b/src/main/profile/dev/jdbc.properties @@ -1,6 +1,6 @@ #--------- jdbc 配置--------- jdbc.driver=com.mysql.jdbc.Driver -jdbc.url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8 +jdbc.url=jdbc:mysql://192.168.31.110:3306/ssm?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8 jdbc.user=root jdbc.password=mysql #--------数据库连接池配置 ------- diff --git a/src/main/profile/dev/redis.properties b/src/main/profile/dev/redis.properties index 80be888..80de386 100644 --- a/src/main/profile/dev/redis.properties +++ b/src/main/profile/dev/redis.properties @@ -1,4 +1,4 @@ -redis.host=127.0.0.1 +redis.host=192.168.31.110 redis.port=6379 redis.pass= redis.timeout=-1 diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/main/head.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/main/head.jsp index c5c354a..7858c4f 100755 --- a/src/main/webapp/WEB-INF/views/jsp/cms/main/head.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/main/head.jsp @@ -350,8 +350,30 @@ } //设置用户资料 + var iframeWin ; function setUserData() { - alert("开发中....."); + layer.open({ + id:"setUserDate", + type: 2, + area: ['380px', '400px'], + fixed: false, //不固定 + maxmin: false, + title:"编辑个人信息", + btn:["确定","取消"], + btn1:function(index){ + + var body = layer.getChildFrame('body', index); + // var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method(); + iframeWin.postDate(); + layer.close(index); + }, + btnAlign: 'c', + content: '${ctx}/cms/userEdit', + success: function(layero, index){ + iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象,执行iframe页的方法: + + } + }); } \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/main/userEdit.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/main/userEdit.jsp index db7c6f9..b80e851 100644 --- a/src/main/webapp/WEB-INF/views/jsp/cms/main/userEdit.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/main/userEdit.jsp @@ -6,12 +6,81 @@ To change this template use File | Settings | File Templates. --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ include file="../../common/import-tag.jsp" %> 用户资料编辑 + + - + + + + + + + + + + + + + + + + + +
+ 用户名: + + +
+ 邮箱: + + +
+ 头像: + + + +
+ 备注: + + +
+ + + diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/edit.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/edit.jsp index d39ba67..9690965 100755 --- a/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/edit.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/sys/user/edit.jsp @@ -4,6 +4,7 @@ 编辑 + diff --git a/src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp b/src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp index 4091fd8..8125f85 100755 --- a/src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp +++ b/src/main/webapp/WEB-INF/views/jsp/cms/wechat/rule/index.jsp @@ -403,7 +403,6 @@ btn:['确定','取消'], btn1:function(index,layero){ messageSet = bufferSet; - console.log(messageSet); layer.close(index); }, skin: 'layui-layer-rim', //加上边框 @@ -629,7 +628,6 @@ } function appendAlertHtml(data){ - console.log(data); var isShow ; var wechatMessageList = data.wechatMessageVoList; var html = '

图文('+data.wechatMessageCount+')

'; diff --git a/src/main/webapp/resources/code/images/uploadIcon.png b/src/main/webapp/resources/code/images/uploadIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..32675ef4aaa187e97be30b49ce501801409cd6f0 GIT binary patch literal 702 zcmeAS@N?(olHy`uVBq!ia0vp^CqS5k2}mkgS)K$^jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85o30K$!7fntTNV15>c4i(^Pd+}k^jUPl}R94=1zzQ0&gBE?PO zjFNoFz1vH!-JSm~F174?!|uIv<9AHm;K9+|LJ3iC9%E`ezgcwmq0Z8i;i2+!>2ZQ$ zoQV?!h5|9;uI=&Yvu7+nz82+GQJ=Qz-?XItF|8^su1cKRRoewMzpbv?^WXS>oTAuU z_jOJ}hm;g`h61t1yX^a%dFgSIr(F(qx;jMwJw!Ia()U=l<-Ka{iMvl90Mi_Ur>mdK II;Vst0MbR*nE(I) literal 0 HcmV?d00001 diff --git a/src/main/webapp/resources/code/js/imageUtil.js b/src/main/webapp/resources/code/js/imageUtil.js new file mode 100644 index 0000000..3200f5b --- /dev/null +++ b/src/main/webapp/resources/code/js/imageUtil.js @@ -0,0 +1,12 @@ +//构建本地图片路径 +function getObjectURL(file) { + var url = null ; + if (window.createObjectURL!=undefined) { + url = window.createObjectURL(file) ; + } else if (window.URL!=undefined) { + url = window.URL.createObjectURL(file) ; + } else if (window.webkitURL!=undefined) { + url = window.webkitURL.createObjectURL(file) ; + } + return url ; +} \ No newline at end of file