user-changepwd.html 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <!DOCTYPE html>
  2. <html>
  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="bgcf7f7f7">
  18. <div id="app" v-cloak>
  19. <van-nav-bar class="bgcf7f7f7 user_rank_explan_title user_title_normal" 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="changepwd.LoginPwd" @input="checkValue" type="password" placeholder="请输入原密码" maxlength="16"></van-field>
  26. <div class="f12 c666 mb6">新密码</div>
  27. <van-field class="mb12" v-model="changepwd.NewLoginPwd" @input="checkValue" :type="isShowPwd ? 'text' : 'password'" placeholder="请输入新密码" maxlength="16">
  28. <template #button>
  29. <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>
  30. </template>
  31. </van-field>
  32. <div class="f12 c666 mb6">确认密码</div>
  33. <van-field class="mb12" v-model="newpwd2" @input="checkValue" type="password" placeholder="请再次输入以确认" maxlength="16"></van-field>
  34. <div class="pt16" v-cloak>
  35. <van-button type="primary" block color="#FF502A" :disabled="canSubmit ? false : true" @click="changepwdfn">完成</van-button>
  36. </div>
  37. </div>
  38. </div>
  39. <script src="./static/js/klm-vv.min.js"></script>
  40. <script src="./static/js/klm-axios-config.js"></script>
  41. <script>
  42. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  43. // 可以通过下面的方式手动注册
  44. Vue.use(vant.Lazyload);
  45. // 在 #app 标签下渲染一个按钮组件
  46. let app = new Vue({
  47. el: '#app',
  48. data() {
  49. return {
  50. toptitleisshow:false,
  51. newpwd2: '',
  52. canSubmit: false,
  53. isShowPwd: false,
  54. changepwd:{
  55. Id:'',
  56. LoginPwd:'',
  57. NewLoginPwd:''
  58. }
  59. };
  60. },
  61. created() {
  62. this.toptitleisshow = toptitleisshow;
  63. this.changepwd.Id = PublicLib.getCookieInfo('userId');
  64. },
  65. methods: {
  66. //- 确定按钮是否可用
  67. checkValue(){
  68. this.canSubmit = (this.changepwd.LoginPwd !== '' && this.changepwd.NewLoginPwd !== '' && this.newpwd2 !== '') ? true : false;
  69. },
  70. //- 是否显示密码
  71. showPwd(){
  72. this.isShowPwd = !this.isShowPwd;
  73. },
  74. //- 修改密码
  75. async changepwdfn(){
  76. if(this.changepwd.NewLoginPwd.length < 6 || this.changepwd.NewLoginPwd.length > 16) return tips('密码长度应为6~16位');
  77. if(this.newpwd2 !== this.changepwd.NewLoginPwd) return tips('两次密码不一致,请重新输入!');
  78. const res = await postRequest('/api/v1/users/modifyloginpwd',JSON.stringify(this.changepwd));
  79. if(res.status !== '1') return tips(res.info);
  80. tips('修改登录密码成功!');
  81. setTimeout(()=>{
  82. PublicLib.GoBack({Level:1});
  83. },2000);
  84. },
  85. goback(){
  86. PublicLib.GoBack({Level:1});
  87. }
  88. }
  89. });
  90. </script>
  91. </body>
  92. </html>