Nessuna descrizione

forgetPassword.html 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
  7. <title>找回密码</title>
  8. <link rel="stylesheet" type="text/css" href="public/public_css.css"/>
  9. <style type="text/css">
  10. label{
  11. color: #444444;
  12. font-size: 0.16rem;
  13. display: inline-block;
  14. width: 0.65rem;
  15. }
  16. input{
  17. border: none;
  18. font-size: 0.16rem;
  19. outline: none;
  20. margin-left: 0.16rem;
  21. }
  22. .tel{
  23. width: 3.2rem;
  24. margin: auto;
  25. margin-top: 0.16rem;
  26. padding-bottom: 0.05rem;
  27. border-bottom: 0.01rem solid #D8D8D8;
  28. }
  29. .tel:nth-of-type(1){
  30. margin-top: 0.41rem;
  31. }
  32. .tel button{
  33. width: 0.73rem;
  34. height: 0.28rem;
  35. border-radius: 0.06rem;
  36. background: #F4F4F4;
  37. font-size: 0.14rem;
  38. color: #666666;
  39. }
  40. input[data-type="password1"]{
  41. width: 1.65rem;
  42. }
  43. .button{
  44. width: 2.18rem;
  45. height: 0.41rem;
  46. background: #F2F2F2;
  47. border-radius: 0.26rem;
  48. color: #666666;
  49. font-size: 0.2rem;
  50. margin: auto;
  51. margin-top: 0.68rem;
  52. display: block;
  53. }
  54. .getYzm{
  55. width: 2.54rem;
  56. background: #F2F2F2;
  57. border-radius: 0.06rem;
  58. margin: auto;
  59. margin-top: 0.15rem;
  60. margin-bottom: 0.15rem;
  61. }
  62. .getYzm input{
  63. font-size: 0.16rem;
  64. line-height: 0.22rem;
  65. color: #666666;
  66. background: #F2F2F2;
  67. width: 1.43rem;
  68. vertical-align: middle;
  69. }
  70. .getYzm img{
  71. height: 0.4rem;
  72. width: 0.8rem;
  73. display: inline-block;
  74. vertical-align: middle;
  75. margin: 0.1rem 0.1rem 0.1rem 0;
  76. }
  77. .yesOrNo{
  78. border-top: 0.01rem solid rgba(151,151,151,0.1998);
  79. }
  80. .yesOrNo button{
  81. width: 1.46rem;
  82. font-size: 0.14rem;
  83. line-height: 0.2rem;
  84. color: #0F7FFF;
  85. padding: 0.09rem 0 0.12rem 0;
  86. }
  87. .yesOrNo button:nth-of-type(1){
  88. border-right: 0.01rem solid rgba(151,151,151,0.1998);
  89. }
  90. </style>
  91. </head>
  92. <body>
  93. <div class="tel"><label>手机号</label><input type="tel" id="mobile" placeholder="请输入手机号" /></div>
  94. <div class="tel"><label>验证码</label><input data-type="password1" id="code" type="tel" placeholder="请输入密码" /><button id="mobileYzm" onclick="getYzmEvent()">验证码</button></div>
  95. <div class="tel"><label>新密码</label><input type="password" id="password" placeholder="6-16位数字、字母组合"/></div>
  96. <div class="tel"><label>确认密码</label><input type="password" id="password01" placeholder="请再次输入密码" /></div>
  97. <button class="button" onclick="goSetPassword()">完成</button>
  98. <div class="maskYzm">
  99. <div class="yzmCon">
  100. <div class="getYzm">
  101. <input type="text" id="imgYzm" placeholder="请输入验证码"/>
  102. <img onclick="imgYzmChange()" src="/api/V1/imgCode?mobile=13621209952" />
  103. </div>
  104. <div class="yesOrNo">
  105. <button onclick="cancelYzm()">取消</button>
  106. <button onclick="yesYzm()">确定</button>
  107. </div>
  108. </div>
  109. </div>
  110. <div class="mask">
  111. <div class="content">
  112. <h3>提示</h3>
  113. <p>密码错误啊啊啊啊啊</p>
  114. <div onclick="iknow()">我知道了</div>
  115. </div>
  116. </div>
  117. </body>
  118. </html>
  119. <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
  120. <script type="text/javascript">
  121. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  122. window.onresize = function(){
  123. document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
  124. }
  125. var time = '';
  126. function getYzmEvent(){
  127. var teleNumber = $("#mobile").val();
  128. var myMobile=/^[0-9]{11}$/;
  129. if (!myMobile.test(teleNumber)) {
  130. //手机号码未填写及填写不正确
  131. $(".maskYzm").css('visibility','hidden');
  132. $(".mask").css("visibility","visible");
  133. $(".mask .content p").html('请正确填写手机号码');
  134. }else{
  135. $(".mask").css("visibility","hidden")
  136. $(".maskYzm").css('visibility','visible');
  137. $(".getYzm img").attr("src",'/api/V1/imgCode?mobile=' + teleNumber + '&tmp=' + Date.parse(new Date()));
  138. $("#imgYzm").val("");
  139. }
  140. }
  141. function iknow() {
  142. $(".mask").css("visibility","hidden");
  143. $("#imgYzm").val("")
  144. }
  145. function cancelYzm(){
  146. $(".maskYzm").css("visibility","hidden")
  147. }
  148. function goSetPassword(){
  149. resetPassword();
  150. }
  151. function imgYzmChange () {
  152. //更换验证图片验证码
  153. $(".getYzm img").attr("src",'/api/V1/imgCode?mobile=' + $("#mobile").val() + '&tmp=' + Date.parse(new Date()));
  154. $("#imgYzm").val("")
  155. }
  156. function yesYzm () {
  157. var imgCode = $("#imgYzm").val();
  158. var teleNumber = $("#mobile").val();
  159. sendCode(imgCode,teleNumber)
  160. }
  161. function sendCode (imgCode,teleNumber) {
  162. $.ajax({
  163. type:"post",
  164. url:"/api/V1/h5SendCode",
  165. data: {
  166. img_code:imgCode,
  167. mobile:teleNumber,
  168. code_type:1,
  169. send_type:2
  170. },
  171. success: function (res) {
  172. console.log(res)
  173. if(JSON.parse(res).code == 0){
  174. time = JSON.parse(res).res.time_out;
  175. timeInterval = setInterval(timeDown,1000);
  176. $(".maskYzm").css("visibility","hidden")
  177. }else{
  178. $(".maskYzm").css("visibility","hidden");
  179. $(".mask").css("visibility","visible");
  180. $(".mask .content p").html(JSON.parse(res).message);
  181. }
  182. }
  183. });
  184. }
  185. // function passwordBlur () {
  186. // var password = $("#password").val();
  187. // var pwd = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/;
  188. // if(!pwd.test(password)){
  189. // //密码格式不正确
  190. //
  191. // }
  192. // }
  193. function timeDown () {
  194. $("#mobileYzm").attr('disabled','true')
  195. $("#mobileYzm").css("color","red");
  196. time -- ;
  197. if(time == 0){
  198. $("#mobileYzm").css("color","#666666");
  199. $("#mobileYzm").html('获取验证码');
  200. $("#mobileYzm").removeAttr('disabled')
  201. clearInterval(timeInterval);
  202. }else{
  203. $("#mobileYzm").html(time);
  204. }
  205. }
  206. function resetPassword () {
  207. $.ajax({
  208. type:"post",
  209. url:"/api/V1/h5ResetPassword",
  210. data:{
  211. 'mobile':$("#mobile").val(),
  212. 'password':$("#password").val(),
  213. 'c_password':$("#password01").val(),
  214. 'code':$("#code").val()
  215. },
  216. success: function (res){
  217. console.log(JSON.parse(res))
  218. if(JSON.parse(res).code == 0){
  219. //登录成功
  220. window.location.href="addSuccess.html";
  221. }else{
  222. var msg = JSON.parse(res).message[0]
  223. $(".mask").css("visibility","visible");
  224. if(msg.indexOf("mobile") != -1){
  225. msg = msg.replace('mobile', '手机号');
  226. }
  227. if(msg.indexOf("c_password") != -1){
  228. msg = msg.replace('c_password', '确认密码');
  229. }
  230. if(msg.indexOf("password") != -1){
  231. msg = msg.replace('password', '密码');
  232. }
  233. if(msg.indexOf("code") != -1){
  234. msg = msg.replace('code', '验证码');
  235. }
  236. $(".content p").html(msg);
  237. }
  238. }
  239. });
  240. }
  241. </script>