123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <!-- 注册第1步 -->
- <template>
- <view class="register-main">
- <view class="title">注册账户</view>
- <view class="hint">请输入手机号</view>
-
- <view class="form-input">
- <view> +86</view>
- <image :src="`${$imgUrl}common/arror_down_black.png`" class="arror" />
- <input class="input" v-model="state.phone" focus placeholder="请输入手机号" placeholder-class="form-placeholder"
- type="number" maxlength="11" />
- </view>
-
- <view class="agreement">
- <checkbox-group @change="checkboxChange" class="group">
- <checkbox :checked="state.checked" color="#00B38B" style="transform:scale(0.85)">
- </checkbox>
- <label>我已阅读并同意</label>
- </checkbox-group>
- <view class="txt-green" @click="toRead">《平台用户服务隐私协议》</view>
- </view>
- </view>
-
- <view class="btn">
- <submit-button title="同意协议并获取验证码" @submit="mobileIsRepeat"></submit-button>
- </view>
- </template>
-
- <script setup lang="ts">
- import { reactive } from "vue";
- import { checkStr, msg, navTo } from "@/utils/utils";
- import { sendMessage, mobileIsRepeatApi } from "@/utils/network/api.js";
- import {requestNew } from "@/utils/network/request.js";
- const state = reactive({
- phone: "", //电话
- checked: false, //是否勾选阅读协议
- });
- const checkboxChange = (e) => {
- console.log(e);
- state.checked = !state.checked;
- };
-
- // 去协议页面
- const toRead = () => {
- navTo("/login/agreement")
- }
-
- /* 下一步 */
- const nextStep = () => {
- if (!state.phone) {
- msg("请输入手机号!");
- return;
- }
- if (!checkStr(state.phone, "mobile")) {
- msg("请输入正确的手机号!");
- return;
- }
- if (!state.checked) {
- msg("请勾选我已阅读并同意《平台用户服务隐私协议》");
- return;
- }
-
- const options = {
- type: 2,
- data: { mobile: state.phone },
- method: "POST",
- showLoading: true,
- };
- requestNew(sendMessage, options)
- .then((res) => {
- msg("验证码发送成功!");
- // #ifdef MP-WEIXIN
- navTo(`/login/register-step2?phone=${state.phone}`);
- // #endif
- // #ifdef MP-ALIPAY
- navTo(`/login/register-step2-ali?phone=${state.phone}`);
- // #endif
- })
- .catch((err) => {
- console.log(err);
- });
- };
- const mobileIsRepeat = () => {
- if (!state.phone) {
- msg("请输入手机号!");
- return;
- }
- if (!checkStr(state.phone, "mobile")) {
- msg("请输入正确的手机号!");
- return;
- }
- if (!state.checked) {
- msg("请勾选我已阅读并同意《平台用户服务隐私协议》");
- return;
- }
-
- const options = {
- type: 2,
- data: { mobile: state.phone },
- method: "POST",
- showLoading: true,
- };
- requestNew(mobileIsRepeatApi, options)
- .then((res) => {
- const result = res;
- console.log("个人账号重复注册校验", result.canRegister)
- // if (result.canRegister) {
- nextStep();
- // } else {
- // msg("该手机号已注册!");
- // }
- })
- .catch((err) => {
- console.log(err);
- });
- };
- </script>
-
- <style lang="scss" scoped>
- .group {
- display: flex;
- align-items: center;
- }
-
- .register-main {
- border-top: 1rpx solid #dcdcdc;
- padding: 78rpx 30rpx 50rpx;
-
- .title {
- font-size: 32rpx;
- color: #333333;
- font-weight: 600;
- }
-
- .hint {
- font-size: 24rpx;
- color: #999999;
- margin-top: 20rpx;
- }
-
- .form-input {
- margin-top: 80rpx;
- display: flex;
- flex-direction: row;
- align-items: center;
- height: 90rpx;
- border-bottom: 1rpx solid #dcdcdc;
- padding: 0rpx 12rpx;
- font-size: 28rpx;
- color: #333333;
-
- &:last-child {
- margin-top: 50rpx;
- }
-
- .input {
- flex: 1;
- padding-right: 48rpx;
- background: transparent;
- }
-
- .arror {
- width: 28rpx;
- height: 25rpx;
- margin-left: 16rpx;
- margin-right: 40rpx;
- }
-
- .eye {
- width: 48rpx;
- height: 48rpx;
- }
- }
-
- .form-placeholder {
- color: #999999;
- }
-
- .agreement {
- font-size: 24rpx;
- display: flex;
- align-items: center;
- margin-top: 60rpx;
-
- .txt-grey {
- color: #666666;
- }
-
- .txt-green {
- color: #00b38b;
- }
-
- :deep(.u-checkbox) {
- margin-right: -20rpx;
- }
- }
- }
-
- .btn {
- margin: 200rpx 40rpx 0px;
- }
- </style>
|