forgotPW.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <template>
  2. <div class="forgotPW">
  3. <nav-bar title="修改密码" @click-left="$router.back()"/>
  4. <van-form @submit="changePW">
  5. <van-field
  6. placeholder="请输入手机号"
  7. v-model="formData.phone"
  8. :rules="[{ required: true, message: '请输入手机号' }]"
  9. />
  10. <van-field
  11. v-model="formData.code"
  12. name="validator"
  13. placeholder="请输入短信验证码"
  14. :rules="[{ validator: validatorVerification, message: '请输入6位数验证码' }]"
  15. type="digit"
  16. maxlength="6"
  17. >
  18. <template #button>
  19. <van-button size="small" type="primary" color="#FF5B00" @click="fetchVerification">获取验证码</van-button>
  20. </template>
  21. </van-field>
  22. <van-field
  23. type="password"
  24. placeholder="请输入密码"
  25. v-model="formData.password"
  26. :rules="[{ required: true, message: '请填写密码' }]"
  27. />
  28. <van-field
  29. type="password"
  30. placeholder="请确认密码"
  31. v-model="formData.newPassword"
  32. :rules="[{ required: true, message: '请确认密码' }]"
  33. />
  34. <div class="change-btn">
  35. <van-button :class="disabled ? 'login-btn-disable' : 'login-btn'" :disabled="disabled" native-type="submit">修改密码</van-button>
  36. </div>
  37. </van-form>
  38. </div>
  39. </template>
  40. <script>
  41. export default {
  42. data () {
  43. return {
  44. formData: {
  45. phone: '',
  46. code: '',
  47. password: '',
  48. newPassword: ''
  49. },
  50. disabled: true
  51. }
  52. },
  53. methods: {
  54. changePW () {},
  55. validatorVerification (val) {
  56. return /\d{6}/.test(val)
  57. },
  58. fetchVerification () {}
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .forgotPW {
  64. width: 100%;
  65. height: 100vh;
  66. background: #fff;
  67. }
  68. .login-btn-disable {
  69. margin-top: 16vw;
  70. width: 80vw;
  71. background: #FFDCC8;
  72. color: #fff;
  73. }
  74. .login-btn {
  75. margin-top: 16vw;
  76. width: 80vw;
  77. background: #FF5B00;
  78. color: #fff;
  79. }
  80. .change-btn {
  81. display: flex;
  82. justify-content: center;
  83. }
  84. </style>