index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="login">
  3. <en-loading></en-loading>
  4. </view>
  5. </template>
  6. <script>
  7. import EnLoading from "../../components/en-utils/en-loading/en-loading";
  8. import bitkeepTron from "../../common/wallet/bitkeep-wallet/bitkeep-tron";
  9. import tools from "../../common/js/tools";
  10. import {member} from "@/api/member";
  11. export default {
  12. components: {
  13. EnLoading
  14. },
  15. data() {
  16. return {
  17. }
  18. },
  19. onLoad(query) {
  20. this.getAccount()
  21. },
  22. mounted() {
  23. },
  24. methods: {
  25. getAccount(){
  26. bitkeepTron.getAccounts().then((Address)=>{
  27. if(Address){
  28. this.login(Address)
  29. }else {
  30. tools.toError('信息获取失败!')
  31. }
  32. }).catch((e)=>{
  33. tools.toError('信息获取失败!')
  34. })
  35. },
  36. login(Address){
  37. member({'address':Address}).then((res)=>{
  38. if(res.code===1){
  39. tools.setLoginInfo(res.data)
  40. setTimeout(()=>{
  41. // uni.reLaunch({
  42. // url: '/pages/index/index'
  43. // })
  44. },50)
  45. }else {
  46. uni.reLaunch({
  47. url: 'pages/login/register?address='+Address
  48. })
  49. }
  50. })
  51. }
  52. },
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. @import url("/static/css/icon-common.css") ;
  57. </style>