reset-pwd-verify.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="reset-container">
  3. <!-- 顶部导航栏 (自定义或使用原生) -->
  4. <!-- 这里假设使用原生导航栏,标题 "重置密码" -->
  5. <view class="content">
  6. <view class="tip-text">请输入 +86 {{ mobileMask }} 收到的短信验证码,进行验证~</view>
  7. <view class="input-group">
  8. <text class="label">验证码</text>
  9. <view class="input-wrapper">
  10. <input
  11. class="code-input"
  12. type="number"
  13. maxlength="6"
  14. v-model="code"
  15. />
  16. <view class="get-code-btn" @click="getVerifyCode">
  17. <text class="btn-text">{{ countDown > 0 ? `${countDown}s` : '获取验证码' }}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <button class="next-btn" @click="nextStep">下一步</button>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. mobile: '',
  30. code: '',
  31. countDown: 0,
  32. timer: null
  33. }
  34. },
  35. computed: {
  36. mobileMask() {
  37. if (!this.mobile) return '';
  38. return this.mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
  39. }
  40. },
  41. onLoad(options) {
  42. if (options.mobile) {
  43. this.mobile = options.mobile;
  44. } else {
  45. // 测试用默认手机号
  46. this.mobile = '13412346783';
  47. }
  48. },
  49. methods: {
  50. getVerifyCode() {
  51. if (this.countDown > 0) return;
  52. this.countDown = 60;
  53. this.timer = setInterval(() => {
  54. this.countDown--;
  55. if (this.countDown <= 0) {
  56. clearInterval(this.timer);
  57. }
  58. }, 1000);
  59. uni.showToast({ title: '验证码已发送', icon: 'none' });
  60. },
  61. nextStep() {
  62. if (!this.code) {
  63. uni.showToast({ title: '请输入验证码', icon: 'none' });
  64. return;
  65. }
  66. // 跳转到设置密码页
  67. uni.navigateTo({
  68. url: '/pages/login/reset-pwd-set'
  69. });
  70. }
  71. }
  72. }
  73. </script>
  74. <style>
  75. page {
  76. background-color: #fff;
  77. }
  78. .reset-container {
  79. padding: 40rpx;
  80. }
  81. .tip-text {
  82. font-size: 28rpx;
  83. color: #666;
  84. margin-bottom: 60rpx;
  85. line-height: 1.5;
  86. }
  87. .input-group {
  88. display: flex;
  89. align-items: center;
  90. border-bottom: 1px solid #f0f0f0;
  91. padding-bottom: 20rpx;
  92. margin-bottom: 60rpx;
  93. }
  94. .label {
  95. font-size: 30rpx;
  96. color: #333;
  97. width: 120rpx;
  98. }
  99. .input-wrapper {
  100. flex: 1;
  101. display: flex;
  102. align-items: center;
  103. justify-content: space-between;
  104. }
  105. .code-input {
  106. flex: 1;
  107. font-size: 30rpx;
  108. color: #333;
  109. }
  110. .get-code-btn {
  111. background-color: #F8F8F8;
  112. padding: 10rpx 20rpx;
  113. border-radius: 8rpx;
  114. }
  115. .btn-text {
  116. font-size: 26rpx;
  117. color: #FF5722;
  118. }
  119. .next-btn {
  120. background: linear-gradient(90deg, #FF6F00 0%, #FF5722 100%);
  121. color: #fff;
  122. font-size: 32rpx;
  123. font-weight: bold;
  124. border-radius: 8rpx; /* 图2也是带圆角的矩形,和登录页一致 */
  125. height: 88rpx;
  126. line-height: 88rpx;
  127. }
  128. .next-btn::after {
  129. border: none;
  130. }
  131. </style>