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.

change-phone.vue 3.4KB

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