user-forgetpwd.html 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <!DOCTYPE html>
  2. <html class="h100p">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>忘记密码-爽客邦</title>
  6. <meta name="keywords" content="忘记密码-爽客邦">
  7. <meta name="description" content="忘记密码-爽客邦">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="忘记密码-爽客邦">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. </head>
  17. <body class="bgc-back h100p nopb">
  18. <div id="app">
  19. <van-nav-bar class="bgcf7f7f7 user_rank_explan_title" left-arrow @click-left="goback" v-if="toptitleisshow">
  20. <template #left> <img src="./static/images/left.png" alt=""></template>
  21. </van-nav-bar>
  22. <div class="regist-box-input pt8 pb32 pl32 pr32">
  23. <div class="f24 c333 b pb32">忘记密码</div>
  24. <div class="f12 c666 mb6">手机号</div>
  25. <van-field class="mb12" v-model="reg.Mobile" @input="checkValue" placeholder="请输入注册手机号"></van-field>
  26. <div class="f12 c666 mb6">验证码</div>
  27. <van-field class="user-phone mb12" center clearable placeholder="请输入验证码" v-model="reg.MobileCode" @input="checkValue">
  28. <template #button>
  29. <van-button class="fl" plain color="#FF502A" @click="getsmscode" v-if="codeisclick">获取验证码</van-button>
  30. <van-button class="fl" plain color="#FF502A" disabled v-else>{{countdown}}s</van-button>
  31. </template>
  32. </van-field>
  33. <div class="f12 c666 mb6">登录密码</div>
  34. <van-field class="mb12" v-model="reg.LoginPwd" @input="checkValue" :type="isShowPwd ? 'text' : 'password'" placeholder="请输入新的登录密码">
  35. <template #button>
  36. <van-button class="fr" @click="showPwd()"><img class="fr" :src="isShowPwd ? './static/images/show-icon@3x.png' : './static/images/noshow-icon@3x.png'" alt=""></van-button>
  37. </template>
  38. </van-field>
  39. <van-field v-model="surepassword" @input="checkValue" :type="isShowPwd ? 'text' : 'password'" placeholder="再次输入以确认"></van-field>
  40. <div class="pt16" v-cloak>
  41. <van-button type="primary" block color="#FF502A" :disabled="canRegist ? false : true" @click="changepwd">确认</van-button>
  42. </div>
  43. </div>
  44. </div>
  45. <script src="./static/js/klm-vv.min.js"></script>
  46. <script src="./static/js/klm-axios-config.js"></script>
  47. <script>
  48. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  49. // 可以通过下面的方式手动注册
  50. Vue.use(vant.Lazyload);
  51. // 在 #app 标签下渲染一个按钮组件
  52. let app = new Vue({
  53. el: '#app',
  54. data() {
  55. return {
  56. toptitleisshow:false,
  57. active: 0,
  58. surepassword: '',
  59. isShowPwd: false,
  60. reg:{
  61. Mobile: '',
  62. MobileCode: '',
  63. LoginPwd:''
  64. },
  65. agreement: false,
  66. canRegist: false,
  67. codeisclick:true,
  68. countdown:60
  69. };
  70. },
  71. created(){
  72. this.toptitleisshow = toptitleisshow;
  73. },
  74. methods: {
  75. //- 显示密码
  76. showPwd(){
  77. this.isShowPwd = !this.isShowPwd;
  78. },
  79. //- 确定按钮是否能够使用
  80. checkValue(){
  81. this.canRegist = (this.reg.Mobile !== '' && this.reg.MobileCode !== '' && this.reg.LoginPwd !== '' && this.surepassword !== '') ? true : false;
  82. },
  83. //- 获取验证码
  84. async getsmscode(){
  85. if(verification(this.reg.Mobile)) return
  86. this.codeisclick = false;
  87. setTimeout(()=>{
  88. this.codeisclick = true;
  89. },60000);
  90. const timer = setInterval(()=>{
  91. this.countdown--;
  92. if(this.countdown === 0) {
  93. this.countdown = 60;
  94. clearInterval(timer)
  95. }
  96. },1000);
  97. const res = await postRequest('/api/v1/mobilecodecheck/sendsms',JSON.stringify({Mobile:this.reg.Mobile}));
  98. if(res.status !== '1') tips(res.info);
  99. tips('验证码发送成功,请注意查收!');
  100. },
  101. //- 修改密码
  102. async changepwd(){
  103. if(verificationpassword(this.reg.LoginPwd)) return;
  104. if(verificationmobilecode(this.reg.MobileCode)) return;
  105. if(verification(this.reg.Mobile)) return;
  106. if(this.reg.LoginPwd !== this.surepassword){
  107. return tips('两次密码不一致,请重新输入!');
  108. };
  109. const res = await postRequest('/api/v1/users/forgetpwd',JSON.stringify(this.reg));
  110. if(res.status !== '1') return tips(res.info);
  111. tips('修改密码成功,请返回登录');
  112. setTimeout(()=>{
  113. this.goback();
  114. },2000);
  115. },
  116. goback(){
  117. PublicLib.GoBack({Level:1});
  118. }
  119. }
  120. });
  121. </script>
  122. </body>
  123. </html>