password.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view class="register-container">
  3. <!-- 标题和进度 -->
  4. <navBar title="创建账号密码2/2" color="#000" />
  5. <view class="progress-box">
  6. <view class="progress-item"></view>
  7. <view class="progress-item"></view>
  8. </view>
  9. <!-- 表单区域 -->
  10. <view class="register-form">
  11. <!-- 密码输入 -->
  12. <view class="form-item">
  13. <view class="item-label"> 密码 </view>
  14. <u-input
  15. placeholder="请输入密码"
  16. v-model="password"
  17. clearable
  18. type="password"
  19. maxlength="20"
  20. class="custom-input"
  21. >
  22. </u-input>
  23. </view>
  24. <u-button
  25. type="primary"
  26. :disabled="!canNext"
  27. @click="handleNext"
  28. :customStyle="{
  29. marginTop: '32rpx',
  30. height: '90rpx',
  31. fontSize: '32rpx',
  32. borderRadius: '100rpx',
  33. }"
  34. >
  35. 继续
  36. </u-button>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import navBar from "@/components/nav-bar/index.vue";
  42. export default {
  43. data() {
  44. return {
  45. };
  46. },
  47. components: {
  48. navBar,
  49. },
  50. computed: {
  51. // 是否可以下一步
  52. canNext() {
  53. return (
  54. this.canGetCode &&
  55. this.verificationCode.length === 6 &&
  56. /^\d{6}$/.test(this.verificationCode)
  57. );
  58. },
  59. },
  60. methods: {
  61. // 下一步
  62. handleNext() {
  63. if (!this.validateForm()) {
  64. return;
  65. }
  66. uni.showLoading({
  67. title: "验证中...",
  68. mask: true,
  69. });
  70. // 模拟验证码验证
  71. setTimeout(() => {
  72. uni.hideLoading();
  73. // 这里应该是验证码验证逻辑
  74. if (this.verificationCode === "123456") {
  75. // 模拟固定验证码
  76. uni.showToast({
  77. title: "验证成功",
  78. icon: "success",
  79. });
  80. // 跳转到下一步(注册2/2)
  81. setTimeout(() => {
  82. uni.navigateTo({
  83. url: `/pages/my/jobApplicant/password?phone=${this.phoneNumber}`,
  84. });
  85. }, 1000);
  86. } else {
  87. uni.showToast({
  88. title: "验证码错误",
  89. icon: "none",
  90. });
  91. }
  92. }, 1500);
  93. },
  94. // 表单验证
  95. validateForm() {
  96. if (!this.password) {
  97. uni.showToast({
  98. title: "请输入密码",
  99. icon: "none",
  100. });
  101. return false;
  102. }
  103. return true;
  104. },
  105. },
  106. };
  107. </script>
  108. <style scoped lang="scss">
  109. .register-container {
  110. background: #fff;
  111. position: absolute;
  112. left: 0;
  113. right: 0;
  114. top: 0;
  115. bottom: 0;
  116. }
  117. .register-form {
  118. padding: 32rpx;
  119. box-sizing: border-box;
  120. }
  121. .form-item {
  122. margin-bottom: 32rpx;
  123. }
  124. .item-label {
  125. color: rgba(18, 26, 44, 1);
  126. font-family: Roboto;
  127. font-size: 32rpx;
  128. font-weight: 400;
  129. line-height: 51.2rpx;
  130. letter-spacing: 0px;
  131. text-align: left;
  132. padding-bottom: 6rpx;
  133. }
  134. .custom-input {
  135. box-sizing: border-box;
  136. border: 2rpx solid rgba(158, 161, 168, 1);
  137. border-radius: 24rpx;
  138. background: rgba(255, 255, 255, 1);
  139. padding: 8rpx 24rpx !important;
  140. }
  141. .input-box {
  142. position: relative;
  143. }
  144. .next-btn-active {
  145. background: #2979ff;
  146. }
  147. ::v-deep .u-input {
  148. text-align: left !important;
  149. }
  150. .progress-box {
  151. display: flex;
  152. justify-content: center;
  153. align-items: center;
  154. gap: 24rpx;
  155. padding-top: 40rpx;
  156. box-sizing: border-box;
  157. .progress-item {
  158. width: 40rpx;
  159. height: 8rpx;
  160. background-color: #016bf6;
  161. border-radius: 40rpx;
  162. }
  163. }
  164. </style>