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 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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-grey">我已阅读并同意</view> -->
  19. <view class="txt-green" @click="toRead">《平台用户服务隐私协议》</view>
  20. </view>
  21. </view>
  22. <view class="btn">
  23. <submit-button title="同意协议并获取验证码" @submit="nextStep"></submit-button>
  24. </view>
  25. </template>
  26. <script setup lang="ts">
  27. // import uCheckBox from "@/uni_modules/vk-uview-ui/components/u-checkbox/u-checkbox.vue";
  28. import { reactive } from "vue";
  29. import { checkStr, msg, navTo } from "@/utils/utils";
  30. import { sendCode, regist } from "@/utils/network/api.js";
  31. import { request } from "@/utils/network/request.js";
  32. const state = reactive({
  33. phone: "", //电话
  34. checked: false, //是否勾选阅读协议
  35. });
  36. const checkboxChange = (e) => {
  37. console.log(e);
  38. state.checked = !state.checked;
  39. };
  40. // 去协议页面
  41. const toRead=()=>{
  42. navTo("/login/agreement")
  43. }
  44. /* 下一步 */
  45. const nextStep = () => {
  46. if (!state.phone) {
  47. msg("请输入手机号!");
  48. return;
  49. }
  50. if (!checkStr(state.phone, "mobile")) {
  51. msg("请输入正确的手机号!");
  52. return;
  53. }
  54. if (!state.checked) {
  55. msg("请勾选我已阅读并同意《平台用户服务隐私协议》");
  56. return;
  57. }
  58. const options = {
  59. type: 2,
  60. data: { mobile: state.phone },
  61. method: "POST",
  62. showLoading: true,
  63. };
  64. request(sendCode, options)
  65. .then((res) => {
  66. msg("验证码发送成功!");
  67. // #ifdef MP-WEIXIN
  68. navTo(`/login/register-step2?phone=${state.phone}`);
  69. // #endif
  70. // #ifdef MP-ALIPAY
  71. navTo(`/login/register-step2-ali?phone=${state.phone}`);
  72. // #endif
  73. })
  74. .catch((err) => {
  75. console.log(err);
  76. });
  77. };
  78. </script>
  79. <style lang="scss" scoped>
  80. .group {
  81. display: flex;
  82. align-items: center;
  83. }
  84. .register-main {
  85. border-top: 1rpx solid #dcdcdc;
  86. padding: 78rpx 30rpx 50rpx;
  87. .title {
  88. font-size: 32rpx;
  89. color: #333333;
  90. font-weight: 600;
  91. }
  92. .hint {
  93. font-size: 24rpx;
  94. color: #999999;
  95. margin-top: 20rpx;
  96. }
  97. .form-input {
  98. margin-top: 80rpx;
  99. display: flex;
  100. flex-direction: row;
  101. align-items: center;
  102. height: 90rpx;
  103. border-bottom: 1rpx solid #dcdcdc;
  104. padding: 0rpx 12rpx;
  105. font-size: 28rpx;
  106. color: #333333;
  107. &:last-child {
  108. margin-top: 50rpx;
  109. }
  110. .input {
  111. flex: 1;
  112. padding-right: 48rpx;
  113. background: transparent;
  114. }
  115. .arror {
  116. width: 28rpx;
  117. height: 25rpx;
  118. margin-left: 16rpx;
  119. margin-right: 40rpx;
  120. }
  121. .eye {
  122. width: 48rpx;
  123. height: 48rpx;
  124. }
  125. }
  126. .form-placeholder {
  127. color: #999999;
  128. }
  129. .agreement {
  130. font-size: 24rpx;
  131. display: flex;
  132. align-items: center;
  133. margin-top: 60rpx;
  134. .txt-grey {
  135. color: #666666;
  136. }
  137. .txt-green {
  138. color: #00b38b;
  139. }
  140. :deep(.u-checkbox) {
  141. margin-right: -20rpx;
  142. }
  143. }
  144. }
  145. .btn {
  146. margin: 200rpx 40rpx 0px;
  147. }
  148. </style>