forget-password.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view>
  3. <u-toast ref="uToast" />
  4. <view class="w75">
  5. <view
  6. class="f-weight-bold"
  7. style="color: #333; font-size: 42rpx; padding-top: 100rpx"
  8. >修改密码</view
  9. >
  10. <view
  11. class="f-size-32"
  12. style="color: #bbb; margin-top: 20rpx"
  13. >请设置新密码</view
  14. >
  15. <view class="input" style="margin-top: 50rpx">
  16. <view>
  17. <input
  18. type="password"
  19. v-model="form.oldPassword"
  20. placeholder="请输入原密码"
  21. placeholder-class="placeholder-class"
  22. />
  23. </view>
  24. <view>
  25. <input
  26. type="password"
  27. v-model="form.password"
  28. placeholder="请输入新密码"
  29. placeholder-class="placeholder-class"
  30. />
  31. </view>
  32. <view>
  33. <input
  34. type="password"
  35. v-model="form.passwordConfirm"
  36. placeholder="请输入确认密码"
  37. placeholder-class="placeholder-class"
  38. />
  39. </view>
  40. </view>
  41. <!--<view
  42. class="f-size-24 my3"
  43. style="color: #bbb"
  44. >为保证您的帐户和资金安全,请不要设置与其他软件(如社交软件),网站(如社交平台、论坛)相同或相似的用户名和密码。
  45. </view>-->
  46. <button
  47. @tap="submit"
  48. class="main-color-bg text-color-white"
  49. style="border-radius: 80rpx; line-height: 100rpx"
  50. >
  51. 确定
  52. </button>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import { encryptPassword } from '@/utils/password';
  58. export default {
  59. data() {
  60. return {
  61. form: {
  62. oldPassword: '', // 手机号
  63. password: '', // 验证码
  64. passwordConfirm: '' // 密码
  65. }
  66. };
  67. },
  68. methods: {
  69. // 提交
  70. submit() {
  71. if (this.$BaseTool.String.isBlank(this.form.oldPassword)) {
  72. return this.$refs.uToast.show({
  73. title: '旧密码不能为空',
  74. type: 'default',
  75. icon: false
  76. });
  77. } else if (this.$BaseTool.String.isBlank(this.form.password)) {
  78. return this.$refs.uToast.show({
  79. title: '新密码不能为空',
  80. type: 'default',
  81. icon: false
  82. });
  83. } else if (this.$BaseTool.String.isBlank(this.form.passwordConfirm)) {
  84. return this.$refs.uToast.show({
  85. title: '确认密码不能为空',
  86. type: 'default',
  87. icon: false
  88. });
  89. } else if (this.form.password !== this.form.passwordConfirm) {
  90. return this.$refs.uToast.show({
  91. title: '密码与确认密码不一致',
  92. type: 'default',
  93. icon: false
  94. });
  95. } else {
  96. this.$Http.changePwd({
  97. oldPassword: encryptPassword(this.form.oldPassword),
  98. password: encryptPassword(this.form.password)
  99. }).then(r => {
  100. // 设置成功,跳转我的页面
  101. uni.reLaunch({ url: '/pages/my/my' });
  102. })
  103. }
  104. }
  105. }
  106. };
  107. </script>
  108. <style scoped lang="less">
  109. .input {
  110. width: 600rpx;
  111. margin: 0 auto;
  112. & > view {
  113. height: 100rpx;
  114. border-bottom: 1rpx solid #e6e6e6;
  115. }
  116. .code {
  117. height: 56rpx;
  118. line-height: 56rpx;
  119. padding: 0rpx 20rpx;
  120. background: #ffffff;
  121. border: 1rpx solid #0082ff;
  122. border-radius: 28rpx;
  123. }
  124. input {
  125. height: 100rpx;
  126. }
  127. }
  128. </style>