reset.html 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>忘记密码</title>
  7. <style>
  8. label.error {
  9. left: 15px;
  10. top: 29px
  11. }
  12. #filePicker div:nth-child(2) {
  13. width: 100% !important;
  14. height: 100% !important;
  15. }
  16. .ke-container {
  17. width: 100% !important;
  18. }
  19. .ke-swfupload-body {
  20. height: 265px
  21. }
  22. .ke-dialog-body {
  23. height: 340px !important;
  24. }
  25. .ke-dialog-default {
  26. height: 410px !important;
  27. }
  28. </style>
  29. </head>
  30. <body layout:fragment="content">
  31. <article class="page-container">
  32. <form class="form form-horizontal" id="form-information-add">
  33. <div class="row cl">
  34. <label class="form-label col-xs-4 col-sm-2"><span class="c-red"></span></label>
  35. <div class="formControls col-xs-8 col-sm-9">
  36. <label>有“<span class="c-red">*</span>”的为必填项</label>
  37. </div>
  38. </div>
  39. <div class="row cl">
  40. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>账号名:</label>
  41. <div class="formControls col-xs-8 col-sm-4">
  42. <div class="add_contact">
  43. <p><input type="text" required class="ml_50 width_200 input-text nick_name" th:name="nick_name"
  44. th:id="nick_name"
  45. placeholder="请输入账号名"/></p>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="row cl">
  50. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>手机号:</label>
  51. <div class="formControls col-xs-8 col-sm-4">
  52. <div class="add_contact">
  53. <p><input type="text" required isMobile="true" class="ml_50 width_200 input-text phone"
  54. placeholder="请输入手机号" th:name="phone" th:id="phone"/></p>
  55. <input id="verificationCode" onClick="getVerificationCode()" type="button"
  56. class="btn btn-primary radius" value="获取验证码"/>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="row cl">
  61. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>验证码:</label>
  62. <div class="formControls col-xs-8 col-sm-4">
  63. <div class="add_contact">
  64. <p><input type="text" required class="ml_50 width_200 input-text" th:name="validateNum"
  65. placeholder="请输入短信验证码"/></p>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="row cl">
  70. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>新密码:</label>
  71. <div class="formControls col-xs-8 col-sm-4">
  72. <div class="add_contact">
  73. <p><input type="password" required class="ml_50 width_200 input-text " th:name="password"
  74. placeholder="请至少输入六个字符" th:id="password"/></p>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="row cl">
  79. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>确认密码:</label>
  80. <div class="formControls col-xs-8 col-sm-4">
  81. <div class="add_contact">
  82. <p><input type="password" required class="ml_50 width_200 input-text " th:name="repassword"
  83. placeholder="请再次输入密码"/></p>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="row cl">
  88. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  89. <button class="btn btn-primary radius" type="submit">提交</button>
  90. <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
  91. </div>
  92. </div>
  93. </form>
  94. </article>
  95. <script th:inline="javascript">
  96. /**
  97. * 取消
  98. */
  99. function removeIframe() {
  100. var index = parent.layer.getFrameIndex(window.name);
  101. parent.layer.close(index);
  102. }
  103. var contact_index = 0;
  104. //获取验证码
  105. function getVerificationCode() {
  106. var nick_name = $("#nick_name").val();
  107. if (nick_name) {
  108. if (!nick_name.trim()) {
  109. errorMessage('请输入账号名!');
  110. return;
  111. }
  112. } else {
  113. errorMessage('请输入账号名!');
  114. return;
  115. }
  116. var phone = $("#phone").val();
  117. var v_regex = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
  118. if (phone) {
  119. if (v_regex.test(phone)) {
  120. //startCountDown();
  121. sendVerificationCode(phone, nick_name);
  122. } else {
  123. errorMessage('手机号码格式不正确!');
  124. }
  125. } else {
  126. errorMessage('请输入手机号码!');
  127. }
  128. }
  129. //校验手机号码是否已被使用
  130. function checkPhoneNumber(phone) {
  131. $.ajax({
  132. dataType: "json",
  133. contentType: "application/json;charset=utf-8",
  134. url: pagePath + "/company/companyInfoManage/getPhone",
  135. type: "get",
  136. sync: true,
  137. data: {
  138. phone: phone
  139. },
  140. success: function (result) {
  141. if (result) {
  142. sendVerificationCode(phone);
  143. } else {
  144. errorMessage('该手机号码已被注册!');
  145. }
  146. },
  147. error: function () {
  148. errorMessage('系统错误!');
  149. }
  150. });
  151. }
  152. //发送验证码
  153. function sendVerificationCode(phone, nick_name) {
  154. $.ajax({
  155. contentType: "application/json;charset=utf-8",
  156. dataType: "json",
  157. url: pagePath + "/home/sendVerificationCodePhoneAndName",
  158. type: "get",
  159. sync: true,
  160. data: {
  161. phone: phone,
  162. nickname: nick_name
  163. },
  164. success: function (result) {
  165. if (result.success) {
  166. succeedMessage(result.message);
  167. startCountDown();
  168. } else {
  169. errorMessage(result.message);
  170. }
  171. },
  172. error: function () {
  173. errorMessage('系统错误!');
  174. }
  175. });
  176. }
  177. //验证码倒计时
  178. function startCountDown() {
  179. var second = 60;//时间默认值
  180. $("#verificationCode").attr("disabled", true);
  181. var timer = null;
  182. timer = setInterval(function () {
  183. $("#verificationCode").val(second + "秒后重发")
  184. second--;
  185. if (second < 0) {
  186. $("#verificationCode").attr("disabled", false);
  187. $("#verificationCode").val("获取验证码")
  188. clearInterval(timer);
  189. }
  190. }, 1000);
  191. }
  192. //保存企业信息
  193. $("#form-information-add").validate({
  194. rules: {
  195. nick_name: {
  196. minlength: 1,
  197. maxlength: 60,
  198. /*remote: {
  199. url: pagePath + "/company/companyInfoManage/getNickNameIsExist",
  200. type: "get",
  201. data: {
  202. nick_name: function () {
  203. return $("#nick_name").val();
  204. },
  205. id: ''
  206. }
  207. },*/
  208. },
  209. phone: {
  210. minlength: 1,
  211. maxlength: 20,
  212. /*remote: {
  213. url: pagePath + "/company/companyInfoManage/getPhone",
  214. type: "get",
  215. data: {
  216. company_name: function () {
  217. return $("#phone").val();
  218. },
  219. id: ''
  220. }
  221. },*/
  222. phone: true
  223. },
  224. isphone: {
  225. minlength: 1,
  226. maxlength: 20,
  227. phone: true
  228. },
  229. validateNum: {
  230. minlength: 1,
  231. maxlength: 20
  232. },
  233. password: {
  234. minlength: 6,
  235. maxlength: 20
  236. // password: true,
  237. },
  238. repassword: {
  239. minlength: 6,
  240. maxlength: 20,
  241. repassword: true
  242. }
  243. },
  244. messages: {
  245. phone: {
  246. remote: "该手机号码已被注册!"
  247. },
  248. nick_name: {
  249. remote: "账号名不存在!"
  250. }
  251. },
  252. //debug:true,
  253. onkeyup: false,
  254. focusCleanup: true,
  255. success: "valid",
  256. submitHandler: function (form) {
  257. $(form).ajaxSubmit({
  258. type: 'post',
  259. url: pagePath + "/home/reset",
  260. dataType: "json",
  261. success: function (data) {
  262. if (data.success) {
  263. succeedMessage(data.message);
  264. setTimeClose();
  265. } else {
  266. errorMessage(data.message);
  267. }
  268. },
  269. error: function () {
  270. errorMessage('系统错误!');
  271. }
  272. });
  273. return false; // 非常重要,如果是false,则表明是不跳转,在本页上处理,也就是ajax,如果是非false,则传统的form跳转。
  274. }
  275. });
  276. </script>
  277. </body>
  278. </html>