profile.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('用户个人信息')" />
  5. <style type="text/css">.user-info-head{position:relative;display:inline-block;}.user-info-head:hover:after{content:'\f030';position:absolute;left:0;right:0;top:0;bottom:0;color:#eee;background:rgba(0,0,0,0.5);font-family:FontAwesome;font-size:24px;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;cursor:pointer;line-height:110px;border-radius:50%;}</style>
  6. </head>
  7. <body class="gray-bg" style="font: 14px Helvetica Neue, Helvetica, PingFang SC, 微软雅黑, Tahoma, Arial, sans-serif !important;">
  8. <input id="userId" name="userId" type="hidden" th:value="${user.userId}" />
  9. <section class="section-content">
  10. <div class="row">
  11. <div class="col-sm-3 pr5">
  12. <div class="ibox float-e-margins">
  13. <div class="ibox-title ibox-title-gray dashboard-header gray-bg">
  14. <h5>个人资料</h5>
  15. </div>
  16. <div class="ibox-content">
  17. <div class="text-center">
  18. <p class="user-info-head" onclick="avatar()"><img class="img-circle img-lg" th:src="(${#strings.isEmpty(user.avatar)}) ? @{/img/profile.jpg} : @{${user.avatar}}" th:onerror="'this.src=\'' + @{'/img/profile.jpg'} + '\''"></p>
  19. <p><a href="javascript:avatar()">修改头像</a></p>
  20. </div>
  21. <ul class="list-group list-group-striped">
  22. <li class="list-group-item"><i class="fa fa-user"></i>
  23. <b class="font-noraml">登录名称:</b>
  24. <p class="pull-right">[[${user.loginName}]]</p>
  25. </li>
  26. <!--<li class="list-group-item"><i class="fa fa-phone"></i>
  27. <b class="font-noraml">手机号码:</b>
  28. <p class="pull-right">[[${user.phonenumber}]]</p>
  29. </li>
  30. <li class="list-group-item" th:if="${user.dept?.deptName != null}"><i class="fa fa-group"></i>
  31. <b class="font-noraml">所属部门:</b>
  32. <p class="pull-right" style="overflow: hidden; white-space: nowrap; text-overflow: ellipsis;width:120px;">[[${user.dept?.deptName}]] / [[${#strings.defaultString(postGroup,'无岗位')}]]</p>
  33. </li>
  34. <li class="list-group-item"><i class="fa fa-envelope-o"></i>
  35. <b class="font-noraml">邮箱地址:</b>
  36. <p class="pull-right" th:title="${user.email}">[[${#strings.abbreviate(user.email, 16)}]]</p>
  37. </li>-->
  38. <li class="list-group-item"><i class="fa fa-calendar"></i>
  39. <b class="font-noraml">创建时间:</b>
  40. <p class="pull-right">[[${#dates.format(user.createTime, 'yyyy-MM-dd')}]]</p>
  41. </li>
  42. </ul>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="col-sm-9 about">
  47. <div class="ibox float-e-margins">
  48. <div class="ibox-title ibox-title-gray dashboard-header">
  49. <h5>基本资料</h5>
  50. </div>
  51. <div class="ibox-content">
  52. <div class="nav-tabs-custom">
  53. <ul class="nav nav-tabs">
  54. <li class="active"><a href="#user_info" data-toggle="tab" aria-expanded="true">基本资料</a></li>
  55. <li><a href="#modify_password" data-toggle="tab" aria-expanded="false">修改密码</a></li>
  56. </ul>
  57. <div class="tab-content">
  58. <!--用户信息-->
  59. <div class="tab-pane active" id="user_info" th:object="${user}">
  60. <form class="form-horizontal" id="form-user-edit">
  61. <!--隐藏ID-->
  62. <input name="id" id="id" type="hidden">
  63. <div class="form-group">
  64. <label class="col-sm-2 control-label">用户名称:</label>
  65. <div class="col-sm-10">
  66. <input type="text" class="form-control" name="userName" th:field="*{userName}" placeholder="请输入用户名称">
  67. </div>
  68. </div>
  69. <!--<div class="form-group">
  70. <label class="col-sm-2 control-label">手机号码:</label>
  71. <div class="col-sm-10">
  72. <input type="text" class="form-control" name="phonenumber" maxlength="11" th:field="*{phonenumber}" placeholder="请输入手机号码">
  73. </div>
  74. </div>
  75. <div class="form-group">
  76. <label class="col-sm-2 control-label">邮箱:</label>
  77. <div class="col-sm-10">
  78. <input type="text" maxlength="50" class="form-control" name="email" th:field="*{email}" placeholder="请输入邮箱">
  79. </div>
  80. </div>
  81. <div class="form-group">
  82. <label class="col-sm-2 control-label">性别:</label>
  83. <div class="col-sm-10">
  84. <div class="radio-box">
  85. <input type="radio" id="radio1" th:field="*{sex}" name="sex" value="0">
  86. <label for="radio1">男</label>
  87. </div>
  88. <div class="radio-box">
  89. <input type="radio" id="radio2" th:field="*{sex}" name="sex" value="1">
  90. <label for="radio2">女</label>
  91. </div>
  92. </div>
  93. </div>-->
  94. <div class="form-group">
  95. <div class="col-sm-offset-2 col-sm-10">
  96. <button type="button" class="btn btn-sm btn-primary" onclick="submitUserInfo()"><i class="fa fa-check"></i>保 存</button>&nbsp;
  97. <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
  98. </div>
  99. </div>
  100. </form>
  101. </div>
  102. <!--修改密码-->
  103. <div class="tab-pane" id="modify_password">
  104. <form class="form-horizontal" id="form-user-resetPwd">
  105. <div class="form-group">
  106. <label class="col-sm-2 control-label">旧密码:</label>
  107. <div class="col-sm-10">
  108. <input type="password" class="form-control" name="oldPassword" placeholder="请输入旧密码">
  109. </div>
  110. </div>
  111. <div class="form-group">
  112. <label class="col-sm-2 control-label">新密码:</label>
  113. <div class="col-sm-10">
  114. <input type="password" class="form-control" name="newPassword" id="newPassword" placeholder="请输入新密码">
  115. <th:block th:with="chrtype=${@config.getKey('sys.account.chrtype')}">
  116. <th:block th:if="${chrtype != '0'}">
  117. <span class="help-block m-b-none">
  118. <th:block th:if="${chrtype == '1'}"><i class="fa fa-info-circle" style="color: red;"></i> 密码只能为0-9数字 </th:block>
  119. <th:block th:if="${chrtype == '2'}"><i class="fa fa-info-circle" style="color: red;"></i> 密码只能为a-z和A-Z字母</th:block>
  120. <th:block th:if="${chrtype == '3'}"><i class="fa fa-info-circle" style="color: red;"></i> 密码必须包含(字母,数字)</th:block>
  121. <th:block th:if="${chrtype == '4'}"><i class="fa fa-info-circle" style="color: red;"></i> 密码必须包含(字母,数字,特殊字符!@#$%^&*()-=_+)</th:block>
  122. </span>
  123. </th:block>
  124. </th:block>
  125. </div>
  126. </div>
  127. <div class="form-group">
  128. <label class="col-sm-2 control-label">确认密码:</label>
  129. <div class="col-sm-10">
  130. <input type="password" class="form-control" name="confirmPassword" placeholder="请确认密码">
  131. </div>
  132. </div>
  133. <div class="form-group">
  134. <div class="col-sm-offset-2 col-sm-10">
  135. <button type="button" class="btn btn-sm btn-primary" onclick="submitChangPassword()"><i class="fa fa-check"></i>保 存</button>&nbsp;
  136. <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
  137. </div>
  138. </div>
  139. </form>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. </div>
  147. </section>
  148. <th:block th:include="include :: footer" />
  149. <script>
  150. /*用户管理-头像*/
  151. function avatar() {
  152. var url = ctx + 'system/user/profile/avatar';
  153. top.layer.open({
  154. type: 2,
  155. area: [$(window).width() + 'px', $(window).height() + 'px'],
  156. fix: false,
  157. //不固定
  158. maxmin: true,
  159. shade: 0.3,
  160. title: "修改头像",
  161. content: url,
  162. btn: ['确定', '关闭'],
  163. // 弹层外区域关闭
  164. shadeClose: true,
  165. yes: function(index, layero) {
  166. var iframeWin = layero.find('iframe')[0];
  167. iframeWin.contentWindow.submitHandler(index, layero);
  168. },
  169. cancel: function(index) {
  170. return true;
  171. }
  172. });
  173. }
  174. /*用户信息-修改*/
  175. $("#form-user-edit").validate({
  176. onkeyup: false,
  177. rules:{
  178. userName:{
  179. required:true,
  180. },
  181. email:{
  182. required:true,
  183. email:true,
  184. remote: {
  185. url: ctx + "system/user/checkEmailUnique",
  186. type: "post",
  187. dataType: "json",
  188. data: {
  189. "userId": function() {
  190. return $("#userId").val();
  191. },
  192. "email": function() {
  193. return $.common.trim($("#email").val());
  194. }
  195. },
  196. dataFilter: function (data, type) {
  197. return $.validate.unique(data);
  198. }
  199. }
  200. },
  201. phonenumber:{
  202. required:true,
  203. isPhone:true,
  204. remote: {
  205. url: ctx + "system/user/checkPhoneUnique",
  206. type: "post",
  207. dataType: "json",
  208. data: {
  209. "userId": function() {
  210. return $("#userId").val();
  211. },
  212. "phonenumber": function() {
  213. return $.common.trim($("#phonenumber").val());
  214. }
  215. },
  216. dataFilter: function (data, type) {
  217. return $.validate.unique(data);
  218. }
  219. }
  220. },
  221. },
  222. messages: {
  223. "userName": {
  224. required: "请输入用户名称",
  225. },
  226. "email": {
  227. required: "请输入邮箱",
  228. remote: "Email已经存在"
  229. },
  230. "phonenumber":{
  231. required: "请输入手机号码",
  232. remote: "手机号码已经存在"
  233. }
  234. },
  235. focusCleanup: true
  236. });
  237. function submitUserInfo() {
  238. if ($.validate.form()) {
  239. $.operate.saveModal(ctx + "system/user/profile/update", $('#form-user-edit').serialize());
  240. }
  241. }
  242. /*用户管理-修改密码*/
  243. $("#form-user-resetPwd").validate({
  244. onkeyup: false,
  245. rules:{
  246. oldPassword:{
  247. required:true,
  248. remote: {
  249. url: ctx + "system/user/profile/checkPassword",
  250. type: "get",
  251. dataType: "json",
  252. data: {
  253. password: function() {
  254. return $("input[name='oldPassword']").val();
  255. }
  256. }
  257. }
  258. },
  259. newPassword: {
  260. required: true,
  261. minlength: 6,
  262. maxlength: 20
  263. },
  264. confirmPassword: {
  265. required: true,
  266. equalTo: "#newPassword"
  267. }
  268. },
  269. messages: {
  270. oldPassword: {
  271. required: "请输入原密码",
  272. remote: "原密码错误"
  273. },
  274. newPassword: {
  275. required: "请输入新密码",
  276. minlength: "密码不能小于6个字符",
  277. maxlength: "密码不能大于20个字符"
  278. },
  279. confirmPassword: {
  280. required: "请再次输入新密码",
  281. equalTo: "两次密码输入不一致"
  282. }
  283. },
  284. focusCleanup: true
  285. });
  286. function submitChangPassword () {
  287. var chrtype = [[${#strings.defaultString(@config.getKey('sys.account.chrtype'), 0)}]];
  288. var password = $("#newPassword").val();
  289. if ($.validate.form("form-user-resetPwd") && checkpwd(chrtype, password)) {
  290. $.operate.saveModal(ctx + "system/user/profile/resetPwd", $('#form-user-resetPwd').serialize());
  291. }
  292. }
  293. </script>
  294. </body>
  295. </html>