profile.html 13 KB

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