replace all operation modal

This commit is contained in:
donne 2022-04-04 20:22:59 +08:00
parent f61783e686
commit 0e062df351
12 changed files with 67 additions and 116 deletions

View File

@ -21,9 +21,6 @@
</b-input-group> </b-input-group>
</b-col> </b-col>
</b-row> </b-row>
<operation-transfer-component
:recipient-address.sync="selectedAddress"
/>
</div> </div>
</template> </template>
@ -36,7 +33,6 @@ import Ripple from 'vue-ripple-directive'
import { import {
addressEnCode, addressDecode, addressEnCode, addressDecode,
} from '@/libs/utils' } from '@/libs/utils'
import OperationTransferComponent from '@/views/OperationTransferComponent.vue'
export default { export default {
name: 'AppFooter', name: 'AppFooter',
@ -47,7 +43,6 @@ export default {
BFormInput, BFormInput,
BInputGroupPrepend, BInputGroupPrepend,
BInputGroup, BInputGroup,
OperationTransferComponent,
}, },
directives: { directives: {
Ripple, Ripple,

View File

@ -177,14 +177,6 @@
</b-card> </b-card>
</b-col> </b-col>
</b-row> </b-row>
<operation-vote-component
:proposal-id="selectedProposalId"
:title="selectedTitle"
/>
<operation-gov-deposit-component
:proposal-id="selectedProposalId"
:title="selectedTitle"
/>
<operation-modal <operation-modal
:type="operationModalType" :type="operationModalType"
:proposal-id="selectedProposalId" :proposal-id="selectedProposalId"
@ -202,8 +194,6 @@ import { Proposal } from '@/libs/data'
import { percent, tokenFormatter } from '@/libs/utils' import { percent, tokenFormatter } from '@/libs/utils'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import OperationModal from '@/views/components/OperationModal/index.vue' import OperationModal from '@/views/components/OperationModal/index.vue'
import OperationVoteComponent from './OperationVoteComponent.vue'
import OperationGovDepositComponent from './OperationGovDepositComponent.vue'
export default { export default {
components: { components: {
@ -218,8 +208,6 @@ export default {
BCardBody, BCardBody,
BRow, BRow,
BCol, BCol,
OperationVoteComponent,
OperationGovDepositComponent,
OperationModal, OperationModal,
}, },
directives: { directives: {

View File

@ -109,10 +109,11 @@
</b-button> </b-button>
</router-link> </router-link>
<b-button <b-button
v-b-modal.vote-window v-b-modal.operation-modal
:disabled="proposal.status!=2" :disabled="proposal.status!=2"
variant="primary" variant="primary"
class="btn float-right mg-2" class="btn float-right mg-2"
@click="openModal('Vote')"
> >
{{ $t('btn_vote') }} {{ $t('btn_vote') }}
</b-button> </b-button>
@ -232,30 +233,29 @@
</b-button> </b-button>
</router-link> </router-link>
<b-button <b-button
v-b-modal.deposit-window v-b-modal.operation-modal
:disabled="proposal.status!=1" :disabled="proposal.status!=1"
variant="primary" variant="primary"
class="btn float-right mg-2" class="btn float-right mg-2"
@click="openModal('GovDeposit')"
> >
{{ $t('btn_deposit') }} {{ $t('btn_deposit') }}
</b-button> </b-button>
<b-button <b-button
v-b-modal.vote-window v-b-modal.operation-modal
:disabled="proposal.status!=2" :disabled="proposal.status!=2"
variant="primary" variant="primary"
class="btn float-right mg-2 mr-1" class="btn float-right mg-2 mr-1"
@click="openModal('Vote')"
> >
{{ $t('btn_vote') }} {{ $t('btn_vote') }}
</b-button> </b-button>
</b-card-footer> </b-card-footer>
</b-card> </b-card>
<operation-vote-component <operation-modal
:type="operationModalType"
:proposal-id="Number(proposal.id)" :proposal-id="Number(proposal.id)"
:title="proposal.title" :proposal-title="proposal.title"
/>
<operation-gov-deposit-component
:proposal-id="Number(proposal.id)"
:title="proposal.title"
/> />
</section> </section>
</template> </template>
@ -273,9 +273,9 @@ import {
} from '@/libs/utils' } from '@/libs/utils'
import { Proposal, Proposer } from '@/libs/data' import { Proposal, Proposer } from '@/libs/data'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import OperationModal from '@/views/components/OperationModal/index.vue'
import ObjectFieldComponent from './ObjectFieldComponent.vue' import ObjectFieldComponent from './ObjectFieldComponent.vue'
import OperationVoteComponent from './OperationVoteComponent.vue'
import OperationGovDepositComponent from './OperationGovDepositComponent.vue'
// import { formatToken } from '@/libs/data/data' // import { formatToken } from '@/libs/data/data'
export default { export default {
@ -295,9 +295,8 @@ export default {
BTooltip, BTooltip,
BBadge, BBadge,
ObjectFieldComponent, ObjectFieldComponent,
OperationVoteComponent,
OperationGovDepositComponent,
FlipCountdown, FlipCountdown,
OperationModal,
}, },
data() { data() {
return { return {
@ -307,6 +306,7 @@ export default {
proposer: new Proposer(), proposer: new Proposer(),
deposits: [], deposits: [],
votes: [], votes: [],
operationModalType: '',
votes_fields: [ votes_fields: [
{ {
key: 'voter', key: 'voter',
@ -411,6 +411,9 @@ export default {
formatAddress(v) { formatAddress(v) {
return getStakingValidatorByAccount(this.$http.config.chain_name, v) return getStakingValidatorByAccount(this.$http.config.chain_name, v)
}, },
openModal(type) {
this.operationModalType = type
},
}, },
} }
</script> </script>

View File

@ -78,7 +78,7 @@
</template> </template>
<template #cell(operation)="data"> <template #cell(operation)="data">
<b-button <b-button
v-b-modal.delegate-window v-b-modal.operation-modal
:name="data.item.operator_address" :name="data.item.operator_address"
variant="primary" variant="primary"
size="sm" size="sm"
@ -186,7 +186,7 @@
</template> </template>
<template #cell(operation)="data"> <template #cell(operation)="data">
<b-button <b-button
v-b-modal.delegate-window v-b-modal.operation-modal
:name="data.item.operator_address" :name="data.item.operator_address"
variant="primary" variant="primary"
size="sm" size="sm"
@ -210,7 +210,10 @@
</small> </small>
</template> </template>
</b-card> </b-card>
<operation-delegate-component :validator-address="validator_address" /> <operation-modal
type="Delegate"
:validator-address="validator_address"
/>
</div> </div>
</template> </template>
@ -222,9 +225,9 @@ import {
percent, StakingParameters, formatToken, percent, StakingParameters, formatToken,
} from '@/libs/utils' } from '@/libs/utils'
import { keybase } from '@/libs/fetch' import { keybase } from '@/libs/fetch'
import OperationModal from '@/views/components/OperationModal/index.vue'
// import { toHex } from '@cosmjs/encoding' // import { toHex } from '@cosmjs/encoding'
// import fetch from 'node-fetch' // import fetch from 'node-fetch'
import OperationDelegateComponent from './OperationDelegateComponent.vue'
export default { export default {
components: { components: {
@ -237,9 +240,9 @@ export default {
BCardTitle, BCardTitle,
BCardBody, BCardBody,
BButton, BButton,
OperationDelegateComponent,
BFormRadioGroup, BFormRadioGroup,
BFormGroup, BFormGroup,
OperationModal,
}, },
directives: { directives: {
'b-tooltip': VBTooltip, 'b-tooltip': VBTooltip,

View File

@ -6,7 +6,7 @@
<b-card-header> <b-card-header>
<b-card-title>Outstanding Rewards</b-card-title> <b-card-title>Outstanding Rewards</b-card-title>
<feather-icon <feather-icon
v-b-modal.operation-modal v-b-modal.WithdrawCommission
icon="MoreVerticalIcon" icon="MoreVerticalIcon"
size="18" size="18"
class="cursor-pointer" class="cursor-pointer"
@ -76,7 +76,7 @@
</b-card-body> </b-card-body>
<b-card-body class="pt-0"> <b-card-body class="pt-0">
<b-button <b-button
v-b-modal.operation-modal v-b-modal.WithdrawCommission
block block
size="sm" size="sm"
variant="primary" variant="primary"
@ -84,12 +84,9 @@
Withdraw Commission Withdraw Commission
</b-button> </b-button>
</b-card-body> </b-card-body>
<operation-withdraw-commission-component
:validator-address="validator"
:address="address"
/>
<operation-modal <operation-modal
type="WithdrawCommission" type="WithdrawCommission"
modal-id="WithdrawCommission"
:address="address" :address="address"
:validator-address="validator" :validator-address="validator"
/> />
@ -104,7 +101,6 @@ import { sha256 } from '@cosmjs/crypto'
import { toHex } from '@cosmjs/encoding' import { toHex } from '@cosmjs/encoding'
import { formatToken, numberWithCommas } from '@/libs/utils' import { formatToken, numberWithCommas } from '@/libs/utils'
import OperationModal from '@/views/components/OperationModal/index.vue' import OperationModal from '@/views/components/OperationModal/index.vue'
import OperationWithdrawCommissionComponent from './OperationWithdrawCommissionComponent.vue'
export default { export default {
components: { components: {
@ -117,7 +113,6 @@ export default {
BMedia, BMedia,
BMediaAside, BMediaAside,
BAvatar, BAvatar,
OperationWithdrawCommissionComponent,
OperationModal, OperationModal,
}, },
props: { props: {

View File

@ -25,7 +25,7 @@
</div> </div>
<div class="d-flex flex-wrap"> <div class="d-flex flex-wrap">
<b-button <b-button
v-b-modal.delegate-window v-b-modal.operation-modal
variant="primary" variant="primary"
class="mr-25 mb-25" class="mr-25 mb-25"
> >
@ -268,7 +268,10 @@
</b-col> </b-col>
</b-row> </b-row>
</template> </template>
<operation-delegate-component :validator-address="validator.operator_address" /> <operation-modal
type="Delegate"
:validator-address="validator.operator_address"
/>
</div> </div>
</template> </template>
@ -281,10 +284,10 @@ import {
percent, formatToken, StakingParameters, Validator, operatorAddressToAccount, consensusPubkeyToHexAddress, toDay, abbrMessage, abbrAddress, percent, formatToken, StakingParameters, Validator, operatorAddressToAccount, consensusPubkeyToHexAddress, toDay, abbrMessage, abbrAddress,
} from '@/libs/utils' } from '@/libs/utils'
import { keybase } from '@/libs/fetch' import { keybase } from '@/libs/fetch'
import OperationModal from '@/views/components/OperationModal/index.vue'
import StakingAddressComponent from './StakingAddressComponent.vue' import StakingAddressComponent from './StakingAddressComponent.vue'
import StakingCommissionComponent from './StakingCommissionComponent.vue' import StakingCommissionComponent from './StakingCommissionComponent.vue'
import StakingRewardComponent from './StakingRewardComponent.vue' import StakingRewardComponent from './StakingRewardComponent.vue'
import OperationDelegateComponent from './OperationDelegateComponent.vue'
export default { export default {
components: { components: {
@ -300,7 +303,7 @@ export default {
StakingAddressComponent, StakingAddressComponent,
StakingCommissionComponent, StakingCommissionComponent,
StakingRewardComponent, StakingRewardComponent,
OperationDelegateComponent, OperationModal,
}, },
directives: { directives: {
'b-modal': VBModal, 'b-modal': VBModal,

View File

@ -342,21 +342,6 @@
<vue-qr :text="address" /> <vue-qr :text="address" />
</b-popover> </b-popover>
<operation-transfer-component :address="address" />
<operation-transfer-2-component :address="address" />
<operation-withdraw-component :address="address" />
<operation-unbond-component
:address="address"
:validator-address.sync="selectedValidator"
/>
<operation-delegate-component
:address="address"
:validator-address.sync="selectedValidator"
/>
<operation-redelegate-component
:address="address"
:validator-address.sync="selectedValidator"
/>
<operation-modal <operation-modal
:type="operationModalType" :type="operationModalType"
:address="address" :address="address"
@ -384,12 +369,6 @@ import { sha256 } from '@cosmjs/crypto'
import { toHex } from '@cosmjs/encoding' import { toHex } from '@cosmjs/encoding'
import OperationModal from '@/views/components/OperationModal/index.vue' import OperationModal from '@/views/components/OperationModal/index.vue'
import ObjectFieldComponent from './ObjectFieldComponent.vue' import ObjectFieldComponent from './ObjectFieldComponent.vue'
import OperationTransferComponent from './OperationTransferComponent.vue'
import OperationWithdrawComponent from './OperationWithdrawComponent.vue'
import OperationUnbondComponent from './OperationUnbondComponent.vue'
import OperationDelegateComponent from './OperationDelegateComponent.vue'
import OperationRedelegateComponent from './OperationRedelegateComponent.vue'
import OperationTransfer2Component from './OperationTransfer2Component.vue'
import ChartComponentDoughnut from './ChartComponentDoughnut.vue' import ChartComponentDoughnut from './ChartComponentDoughnut.vue'
export default { export default {
@ -415,12 +394,6 @@ export default {
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
ToastificationContent, ToastificationContent,
ObjectFieldComponent, ObjectFieldComponent,
OperationTransferComponent,
OperationWithdrawComponent,
OperationDelegateComponent,
OperationRedelegateComponent,
OperationUnbondComponent,
OperationTransfer2Component,
ChartComponentDoughnut, ChartComponentDoughnut,
OperationModal, OperationModal,
}, },

View File

@ -153,15 +153,15 @@
/> />
<b-dropdown-item <b-dropdown-item
v-if="balances[acc.addr]" v-if="balances[acc.addr]"
v-b-modal.transfer-window v-b-modal.operation-modal
@click="transfer(acc.addr)" @click="transfer('Transfer',acc.addr)"
> >
<feather-icon icon="SendIcon" /> Transfer <feather-icon icon="SendIcon" /> Transfer
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
v-if="balances[acc.addr]" v-if="balances[acc.addr]"
v-b-modal.ibc-transfer-window v-b-modal.operation-modal
@click="transfer(acc.addr)" @click="transfer('IBCTransfer',acc.addr)"
> >
<feather-icon icon="SendIcon" /> IBC Transfer <feather-icon icon="SendIcon" /> IBC Transfer
</b-dropdown-item> </b-dropdown-item>
@ -265,10 +265,10 @@
Connect Wallet Connect Wallet
</b-card> </b-card>
</router-link> </router-link>
<operation-transfer-component <operation-modal
:address.sync="selectedAddress" :type="operationModalType"
:address="selectedAddress"
/> />
<operation-transfer-2-component :address="selectedAddress" />
</div> </div>
</template> </template>
@ -287,8 +287,7 @@ import {
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
import AppCollapse from '@core/components/app-collapse/AppCollapse.vue' import AppCollapse from '@core/components/app-collapse/AppCollapse.vue'
import AppCollapseItem from '@core/components/app-collapse/AppCollapseItem.vue' import AppCollapseItem from '@core/components/app-collapse/AppCollapseItem.vue'
import OperationTransferComponent from './OperationTransferComponent.vue' import OperationModal from '@/views/components/OperationModal/index.vue'
import OperationTransfer2Component from './OperationTransfer2Component.vue'
import ChartComponentDoughnut from './ChartComponentDoughnut.vue' import ChartComponentDoughnut from './ChartComponentDoughnut.vue'
import EchartScatter from './components/charts/EchartScatter.vue' import EchartScatter from './components/charts/EchartScatter.vue'
@ -309,14 +308,13 @@ export default {
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
VBTooltip, VBTooltip,
FeatherIcon, FeatherIcon,
OperationTransferComponent,
// eslint-disable-next-line vue/no-unused-components // eslint-disable-next-line vue/no-unused-components
ToastificationContent, ToastificationContent,
OperationTransfer2Component,
ChartComponentDoughnut, ChartComponentDoughnut,
AppCollapse, AppCollapse,
AppCollapseItem, AppCollapseItem,
EchartScatter, EchartScatter,
OperationModal,
}, },
directives: { directives: {
'b-tooltip': VBTooltip, 'b-tooltip': VBTooltip,
@ -335,6 +333,7 @@ export default {
delegations: {}, delegations: {},
ibcDenom: {}, ibcDenom: {},
quotes: {}, quotes: {},
operationModalType: '',
options: { options: {
maintainAspectRatio: false, maintainAspectRatio: false,
legend: { legend: {
@ -533,7 +532,8 @@ export default {
this.currency2 = c this.currency2 = c
this.currency = getUserCurrencySign() this.currency = getUserCurrencySign()
}, },
transfer(addr) { transfer(type, addr) {
this.operationModalType = type
this.selectedAddress = addr this.selectedAddress = addr
}, },
completeAdd() { completeAdd() {

View File

@ -42,29 +42,29 @@
size="sm" size="sm"
> >
<b-button <b-button
v-b-modal.delegate-window v-b-modal.operation-modal
v-ripple.400="'rgba(113, 102, 240, 0.15)'" v-ripple.400="'rgba(113, 102, 240, 0.15)'"
v-b-tooltip.hover.top="'Delegate'" v-b-tooltip.hover.top="'Delegate'"
variant="outline-primary" variant="outline-primary"
@click="selectValue(data.item)" @click="selectValue('Delegate',data.item)"
> >
<feather-icon icon="LogInIcon" /> <feather-icon icon="LogInIcon" />
</b-button> </b-button>
<b-button <b-button
v-b-modal.redelegate-window v-b-modal.operation-modal
v-ripple.400="'rgba(113, 102, 240, 0.15)'" v-ripple.400="'rgba(113, 102, 240, 0.15)'"
v-b-tooltip.hover.top="'Redelegate'" v-b-tooltip.hover.top="'Redelegate'"
variant="outline-primary" variant="outline-primary"
@click="selectValue(data.item)" @click="selectValue('Redelegate',data.item)"
> >
<feather-icon icon="ShuffleIcon" /> <feather-icon icon="ShuffleIcon" />
</b-button> </b-button>
<b-button <b-button
v-b-modal.unbond-window v-b-modal.operation-modal
v-ripple.400="'rgba(113, 102, 240, 0.15)'" v-ripple.400="'rgba(113, 102, 240, 0.15)'"
v-b-tooltip.hover.top="'Unbond'" v-b-tooltip.hover.top="'Unbond'"
variant="outline-primary" variant="outline-primary"
@click="selectValue(data.item)" @click="selectValue('Unbond',data.item)"
> >
<feather-icon icon="LogOutIcon" /> <feather-icon icon="LogOutIcon" />
</b-button> </b-button>
@ -74,18 +74,10 @@
</b-card> </b-card>
<!--- not completed---> <!--- not completed--->
<operation-withdraw-component :address="address" /> <operation-modal
<operation-unbond-component :type="operationModalType"
:address="address" :address="address"
:validator-address.sync="selectedValidator" :validator-address="selectedValidator"
/>
<operation-delegate-component
:address="address"
:validator-address.sync="selectedValidator"
/>
<operation-redelegate-component
:address="address"
:validator-address.sync="selectedValidator"
/> />
</div> </div>
</template> </template>
@ -99,11 +91,7 @@ import {
formatToken, getCachedValidators, getLocalAccounts, getLocalChains, tokenFormatter, formatToken, getCachedValidators, getLocalAccounts, getLocalChains, tokenFormatter,
} from '@/libs/utils' } from '@/libs/utils'
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue' import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
import OperationModal from '@/views/components/OperationModal/index.vue'
import OperationWithdrawComponent from './OperationWithdrawComponent.vue'
import OperationUnbondComponent from './OperationUnbondComponent.vue'
import OperationDelegateComponent from './OperationDelegateComponent.vue'
import OperationRedelegateComponent from './OperationRedelegateComponent.vue'
export default { export default {
components: { components: {
@ -113,11 +101,7 @@ export default {
BTable, BTable,
BCard, BCard,
FeatherIcon, FeatherIcon,
OperationModal,
OperationWithdrawComponent,
OperationDelegateComponent,
OperationRedelegateComponent,
OperationUnbondComponent,
}, },
directives: { directives: {
'b-tooltip': VBTooltip, 'b-tooltip': VBTooltip,
@ -153,6 +137,7 @@ export default {
accounts: [], accounts: [],
delegations: [], delegations: [],
rewards: {}, rewards: {},
operationModalType: '',
} }
}, },
computed: { computed: {
@ -200,7 +185,8 @@ export default {
this.init() this.init()
}, },
methods: { methods: {
selectValue(v) { selectValue(type, v) {
this.operationModalType = type
this.address = v.delegator_address this.address = v.delegator_address
this.selectedValidator = v.validator.validator this.selectedValidator = v.validator.validator
return v return v

View File

@ -137,6 +137,7 @@ export default {
if (res.code === 0) { if (res.code === 0) {
this.succeed = true this.succeed = true
clearInterval(this.timer) clearInterval(this.timer)
window.location.reload()
} else if (res.code !== 3) { // code 3 is tx unconfirmed(not founded). } else if (res.code !== 3) { // code 3 is tx unconfirmed(not founded).
this.error = res.raw_log this.error = res.raw_log
console.log('error:', this.error) console.log('error:', this.error)

View File

@ -151,7 +151,7 @@ export default {
availableAddress: [], availableAddress: [],
validators: [], validators: [],
unbundValidators: [], unbundValidators: [],
selectedValidator: null, selectedValidator: this.validatorAddress,
token: '', token: '',
amount: null, amount: null,
selectedChain: '', selectedChain: '',

View File

@ -1,6 +1,6 @@
<template> <template>
<b-modal <b-modal
id="operation-modal" :id="modalId"
centered centered
size="md" size="md"
:title="modalTitle" :title="modalTitle"
@ -216,6 +216,10 @@ export default {
type: String, type: String,
default: '', default: '',
}, },
modalId: {
type: String,
default: 'operation-modal',
},
validatorAddress: { validatorAddress: {
type: String, type: String,
default: null, default: null,