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.

register-step1.vue 4.1KB

2 yıl önce
2 yıl önce
7 ay önce
7 ay önce
1 yıl önce
1 yıl önce
7 ay önce
7 ay önce
6 ay önce
6 ay önce
2 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <!-- 注册第1步 -->
  2. <template>
  3. <view class="register-main">
  4. <view class="title">注册账户</view>
  5. <view class="hint">请输入手机号</view>
  6. <view class="form-input">
  7. <view> +86</view>
  8. <image :src="`${$imgUrl}common/arror_down_black.png`" class="arror" />
  9. <input class="input" v-model="state.phone" focus placeholder="请输入手机号" placeholder-class="form-placeholder"
  10. type="number" maxlength="11" />
  11. </view>
  12. <view class="agreement">
  13. <checkbox-group @change="checkboxChange" class="group">
  14. <checkbox :checked="state.checked" color="#00B38B" style="transform:scale(0.85)">
  15. </checkbox>
  16. <label>我已阅读并同意</label>
  17. </checkbox-group>
  18. <view class="txt-green" @click="toRead">《平台用户服务隐私协议》</view>
  19. </view>
  20. </view>
  21. <view class="btn">
  22. <submit-button title="同意协议并获取验证码" @submit="mobileIsRepeat"></submit-button>
  23. </view>
  24. </template>
  25. <script setup lang="ts">
  26. import { reactive } from "vue";
  27. import { checkStr, msg, navTo } from "@/utils/utils";
  28. import { sendMessage, mobileIsRepeatApi } from "@/utils/network/api.js";
  29. import {requestNew } from "@/utils/network/request.js";
  30. const state = reactive({
  31. phone: "", //电话
  32. checked: false, //是否勾选阅读协议
  33. });
  34. const checkboxChange = (e) => {
  35. console.log(e);
  36. state.checked = !state.checked;
  37. };
  38. // 去协议页面
  39. const toRead = () => {
  40. navTo("/login/agreement")
  41. }
  42. /* 下一步 */
  43. const nextStep = () => {
  44. if (!state.phone) {
  45. msg("请输入手机号!");
  46. return;
  47. }
  48. if (!checkStr(state.phone, "mobile")) {
  49. msg("请输入正确的手机号!");
  50. return;
  51. }
  52. if (!state.checked) {
  53. msg("请勾选我已阅读并同意《平台用户服务隐私协议》");
  54. return;
  55. }
  56. const options = {
  57. type: 2,
  58. data: { mobile: state.phone },
  59. method: "POST",
  60. showLoading: true,
  61. };
  62. requestNew(sendMessage, options)
  63. .then((res) => {
  64. msg("验证码发送成功!");
  65. // #ifdef MP-WEIXIN
  66. navTo(`/login/register-step2?phone=${state.phone}`);
  67. // #endif
  68. // #ifdef MP-ALIPAY
  69. navTo(`/login/register-step2-ali?phone=${state.phone}`);
  70. // #endif
  71. })
  72. .catch((err) => {
  73. console.log(err);
  74. });
  75. };
  76. const mobileIsRepeat = () => {
  77. if (!state.phone) {
  78. msg("请输入手机号!");
  79. return;
  80. }
  81. if (!checkStr(state.phone, "mobile")) {
  82. msg("请输入正确的手机号!");
  83. return;
  84. }
  85. if (!state.checked) {
  86. msg("请勾选我已阅读并同意《平台用户服务隐私协议》");
  87. return;
  88. }
  89. const options = {
  90. type: 2,
  91. data: { mobile: state.phone },
  92. method: "POST",
  93. showLoading: true,
  94. };
  95. requestNew(mobileIsRepeatApi, options)
  96. .then((res) => {
  97. const result = res;
  98. console.log("个人账号重复注册校验", result.canRegister)
  99. // if (result.canRegister) {
  100. nextStep();
  101. // } else {
  102. // msg("该手机号已注册!");
  103. // }
  104. })
  105. .catch((err) => {
  106. console.log(err);
  107. });
  108. };
  109. </script>
  110. <style lang="scss" scoped>
  111. .group {
  112. display: flex;
  113. align-items: center;
  114. }
  115. .register-main {
  116. border-top: 1rpx solid #dcdcdc;
  117. padding: 78rpx 30rpx 50rpx;
  118. .title {
  119. font-size: 32rpx;
  120. color: #333333;
  121. font-weight: 600;
  122. }
  123. .hint {
  124. font-size: 24rpx;
  125. color: #999999;
  126. margin-top: 20rpx;
  127. }
  128. .form-input {
  129. margin-top: 80rpx;
  130. display: flex;
  131. flex-direction: row;
  132. align-items: center;
  133. height: 90rpx;
  134. border-bottom: 1rpx solid #dcdcdc;
  135. padding: 0rpx 12rpx;
  136. font-size: 28rpx;
  137. color: #333333;
  138. &:last-child {
  139. margin-top: 50rpx;
  140. }
  141. .input {
  142. flex: 1;
  143. padding-right: 48rpx;
  144. background: transparent;
  145. }
  146. .arror {
  147. width: 28rpx;
  148. height: 25rpx;
  149. margin-left: 16rpx;
  150. margin-right: 40rpx;
  151. }
  152. .eye {
  153. width: 48rpx;
  154. height: 48rpx;
  155. }
  156. }
  157. .form-placeholder {
  158. color: #999999;
  159. }
  160. .agreement {
  161. font-size: 24rpx;
  162. display: flex;
  163. align-items: center;
  164. margin-top: 60rpx;
  165. .txt-grey {
  166. color: #666666;
  167. }
  168. .txt-green {
  169. color: #00b38b;
  170. }
  171. :deep(.u-checkbox) {
  172. margin-right: -20rpx;
  173. }
  174. }
  175. }
  176. .btn {
  177. margin: 200rpx 40rpx 0px;
  178. }
  179. </style>