You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

forget-pwd-step3.vue 3.7KB

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