From 92938f7d50a98a07fb99a0aa56384bcd0bca7674 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Sat, 5 Nov 2022 12:47:19 +0800 Subject: [PATCH] fix label issue --- src/views/Dashboard.vue | 37 +++++++++++-------- src/views/Governance.vue | 9 ++++- src/views/GovernanceProposalView.vue | 6 ++- .../governance/ProposalSummaryComponent.vue | 6 ++- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue index 204c3439..5b864562 100644 --- a/src/views/Dashboard.vue +++ b/src/views/Dashboard.vue @@ -133,7 +133,7 @@ @@ -169,22 +169,22 @@ - {{ percent(prop.tally.yes) }}% voted Yes + {{ percent(prop.tally.yes) }}% voters voted Yes - {{ percent(prop.tally.no) }}% voted No + {{ percent(prop.tally.no) }}% voters voted No - {{ percent(prop.tally.veto) }}% voted No With Veto + {{ percent(prop.tally.veto) }}% voters voted No With Veto - {{ percent(prop.tally.abstain) }}% voted Abstain + {{ percent(prop.tally.abstain) }}% voters voted Abstain @@ -515,6 +515,7 @@ export default { selectedProposalId: 0, selectedTitle: '', operationModalType: '', + totalPower: 0, voteColors: { YES: 'success', NO: 'warning', @@ -568,20 +569,21 @@ export default { this.supply = `${formatNumber(formatTokenAmount(pool[1].amount, 2, res.bond_denom, false), true, 2)}` this.bonded = `${formatNumber(formatTokenAmount(pool[0].bondedToken, 2, res.bond_denom, false), true, 2)}` this.ratio = `${percent(pool[0].bondedToken / pool[1].amount)}%` - - this.$http.getGovernanceListByStatus(2).then(gov => { - gov.proposals.forEach(p => { - this.$http.getGovernanceTally(p.id, pool[0].bondedToken).then(update => { - const p2 = p - p2.tally = update - this.proposals.push(p2) - this.proposals.sort((a, b) => a.id - b.id) - }) - }) - }) + this.totalPower = pool[0].bondedToken }) }) + this.$http.getGovernanceListByStatus(2).then(gov => { + gov.proposals.forEach(p => { + this.$http.getGovernanceTally(p.id, 0).then(update => { + const p2 = p + p2.tally = update + this.proposals.push(p2) + this.proposals.sort((a, b) => a.id - b.id) + }) + }) + }) + this.$http.getLatestBlock().then(res => { this.height = res.block.header.height if (timeIn(res.block.header.time, 3, 'm')) { @@ -722,6 +724,9 @@ export default { return value ? value.replace(/(?:\\[rn])+/g, '\n') : '-' }, percent: v => percent(v), + processBarLength(v) { + return percent(v) + }, formatDate: v => dayjs(v).format('YYYY-MM-DD HH:mm:ss'), convert(v) { if (typeof v === 'object') { diff --git a/src/views/Governance.vue b/src/views/Governance.vue index e0b83a96..2b4b4395 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -7,7 +7,10 @@ lg="6" md="12" > - + @@ -64,6 +67,7 @@ export default { max: 1, operationModalType: '', next: '', + totalPower: 0, } }, mounted() { @@ -81,9 +85,10 @@ export default { }, updateTally(res) { this.$http.getStakingPool().then(pool => { + this.totalPower = pool.bondedToken const voting = res.filter(i => i.status === 2) if (voting.length > 0) { - voting.forEach(p => this.$http.getGovernanceTally(p.id, pool.bondedToken).then(update => { + voting.forEach(p => this.$http.getGovernanceTally(p.id, 0).then(update => { this.$set(p, 'tally', update) })) } diff --git a/src/views/GovernanceProposalView.vue b/src/views/GovernanceProposalView.vue index 2ad5ddfa..13acd37b 100644 --- a/src/views/GovernanceProposalView.vue +++ b/src/views/GovernanceProposalView.vue @@ -113,7 +113,7 @@ { if (p.status === 2) { this.$http.getStakingPool().then(pool => { - this.$http.getGovernanceTally(pid, pool.bondedToken).then(t => p.updateTally(t)) + this.totalPower = pool.bondedToken + this.$http.getGovernanceTally(pid, 0).then(t => p.updateTally(t)) }) } this.proposal = p diff --git a/src/views/components/governance/ProposalSummaryComponent.vue b/src/views/components/governance/ProposalSummaryComponent.vue index 4b2e5cb3..529c651c 100644 --- a/src/views/components/governance/ProposalSummaryComponent.vue +++ b/src/views/components/governance/ProposalSummaryComponent.vue @@ -65,7 +65,7 @@ ({}), }, + totalPower: { + type: Number, + default: 0, + }, }, methods: { selectProposal(modal, pid, title) {