register.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <template>
  2. <view class="register-box">
  3. <view class="register-logo"></view>
  4. <view class="register-from">
  5. <view class="from-input"><input v-model="inviteCode" placeholder="请输入推荐码"></view>
  6. <view class="from-but"><button @click="register">确定</button></view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import {register} from "@/api/member";
  12. import tools from "@/common/js/tools";
  13. export default {
  14. name: "register",
  15. props: {},
  16. components: {},
  17. data() {
  18. return {
  19. address:'',
  20. inviteCode:'',
  21. isAjax:false
  22. }
  23. },
  24. onLoad(query) {
  25. if(query.address!==undefined){
  26. this.address=query.address
  27. }else {
  28. tools.leftClick()
  29. }
  30. },
  31. mounted() {
  32. },
  33. methods: {
  34. register(){
  35. if(this.inviteCode===''){
  36. tools.error('请输入推荐码')
  37. return;
  38. }
  39. if(this.isAjax){
  40. return;
  41. }
  42. this.isAjax=true
  43. register({'inviteCode':this.inviteCode,'address':this.address}).then((res)=>{
  44. if(res.code){
  45. tools.setLoginInfo(res.data)
  46. setTimeout(()=>{
  47. uni.reLaunch({
  48. url: '/pages/index/index'
  49. })
  50. },50)
  51. }else {
  52. tools.error(res.msg)
  53. this.isAjax=false
  54. }
  55. }).catch((e)=>{
  56. this.isAjax=false
  57. })
  58. }
  59. }
  60. }
  61. </script>
  62. <style scoped lang="scss">
  63. .register-box{
  64. width: 100vw;
  65. height: 100vh;
  66. max-height: 100vh;
  67. background-image: url("/static/img/bg/dlbg.jpg");
  68. background-repeat: no-repeat;
  69. background-position: center center;
  70. background-size: cover;
  71. //padding-top: 400rpx;
  72. .register-logo{
  73. height: 300rpx;
  74. }
  75. .register-from{
  76. border-radius: 20rpx;
  77. width:calc(100vw - 214rpx);
  78. margin: auto;
  79. height: 300rpx;
  80. background: #131E30;
  81. padding: 80rpx 64rpx 0 64rpx;
  82. .from-input{
  83. input{
  84. border-radius: 6rpx;
  85. height: 100rpx;
  86. border: 2rpx solid #3e526b;
  87. color: #7388a7;
  88. font-size: 42rpx;
  89. line-height: 100rpx;
  90. text-align: center;
  91. }
  92. input::placeholder{
  93. }
  94. }
  95. .from-but{
  96. margin-top: 40rpx;
  97. button{
  98. height: 82rpx;
  99. line-height: 82rpx;
  100. border: 2rpx solid #146AF0;
  101. border-radius: 6rpx;
  102. background: #146AF0;
  103. color: #FFFFFF;
  104. }
  105. }
  106. }
  107. }
  108. </style>