Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

forget-pwd-step3.vue 3.6KB

2 år sedan
1 år sedan
2 år sedan
1 år sedan
2 år sedan
1 år sedan
2 år sedan
1 år sedan
2 år sedan
1 år sedan
2 år sedan
1 år sedan
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <!-- 注册第3步 -->
  2. <template>
  3. <view class="register-main">
  4. <view class="title">重置密码</view>
  5. <view class="hint">重置之前的密码,设置新密码</view>
  6. <view class="hint1">请输入密码</view>
  7. <view class="form-input">
  8. <input class="input" v-model="state.password" placeholder="请输入密码" placeholder-class="form-placeholder"
  9. :password="state.isPwdType ? true : false" type="text" />
  10. <image :src="`${$imgUrl}login/${
  11. state.isPwdType ? 'icon_eye_close' : 'icon_eye_open'
  12. }.png`" class="eye" @click="state.isPwdType = !state.isPwdType" mode="aspectFill"></image>
  13. </view>
  14. <view class="hint2">请再次输入密码</view>
  15. <view class="form-input">
  16. <input class="input" v-model="state.affirmPassword" placeholder="请再次输入密码"
  17. placeholder-class="form-placeholder" :password="state.isAffirmPwdType ? true : false" type="text" />
  18. <image :src="`${$imgUrl}login/${
  19. state.isAffirmPwdType ? 'icon_eye_close' : 'icon_eye_open'
  20. }.png`" class="eye" @click="state.isAffirmPwdType = !state.isAffirmPwdType" mode="aspectFill"></image>
  21. </view>
  22. <view class="hint4">{{ state.pwdHint }}</view>
  23. </view>
  24. <view class="btn">
  25. <submit-button title="确认更改" @submit="doResetPwd"></submit-button>
  26. </view>
  27. </template>
  28. <script setup lang="ts">
  29. import { msg, confirm, checkStr } from "@/utils/utils";
  30. import { reactive } from "vue";
  31. import { onLoad } from "@dcloudio/uni-app";
  32. import { request } from "@/utils/network/request";
  33. import { resetPwd } from "@/utils/network/api";
  34. const state = reactive({
  35. isPwdType: true,
  36. isAffirmPwdType: true,
  37. password: "", //密码
  38. affirmPassword: "",//再次输入密码
  39. phone: "", //手机号
  40. code: "", //验证码
  41. pwdHint: "密码不少于10位,必须同时包含数字、大小写字母和特殊符号",
  42. });
  43. onLoad((options) => {
  44. state.phone = options.phone;
  45. state.code = options.code;
  46. });
  47. /* 忘记密码 */
  48. const doResetPwd = () => {
  49. if (!state.password) {
  50. msg("请输入密码");
  51. return;
  52. }
  53. if (!state.affirmPassword) {
  54. msg("请再次输入密码");
  55. return;
  56. }
  57. if (state.password !== state.affirmPassword) {
  58. msg("两次密码输入不一致,请重新输入!");
  59. return;
  60. }
  61. const options = {
  62. type: 2,
  63. data: {
  64. newPassword: state.password,
  65. affirmNewPassword: state.affirmPassword,
  66. mobile: state.phone,
  67. code: state.code,
  68. },
  69. method: "POST",
  70. showLoading: true,
  71. };
  72. request(resetPwd, options).then((res) => {
  73. confirm(
  74. "密码重置成功,请登录!",
  75. () => {
  76. uni.$emit("login", { phone: state.phone });
  77. uni.navigateBack({ delta: 3 });
  78. },
  79. "提示",
  80. false
  81. );
  82. });
  83. };
  84. </script>
  85. <style lang="scss" scoped>
  86. .register-main {
  87. border-top: 1rpx solid #dcdcdc;
  88. padding: 78rpx 30rpx 50rpx;
  89. .title {
  90. font-size: 32rpx;
  91. color: #333333;
  92. font-weight: 600;
  93. }
  94. .hint {
  95. font-size: 24rpx;
  96. color: #999999;
  97. margin-top: 20rpx;
  98. }
  99. .hint1 {
  100. color: #333333;
  101. font-size: 28rpx;
  102. margin-top: 100rpx;
  103. font-weight: 600;
  104. }
  105. .hint2 {
  106. color: #333333;
  107. font-size: 28rpx;
  108. margin-top: 50rpx;
  109. font-weight: 600;
  110. }
  111. .hint4 {
  112. margin-top: 30rpx;
  113. font-size: 26rpx;
  114. color: #00b38b;
  115. }
  116. }
  117. .form-input {
  118. display: flex;
  119. flex-direction: row;
  120. align-items: center;
  121. height: 90rpx;
  122. margin-top: 30rpx;
  123. border-bottom: 1rpx solid #dcdcdc;
  124. color: #333333;
  125. .input {
  126. flex: 1;
  127. padding-right: 48rpx;
  128. font-size: 26rpx;
  129. background: transparent;
  130. }
  131. .eye {
  132. width: 48rpx;
  133. height: 48rpx;
  134. }
  135. }
  136. .form-placeholder {
  137. color: #999999;
  138. }
  139. .btn {
  140. margin: 150rpx 40rpx 0px;
  141. }
  142. </style>