From d5c0f266661936bcd70652cf56b99ba01c43dded Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Thu, 31 Mar 2022 23:01:58 +0800 Subject: [PATCH] fix --- src/views/Governance.vue | 24 +- src/views/WalletAccountDetail.vue | 15 +- .../OperationModal/components/IBCTransfer.vue | 308 ++++++++++++++++++ .../OperationModal/components/Vote.vue | 194 +++++++++++ .../OperationModal/components/Withdraw.vue | 1 - src/views/components/OperationModal/index.vue | 25 +- 6 files changed, 559 insertions(+), 8 deletions(-) create mode 100644 src/views/components/OperationModal/components/IBCTransfer.vue create mode 100644 src/views/components/OperationModal/components/Vote.vue diff --git a/src/views/Governance.vue b/src/views/Governance.vue index 288a0d2d..7e7d3c25 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -160,7 +160,7 @@ v-b-modal.deposit-window variant="primary" class="btn float-right mg-2" - @click="selectProposal(p.id, p.title)" + @click="selectProposal('GovDeposit',p.id, p.title)" > {{ $t('btn_deposit') }} @@ -169,10 +169,19 @@ v-b-modal.vote-window variant="primary" class="btn float-right mg-2" - @click="selectProposal(p.id, p.title)" + @click="selectProposal('Vote',p.id, p.title)" > {{ $t('btn_vote') }} + + {{ $t('btn_vote') }}1 + @@ -185,6 +194,11 @@ :proposal-id="selectedProposalId" :title="selectedTitle" /> + @@ -196,6 +210,7 @@ import Ripple from 'vue-ripple-directive' import { Proposal } from '@/libs/data' import { percent, tokenFormatter } from '@/libs/utils' import dayjs from 'dayjs' +import OperationModal from '@/views/components/OperationModal/index.vue' import OperationVoteComponent from './OperationVoteComponent.vue' import OperationGovDepositComponent from './OperationGovDepositComponent.vue' @@ -214,6 +229,7 @@ export default { BCol, OperationVoteComponent, OperationGovDepositComponent, + OperationModal, }, directives: { 'b-modal': VBModal, @@ -225,6 +241,7 @@ export default { selectedTitle: '', proposals: [new Proposal()], max: 1, + operationModalType: '', } }, mounted() { @@ -234,7 +251,8 @@ export default { percent: v => percent(v), formatDate: v => dayjs(v).format('YYYY-MM-DD'), formatToken: v => tokenFormatter(v, {}), - selectProposal(pid, title) { + selectProposal(modal, pid, title) { + this.operationModalType = modal this.selectedProposalId = Number(pid) this.selectedTitle = title }, diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index b0ad742f..321f4e24 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -69,8 +69,19 @@ icon="SendIcon" class="d-md-none" /> - IBC Transfer - + IBC Transfer + + + IBC Transfer1 + diff --git a/src/views/components/OperationModal/components/IBCTransfer.vue b/src/views/components/OperationModal/components/IBCTransfer.vue new file mode 100644 index 00000000..2bdbe433 --- /dev/null +++ b/src/views/components/OperationModal/components/IBCTransfer.vue @@ -0,0 +1,308 @@ + + + + diff --git a/src/views/components/OperationModal/components/Vote.vue b/src/views/components/OperationModal/components/Vote.vue new file mode 100644 index 00000000..2f45c0af --- /dev/null +++ b/src/views/components/OperationModal/components/Vote.vue @@ -0,0 +1,194 @@ + + + + + diff --git a/src/views/components/OperationModal/components/Withdraw.vue b/src/views/components/OperationModal/components/Withdraw.vue index 666d3bea..5fd99991 100644 --- a/src/views/components/OperationModal/components/Withdraw.vue +++ b/src/views/components/OperationModal/components/Withdraw.vue @@ -44,7 +44,6 @@ export default { data() { return { account: [], - selectedChain: '', balance: [], delegations: [], feeDenom: '', diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index 22d5ef1c..ef276136 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -4,7 +4,7 @@ centered size="md" :title="modalTitle" - ok-title="Send" + :ok-title="actionName" hide-header-close scrollable :ok-disabled="isOwner" @@ -43,6 +43,8 @@ :address="address" :validator-address="validatorAddress" :balance="balance" + :proposal-id="proposalId" + :proposal-title="proposalTitle" @update="componentUpdate" /> @@ -156,6 +158,8 @@ import Redelegate from './components/Redelegate.vue' import Withdraw from './components/Withdraw.vue' import Unbond from './components/Unbond.vue' import Transfer from './components/Transfer.vue' +import IBCTransfer from './components/IBCTransfer.vue' +import Vote from './components/Vote.vue' export default { name: 'DelegateDialogue', @@ -186,6 +190,8 @@ export default { Withdraw, Unbond, Transfer, + IBCTransfer, + Vote, }, directives: { Ripple, @@ -203,6 +209,14 @@ export default { type: String, default: null, }, + proposalId: { + type: Number, + default: null, + }, + proposalTitle: { + type: String, + default: null, + }, }, data() { return { @@ -225,6 +239,7 @@ export default { gas: '200000', memo: '', blockingMsg: 'No available account found.', + actionName: 'Send', required, password, @@ -247,8 +262,14 @@ export default { isOwner() { const accounts = getLocalAccounts() const selectedWallet = this.$store.state.chains.defaultWallet + if (!this.address) { + const chain = this.$store.state.chains.selected.chain_name + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + this.selectedAddress = accounts[selectedWallet].address.find(x => x.chain === chain) + } + if (accounts && accounts[selectedWallet]) { - if (accounts[selectedWallet].address.findIndex(x => x.addr === this.address) > -1) { + if (accounts[selectedWallet].address.findIndex(x => x.addr === this.selectedAddress) > -1) { return false } }