Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

forget-pwd-step3.vue 3.8KB

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