register_20230522094454.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view>
  3. <headContent>
  4. <template #left>
  5. <view class="head-revers-back iconfont" @click.stop="reversBackBtn()">&#xe604;</view>
  6. </template>
  7. </headContent>
  8. <view class="page-content">
  9. <text class="login-title">注册</text>
  10. <text class="login-content">立即注册属于您的币王账号</text>
  11. <tabList ref="tabListRef" :tabIndex.sync="tabIndexs" />
  12. <phoneRegister v-show="tabIndexs === 0" :accounts="accounts" />
  13. <email-register v-show="tabIndexs === 1" :accounts="accounts" />
  14. <view class="form-agreement" @click.stop="readAgreement = !readAgreement">
  15. <view class="agreement-confirm">
  16. <text class="confirm-icon iconfont" v-show="readAgreement">&#xe6c5;</text>
  17. </view>
  18. <text>我已阅读并同意</text>
  19. <text class="agreement-name" @click.stop="readAgreementText">《用户协议》</text>
  20. </view>
  21. <view class="form-btn" @click.stop="formSubmit">
  22. 下一步
  23. </view>
  24. <view class="form-hint">
  25. 已有账号?<text class="hint-btn"> 立即登录</text>
  26. </view>
  27. </view>
  28. <slider-verify ref="sliderVerifyRef" @slideImgSuccess="slideImgSuccess" />
  29. </view>
  30. </template>
  31. <script>
  32. import {
  33. reverseBack
  34. } from "@/utils/common.js"
  35. import tabList from "./modules/tab.vue"
  36. import emailRegister from "./modules/email-register.vue"
  37. import phoneRegister from "./modules/phone-register.vue"
  38. export default {
  39. name: 'register',
  40. components: {
  41. tabList,
  42. emailRegister,
  43. phoneRegister
  44. },
  45. data() {
  46. return {
  47. readAgreement: false,
  48. tabIndexs: 0,
  49. accounts: {
  50. areaCode: 86,
  51. phone: '',
  52. email: '',
  53. invitationCode: '',
  54. }
  55. };
  56. },
  57. methods: {
  58. // 阅读协议
  59. readAgreementText() {
  60. uni.navigateTo({
  61. url: this.$path.articleDetails + '8'
  62. })
  63. },
  64. setAreaCode(e) {
  65. if (e) {
  66. this.accounts.areaCode = e.area_code;
  67. }
  68. },
  69. reversBackBtn() {
  70. reverseBack()
  71. },
  72. formSubmit(e) {
  73. // tabIndexs: 0,
  74. // accounts: {
  75. // areaCode:86,
  76. // phone: '',
  77. // email: '',
  78. // invitationCode: '',
  79. // }
  80. if (this.tabIndexs === 0 && !this.accounts.phone) {
  81. uni.showToast({
  82. title: '请填写手机号',
  83. icon: "none"
  84. })
  85. return false
  86. }
  87. if (this.tabIndexs === 1 && !this.accounts.email) {
  88. uni.showToast({
  89. title: '请填写邮箱',
  90. icon: "none"
  91. })
  92. return false
  93. }
  94. if (!this.accounts.invitationCode) {
  95. uni.showToast({
  96. title: '请填写邀请码',
  97. icon: "none"
  98. })
  99. return false
  100. }
  101. if (!this.readAgreement) {
  102. uni.showToast({
  103. title: '请先阅读用户协议',
  104. icon: "none"
  105. })
  106. return false
  107. }
  108. this.$nextTick(() => {
  109. this.$refs.sliderVerifyRef.open();
  110. })
  111. },
  112. slideImgSuccess() {
  113. // tabIndexs: 1,
  114. // accounts: {
  115. // phone: '13133111133',
  116. // email:'biking2023@163.com',
  117. // invitationCode: '',
  118. // }
  119. let data = ''
  120. switch (this.tabIndexs) {
  121. case 0:
  122. data =
  123. `type=${this.tabIndexs}&areaCode=${this.accounts.areaCode}&account=${this.accounts.phone}&invitationCode=${this.accounts.invitationCode}`;
  124. break;
  125. case 1:
  126. data =
  127. `type=${this.tabIndexs}&account=${this.accounts.email}&invitationCode=${this.accounts.invitationCode}`;
  128. break;
  129. }
  130. uni.navigateTo({
  131. url: `/pages/login/email-verify?${data}`
  132. })
  133. },
  134. // formReset() {
  135. // }
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. @import "~./common.scss"
  141. </style>