From 8aafe3c5f6ae89b4c10c45e70c963842be825d8a Mon Sep 17 00:00:00 2001
From: liangping <18786721@qq.com>
Date: Sun, 6 Nov 2022 17:35:44 +0800
Subject: [PATCH] improve governance
---
.../base/bootstrap-extended/_progress.scss | 25 +++
src/views/Dashboard.vue | 36 +---
src/views/Governance.vue | 5 +
src/views/GovernanceProposalView.vue | 178 +++++++++-------
.../governance/ProposalSummaryComponent.vue | 194 ++++++++++--------
5 files changed, 247 insertions(+), 191 deletions(-)
diff --git a/src/@core/scss/base/bootstrap-extended/_progress.scss b/src/@core/scss/base/bootstrap-extended/_progress.scss
index 3c2956d7..3abd8c31 100644
--- a/src/@core/scss/base/bootstrap-extended/_progress.scss
+++ b/src/@core/scss/base/bootstrap-extended/_progress.scss
@@ -22,3 +22,28 @@
.progress {
border-radius: 3px;
}
+
+
+.scale {
+ width: 100%;
+ height: 3em;
+ position: relative;
+ /* margin: 30px; // */
+}
+.box {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ top: 0;
+ left: 0;
+ padding-top: 0.5em;
+ /* opacity: 0.7; /**/
+ background: transparent;
+}
+.overlay {
+ z-index: 9;
+ width: 2px;
+ border-right-color: green;
+ border-right-width: 2px;
+ border-right-style: dotted;
+}
diff --git a/src/views/Dashboard.vue b/src/views/Dashboard.vue
index 7074d269..14ac7d53 100644
--- a/src/views/Dashboard.vue
+++ b/src/views/Dashboard.vue
@@ -138,6 +138,7 @@
:max="totalPower? 100 * (totalPower/prop.tally.total) :100"
height="2rem"
show-progress
+ class="font-small-1"
>
-
+
diff --git a/src/views/Governance.vue b/src/views/Governance.vue
index 2b4b4395..3333fd8a 100644
--- a/src/views/Governance.vue
+++ b/src/views/Governance.vue
@@ -10,6 +10,7 @@
@@ -68,9 +69,13 @@ export default {
operationModalType: '',
next: '',
totalPower: 0,
+ tallyParam: null,
}
},
mounted() {
+ this.$http.getGovernanceParameterTallying().then(res => {
+ this.tallyParam = res
+ })
this.getList()
},
methods: {
diff --git a/src/views/GovernanceProposalView.vue b/src/views/GovernanceProposalView.vue
index 13acd37b..5f40b234 100644
--- a/src/views/GovernanceProposalView.vue
+++ b/src/views/GovernanceProposalView.vue
@@ -112,83 +112,94 @@
-
-
-
-
-
-
-
- {{ percent(proposal.tally.yes) }}% voted Yes
-
-
- {{ percent(proposal.tally.no) }}% voted No
-
-
- {{ percent(proposal.tally.veto) }}% voted No With Veto
-
-
- {{ percent(proposal.tally.abstain) }}% voted Abstain
-
-
-
-
- {{ formatAddress(data.item.voter) }}
-
-
-
-
-
- Load More Votes
-
-
+
+
+
+
+
+
+
+
+
+
+ {{ percent(proposal.tally.yes) }}% voted Yes
+
+
+ {{ percent(proposal.tally.no) }}% voted No
+
+
+ {{ percent(proposal.tally.veto) }}% voted No With Veto
+
+
+ {{ percent(proposal.tally.abstain) }}% voted Abstain
+
+
+
+
+
+
+
+
+ {{ formatAddress(data.item.voter) }}
+
+
+
+
+
+ Load More Votes
+
+
{
+ this.tallyParam = res
+ })
const pid = this.$route.params.proposalid
if (this.$route.query.from) {
this.from = this.$route.query.from
@@ -392,6 +407,15 @@ export default {
})
},
methods: {
+ scaleWidth(p) {
+ if (this.tallyParam) {
+ if (p.status === 2) {
+ return Number(this.tallyParam.quorum) * Number(this.tallyParam.threshold) * 100
+ }
+ return Number(this.tallyParam.threshold) * 100
+ }
+ return 50
+ },
percent: v => percent(v),
formatDate: v => dayjs(v).format('YYYY-MM-DD HH:mm'),
formatToken: v => tokenFormatter(v, {}),
diff --git a/src/views/components/governance/ProposalSummaryComponent.vue b/src/views/components/governance/ProposalSummaryComponent.vue
index 529c651c..0b568c8d 100644
--- a/src/views/components/governance/ProposalSummaryComponent.vue
+++ b/src/views/components/governance/ProposalSummaryComponent.vue
@@ -63,96 +63,105 @@
-
-
-
-
-
-
-
-
- {{ percent(p.tally.yes) }}% voted Yes
-
-
- {{ percent(p.tally.no) }}% voted No
-
-
- {{ percent(p.tally.veto) }}% voted No With Veto
-
-
- {{ percent(p.tally.abstain) }}% voted Abstain
-
-
-
-
+
+
+
+ {{ percent(p.tally.yes) }}% voted Yes
+
+
+ {{ percent(p.tally.no) }}% voted No
+
+
+ {{ percent(p.tally.veto) }}% voted No With Veto
+
+
+ {{ percent(p.tally.abstain) }}% voted Abstain
+
+
+
+
- {{ $t('btn_detail') }}
+
+ {{ $t('btn_detail') }}
+
+
+
+ {{ $t('btn_deposit') }}
-
-
- {{ $t('btn_deposit') }}
-
-
- {{ $t('btn_vote') }}
-
-
-
+
+ {{ $t('btn_vote') }}
+
+
+