invite.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <script>
  2. import tools from "@/common/js/tools";
  3. import tokenpocketBnb from "@/common/wallet/tokenpocket-wallet/tokenpocket-bnb";
  4. import {register} from "@/api/member";
  5. export default {
  6. name: "invite-page",
  7. components: {},
  8. data() {
  9. return {
  10. formData: {
  11. address: '',
  12. inviteCode: ''
  13. }
  14. };
  15. },
  16. mounted() {
  17. },
  18. methods: {
  19. async getAccount(){
  20. console.log('---------------------------------',tokenpocketBnb)
  21. tokenpocketBnb.getAccounts().then(async (Address) => {
  22. console.log(Address)
  23. if (Address) {
  24. this.formData.address=Address
  25. this.login()
  26. } else {
  27. // tools.goToError(2)
  28. }
  29. }).catch((e)=>{
  30. console.log(e)
  31. // tools.goToError(2)
  32. })
  33. },
  34. login(){
  35. register(this.formData).then((res) => {
  36. if(res.code===1){
  37. tools.setLoginInfo(res.data)
  38. setTimeout(()=>{
  39. uni.reLaunch({
  40. url: '/pages/index/index'
  41. })
  42. },50)
  43. }else {
  44. uni.reLaunch({
  45. url: 'pages/login/register?address='+Address
  46. })
  47. }
  48. })
  49. }
  50. },
  51. }
  52. </script>
  53. <template>
  54. <view class="flex-common-css box-b align-items-center flex-justify-center">
  55. <view class="fs-14 fc-f mb-10">
  56. 请输入邀请码
  57. </view>
  58. <view class="w-80 mb-50">
  59. <input class="input-b" v-model="formData.inviteCode" placeholder="" placeholder-class="text-align-center fs-14"></input>
  60. </view>
  61. <view class="but-b b-rad-20 text-align-center fc-f fs-14" @click="getAccount">
  62. 确认绑定
  63. </view>
  64. </view>
  65. </template>
  66. <style scoped lang="scss">
  67. .box-b {
  68. background-image: linear-gradient(46deg, #3364d1, #42d6dd);
  69. }
  70. .input-b{
  71. height: 50px;
  72. border: none;
  73. border-radius: 10px;
  74. background: #fff;
  75. text-align: center;
  76. }
  77. .w-80{
  78. width: 80%;
  79. }
  80. .but-b{
  81. background-image: linear-gradient(46deg, #7a8fbf, #59b3b7);
  82. width: 60%;
  83. line-height: 40px;
  84. border: 1px solid #fff;
  85. }
  86. </style>