register.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <view class="register-box">
  3. <view class="register-logo"></view>
  4. <header class="header">
  5. <image class="hd-logo" src="/static/img/icon/logow.png?=1" mode="aspectFill"/>
  6. </header>
  7. <view class="register-from">
  8. <view class="from-input"><input v-model="inviteCode" :placeholder="$t('index.index.affirm')"></view>
  9. <view class="from-but">
  10. <button @click="register">{{$t('index.index.affirm')}}</button>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import {register} from "@/api/member";
  17. import tools from "@/common/js/tools";
  18. export default {
  19. name: "register",
  20. props: {},
  21. components: {},
  22. data() {
  23. return {
  24. address: '',
  25. inviteCode: '',
  26. isAjax: false
  27. }
  28. },
  29. onLoad(query) {
  30. if (query.address !== undefined) {
  31. this.address = query.address
  32. let inviteCode = uni.getStorageSync('inviteCode');
  33. if (inviteCode) {
  34. this.inviteCode = inviteCode
  35. }
  36. } else {
  37. tools.leftClick()
  38. }
  39. },
  40. mounted() {
  41. },
  42. methods: {
  43. register() {
  44. if (this.inviteCode === '') {
  45. tools.error(this.$t('index.error.errorMsg.noInvite'))
  46. return;
  47. }
  48. if (this.isAjax) {
  49. return;
  50. }
  51. this.isAjax = true
  52. register({'inviteCode': this.inviteCode, 'address': this.address}).then((res) => {
  53. if (res.code) {
  54. tools.setLoginInfo(res.data)
  55. setTimeout(() => {
  56. uni.reLaunch({
  57. url: '/pages/index/index'
  58. })
  59. }, 50)
  60. } else {
  61. tools.error(res.msg)
  62. this.isAjax = false
  63. }
  64. }).catch((e) => {
  65. this.isAjax = false
  66. })
  67. }
  68. }
  69. }
  70. </script>
  71. <style scoped lang="scss">
  72. .register-box {
  73. width: 100vw;
  74. height: 100vh;
  75. max-height: 100vh;
  76. background-image: url("/static/img/bg/dlbg.jpg");
  77. background-repeat: no-repeat;
  78. background-position: center center;
  79. background-size: cover;
  80. //padding-top: 400rpx;
  81. .register-logo {
  82. height: 100rpx;
  83. }
  84. .header {
  85. position: fixed;
  86. left: 0;
  87. top: 0;
  88. width: 100%;
  89. height: 54px;
  90. background: #131E30;
  91. z-index: 10;
  92. overflow: hidden;
  93. .hd-logo {
  94. display: block;
  95. max-width: 52%;
  96. height: 34px;
  97. margin: 10px auto;
  98. }
  99. }
  100. .register-from {
  101. border-radius: 20rpx;
  102. width: calc(100vw - 214rpx);
  103. margin: auto;
  104. height: 300rpx;
  105. background: #131E30;
  106. padding: 80rpx 64rpx 0 64rpx;
  107. .from-input {
  108. input {
  109. border-radius: 6rpx;
  110. height: 100rpx;
  111. border: 2rpx solid #3e526b;
  112. color: #7388a7;
  113. font-size: 42rpx;
  114. line-height: 100rpx;
  115. text-align: center;
  116. }
  117. input::placeholder {
  118. }
  119. }
  120. .from-but {
  121. margin-top: 40rpx;
  122. button {
  123. height: 82rpx;
  124. line-height: 82rpx;
  125. border: 2rpx solid #146AF0;
  126. border-radius: 6rpx;
  127. background: #146AF0;
  128. color: #FFFFFF;
  129. }
  130. }
  131. }
  132. }
  133. </style>