From 0e062df351d9b6401930ff0261ff32efe29f4156 Mon Sep 17 00:00:00 2001
From: donne <503124742@qq.com>
Date: Mon, 4 Apr 2022 20:22:59 +0800
Subject: [PATCH] replace all operation modal
---
src/@core/layouts/components/Coffee.vue | 5 ---
src/views/Governance.vue | 12 ------
src/views/GovernanceProposalView.vue | 29 +++++++------
src/views/Staking.vue | 13 +++---
src/views/StakingRewardComponent.vue | 11 ++---
src/views/StakingValidator.vue | 11 +++--
src/views/WalletAccountDetail.vue | 27 ------------
src/views/WalletAccounts.vue | 24 +++++------
src/views/WalletDelegations.vue | 42 +++++++------------
.../OperationModal/TransactionResult.vue | 1 +
.../OperationModal/components/Delegate.vue | 2 +-
src/views/components/OperationModal/index.vue | 6 ++-
12 files changed, 67 insertions(+), 116 deletions(-)
diff --git a/src/@core/layouts/components/Coffee.vue b/src/@core/layouts/components/Coffee.vue
index c03800f5..09835bb9 100644
--- a/src/@core/layouts/components/Coffee.vue
+++ b/src/@core/layouts/components/Coffee.vue
@@ -21,9 +21,6 @@
-
@@ -36,7 +33,6 @@ import Ripple from 'vue-ripple-directive'
import {
addressEnCode, addressDecode,
} from '@/libs/utils'
-import OperationTransferComponent from '@/views/OperationTransferComponent.vue'
export default {
name: 'AppFooter',
@@ -47,7 +43,6 @@ export default {
BFormInput,
BInputGroupPrepend,
BInputGroup,
- OperationTransferComponent,
},
directives: {
Ripple,
diff --git a/src/views/Governance.vue b/src/views/Governance.vue
index cc58556a..945b0c59 100644
--- a/src/views/Governance.vue
+++ b/src/views/Governance.vue
@@ -177,14 +177,6 @@
-
-
{{ $t('btn_vote') }}
@@ -232,30 +233,29 @@
{{ $t('btn_deposit') }}
{{ $t('btn_vote') }}
-
-
@@ -273,9 +273,9 @@ import {
} from '@/libs/utils'
import { Proposal, Proposer } from '@/libs/data'
import dayjs from 'dayjs'
+import OperationModal from '@/views/components/OperationModal/index.vue'
import ObjectFieldComponent from './ObjectFieldComponent.vue'
-import OperationVoteComponent from './OperationVoteComponent.vue'
-import OperationGovDepositComponent from './OperationGovDepositComponent.vue'
+
// import { formatToken } from '@/libs/data/data'
export default {
@@ -295,9 +295,8 @@ export default {
BTooltip,
BBadge,
ObjectFieldComponent,
- OperationVoteComponent,
- OperationGovDepositComponent,
FlipCountdown,
+ OperationModal,
},
data() {
return {
@@ -307,6 +306,7 @@ export default {
proposer: new Proposer(),
deposits: [],
votes: [],
+ operationModalType: '',
votes_fields: [
{
key: 'voter',
@@ -411,6 +411,9 @@ export default {
formatAddress(v) {
return getStakingValidatorByAccount(this.$http.config.chain_name, v)
},
+ openModal(type) {
+ this.operationModalType = type
+ },
},
}
diff --git a/src/views/Staking.vue b/src/views/Staking.vue
index 257b899f..48da7904 100644
--- a/src/views/Staking.vue
+++ b/src/views/Staking.vue
@@ -78,7 +78,7 @@
-
+
@@ -222,9 +225,9 @@ import {
percent, StakingParameters, formatToken,
} from '@/libs/utils'
import { keybase } from '@/libs/fetch'
+import OperationModal from '@/views/components/OperationModal/index.vue'
// import { toHex } from '@cosmjs/encoding'
// import fetch from 'node-fetch'
-import OperationDelegateComponent from './OperationDelegateComponent.vue'
export default {
components: {
@@ -237,9 +240,9 @@ export default {
BCardTitle,
BCardBody,
BButton,
- OperationDelegateComponent,
BFormRadioGroup,
BFormGroup,
+ OperationModal,
},
directives: {
'b-tooltip': VBTooltip,
diff --git a/src/views/StakingRewardComponent.vue b/src/views/StakingRewardComponent.vue
index 0d79d94f..e90bba72 100644
--- a/src/views/StakingRewardComponent.vue
+++ b/src/views/StakingRewardComponent.vue
@@ -6,7 +6,7 @@
Outstanding Rewards
-
@@ -104,7 +101,6 @@ import { sha256 } from '@cosmjs/crypto'
import { toHex } from '@cosmjs/encoding'
import { formatToken, numberWithCommas } from '@/libs/utils'
import OperationModal from '@/views/components/OperationModal/index.vue'
-import OperationWithdrawCommissionComponent from './OperationWithdrawCommissionComponent.vue'
export default {
components: {
@@ -117,7 +113,6 @@ export default {
BMedia,
BMediaAside,
BAvatar,
- OperationWithdrawCommissionComponent,
OperationModal,
},
props: {
diff --git a/src/views/StakingValidator.vue b/src/views/StakingValidator.vue
index db29c7f7..fe08d8c6 100644
--- a/src/views/StakingValidator.vue
+++ b/src/views/StakingValidator.vue
@@ -25,7 +25,7 @@
@@ -268,7 +268,10 @@
-
+
@@ -281,10 +284,10 @@ import {
percent, formatToken, StakingParameters, Validator, operatorAddressToAccount, consensusPubkeyToHexAddress, toDay, abbrMessage, abbrAddress,
} from '@/libs/utils'
import { keybase } from '@/libs/fetch'
+import OperationModal from '@/views/components/OperationModal/index.vue'
import StakingAddressComponent from './StakingAddressComponent.vue'
import StakingCommissionComponent from './StakingCommissionComponent.vue'
import StakingRewardComponent from './StakingRewardComponent.vue'
-import OperationDelegateComponent from './OperationDelegateComponent.vue'
export default {
components: {
@@ -300,7 +303,7 @@ export default {
StakingAddressComponent,
StakingCommissionComponent,
StakingRewardComponent,
- OperationDelegateComponent,
+ OperationModal,
},
directives: {
'b-modal': VBModal,
diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue
index dfef61fc..dd39c2af 100644
--- a/src/views/WalletAccountDetail.vue
+++ b/src/views/WalletAccountDetail.vue
@@ -342,21 +342,6 @@
-
-
-
-
-
-
Transfer
IBC Transfer
@@ -265,10 +265,10 @@
Connect Wallet
-
-
@@ -287,8 +287,7 @@ import {
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
import AppCollapse from '@core/components/app-collapse/AppCollapse.vue'
import AppCollapseItem from '@core/components/app-collapse/AppCollapseItem.vue'
-import OperationTransferComponent from './OperationTransferComponent.vue'
-import OperationTransfer2Component from './OperationTransfer2Component.vue'
+import OperationModal from '@/views/components/OperationModal/index.vue'
import ChartComponentDoughnut from './ChartComponentDoughnut.vue'
import EchartScatter from './components/charts/EchartScatter.vue'
@@ -309,14 +308,13 @@ export default {
// eslint-disable-next-line vue/no-unused-components
VBTooltip,
FeatherIcon,
- OperationTransferComponent,
// eslint-disable-next-line vue/no-unused-components
ToastificationContent,
- OperationTransfer2Component,
ChartComponentDoughnut,
AppCollapse,
AppCollapseItem,
EchartScatter,
+ OperationModal,
},
directives: {
'b-tooltip': VBTooltip,
@@ -335,6 +333,7 @@ export default {
delegations: {},
ibcDenom: {},
quotes: {},
+ operationModalType: '',
options: {
maintainAspectRatio: false,
legend: {
@@ -533,7 +532,8 @@ export default {
this.currency2 = c
this.currency = getUserCurrencySign()
},
- transfer(addr) {
+ transfer(type, addr) {
+ this.operationModalType = type
this.selectedAddress = addr
},
completeAdd() {
diff --git a/src/views/WalletDelegations.vue b/src/views/WalletDelegations.vue
index b2911619..f446ad33 100644
--- a/src/views/WalletDelegations.vue
+++ b/src/views/WalletDelegations.vue
@@ -42,29 +42,29 @@
size="sm"
>
@@ -74,18 +74,10 @@
-
-
-
-
@@ -99,11 +91,7 @@ import {
formatToken, getCachedValidators, getLocalAccounts, getLocalChains, tokenFormatter,
} from '@/libs/utils'
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
-
-import OperationWithdrawComponent from './OperationWithdrawComponent.vue'
-import OperationUnbondComponent from './OperationUnbondComponent.vue'
-import OperationDelegateComponent from './OperationDelegateComponent.vue'
-import OperationRedelegateComponent from './OperationRedelegateComponent.vue'
+import OperationModal from '@/views/components/OperationModal/index.vue'
export default {
components: {
@@ -113,11 +101,7 @@ export default {
BTable,
BCard,
FeatherIcon,
-
- OperationWithdrawComponent,
- OperationDelegateComponent,
- OperationRedelegateComponent,
- OperationUnbondComponent,
+ OperationModal,
},
directives: {
'b-tooltip': VBTooltip,
@@ -153,6 +137,7 @@ export default {
accounts: [],
delegations: [],
rewards: {},
+ operationModalType: '',
}
},
computed: {
@@ -200,7 +185,8 @@ export default {
this.init()
},
methods: {
- selectValue(v) {
+ selectValue(type, v) {
+ this.operationModalType = type
this.address = v.delegator_address
this.selectedValidator = v.validator.validator
return v
diff --git a/src/views/components/OperationModal/TransactionResult.vue b/src/views/components/OperationModal/TransactionResult.vue
index b3499815..31fb8266 100644
--- a/src/views/components/OperationModal/TransactionResult.vue
+++ b/src/views/components/OperationModal/TransactionResult.vue
@@ -137,6 +137,7 @@ export default {
if (res.code === 0) {
this.succeed = true
clearInterval(this.timer)
+ window.location.reload()
} else if (res.code !== 3) { // code 3 is tx unconfirmed(not founded).
this.error = res.raw_log
console.log('error:', this.error)
diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue
index bc4138c2..f806d552 100644
--- a/src/views/components/OperationModal/components/Delegate.vue
+++ b/src/views/components/OperationModal/components/Delegate.vue
@@ -151,7 +151,7 @@ export default {
availableAddress: [],
validators: [],
unbundValidators: [],
- selectedValidator: null,
+ selectedValidator: this.validatorAddress,
token: '',
amount: null,
selectedChain: '',
diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue
index 28805e26..279d860a 100644
--- a/src/views/components/OperationModal/index.vue
+++ b/src/views/components/OperationModal/index.vue
@@ -1,6 +1,6 @@