user-changepwd.html 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 pt0" style="padding-top:0;">
  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 bc333" v-cloak>
  35. <van-button type="primary" block color="#FFD500" :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/appfunc.min.js"></script>
  41. <script src="./static/js/klm-axios-config.js"></script>
  42. <script src="./static/js/publicfn.js"></script>
  43. <script>
  44. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  45. // 可以通过下面的方式手动注册
  46. Vue.use(vant.Lazyload);
  47. // 在 #app 标签下渲染一个按钮组件
  48. let app = new Vue({
  49. el: '#app',
  50. data() {
  51. return {
  52. toptitleisshow:false,
  53. newpwd2: '',
  54. canSubmit: false,
  55. isShowPwd: false,
  56. changepwd:{
  57. Id:'',
  58. LoginPwd:'',
  59. NewLoginPwd:''
  60. }
  61. };
  62. },
  63. created() {
  64. this.toptitleisshow = toptitleisshow;
  65. this.changepwd.Id = PublicLib.getCookieInfo('userId');
  66. },
  67. methods: {
  68. //- 确定按钮是否可用
  69. checkValue(){
  70. this.canSubmit = (this.changepwd.LoginPwd !== '' && this.changepwd.NewLoginPwd !== '' && this.newpwd2 !== '') ? true : false;
  71. },
  72. //- 是否显示密码
  73. showPwd(){
  74. this.isShowPwd = !this.isShowPwd;
  75. },
  76. //- 修改密码
  77. async changepwdfn(){
  78. if(this.changepwd.NewLoginPwd.length < 6 || this.changepwd.NewLoginPwd.length > 16) return tips('密码长度应为6~16位');
  79. if(this.newpwd2 !== this.changepwd.NewLoginPwd) return tips('两次密码不一致,请重新输入!');
  80. const res = await postRequest('api/v1/users/modifyloginpwd?t='+Math.random(6),JSON.stringify(this.changepwd));
  81. if(res.status !== '1') return tips(res.info);
  82. tips('修改登录密码成功!');
  83. setTimeout(()=>{
  84. PublicLib.GoBack({Level:-1});
  85. },2000);
  86. },
  87. goback(){
  88. PublicLib.GoBack({Level:1});
  89. }
  90. }
  91. });
  92. </script>
  93. </body>
  94. </html>