Update gov module

This commit is contained in:
liangping
2021-12-22 16:55:58 +08:00
parent 4ea72891e5
commit 7d9618653c
5 changed files with 54 additions and 48 deletions
+21 -16
View File
@@ -56,7 +56,7 @@
Start Date
</p>
<h6 class="mb-0">
{{ p.voting_start_time }}
{{ formatDate(p.voting_start_time) }}
</h6>
</div>
<div class="gov">
@@ -64,7 +64,7 @@
End Date
</p>
<h6 class="mb-0">
{{ p.voting_end_time }}
{{ formatDate(p.voting_end_time) }}
</h6>
</div>
<div class="gov">
@@ -72,7 +72,7 @@
Deposit
</p>
<h6 class="mb-0">
{{ p.total_deposit || '-' }}
{{ formatToken(p.total_deposit) || '-' }}
</h6>
</div>
<div class="gov">
@@ -80,7 +80,7 @@
Turnout
</p>
<h6 class="mb-0">
{{ p.tally.turnout }}%
{{ percent(p.tally.turnout) }}%
</h6>
</div>
</div>
@@ -95,51 +95,51 @@
<b-progress-bar
:id="'vote-yes'+p.id"
variant="success"
:value="p.tally.yes"
:value="percent(p.tally.yes)"
show-progress
:label="`${p.tally.yes.toFixed()}%`"
:label="`${percent(p.tally.yes).toFixed()}%`"
/>
<b-progress-bar
:id="'vote-no'+p.id"
variant="warning"
:value="p.tally.no"
:label="`${p.tally.no.toFixed()}%`"
:value="percent(p.tally.no)"
:label="`${percent(p.tally.no).toFixed()}%`"
show-progress
/>
<b-progress-bar
:id="'vote-veto'+p.id"
variant="danger"
:value="p.tally.veto"
:label="`${p.tally.veto.toFixed()}%`"
:value="percent(p.tally.veto)"
:label="`${percent(p.tally.veto).toFixed()}%`"
show-progress
/>
<b-progress-bar
:id="'vote-abstain'+p.id"
variant="info"
:value="p.tally.abstain"
:label="`${p.tally.abstain.toFixed()}%`"
:value="percent(p.tally.abstain)"
:label="`${percent(p.tally.abstain).toFixed()}%`"
show-progress
/>
</b-progress>
<b-tooltip
:target="'vote-yes'+p.id"
>
{{ p.tally.yes }}% voted Yes
{{ percent(p.tally.yes) }}% voted Yes
</b-tooltip>
<b-tooltip
:target="'vote-no'+p.id"
>
{{ p.tally.no }}% voted No
{{ percent(p.tally.no) }}% voted No
</b-tooltip>
<b-tooltip
:target="'vote-veto'+p.id"
>
{{ p.tally.veto }}% voted No With Veta
{{ percent(p.tally.veto) }}% voted No With Veta
</b-tooltip>
<b-tooltip
:target="'vote-abstain'+p.id"
>
{{ p.tally.abstain }}% voted Abstain
{{ percent(p.tally.abstain) }}% voted Abstain
</b-tooltip>
<b-card-footer class="pb-0">
<router-link
@@ -194,6 +194,8 @@ import {
} from 'bootstrap-vue'
import Ripple from 'vue-ripple-directive'
import { Proposal } from '@/libs/data'
import { percent, tokenFormatter } from '@/libs/utils'
import dayjs from 'dayjs'
import OperationVoteComponent from './OperationVoteComponent.vue'
import OperationGovDepositComponent from './OperationGovDepositComponent.vue'
@@ -229,6 +231,9 @@ export default {
this.getList()
},
methods: {
percent: v => percent(v),
formatDate: v => dayjs(v).format('YYYY-MM-DD'),
formatToken: v => tokenFormatter(v, {}),
selectProposal(pid, title) {
this.selectedProposalId = Number(pid)
this.selectedTitle = title
+22 -17
View File
@@ -65,17 +65,17 @@
<b-tr>
<b-td>
{{ $t('proposal_total_deposit') }}
</b-td><b-td>{{ proposal.total_deposit }} </b-td>
</b-td><b-td>{{ formatToken(proposal.total_deposit) }} </b-td>
</b-tr>
<b-tr>
<b-td>
{{ $t('proposal_submit_time') }}
</b-td><b-td>{{ proposal.submit_time }}</b-td>
</b-td><b-td>{{ formatDate(proposal.submit_time) }}</b-td>
</b-tr>
<b-tr>
<b-td>
{{ $t('voting_time') }}
</b-td><b-td>{{ proposal.voting_start_time }} - {{ proposal.voting_end_time }}</b-td>
</b-td><b-td>{{ formatDate(proposal.voting_start_time) }} - {{ formatDate(proposal.voting_end_time) }}</b-td>
</b-tr>
<b-tr>
<b-td>
@@ -134,51 +134,51 @@
<b-progress-bar
:id="'vote-yes'+proposal.id"
variant="success"
:value="proposal.tally.yes"
:label="`${proposal.tally.yes.toFixed()}%`"
:value="percent(proposal.tally.yes)"
:label="`${percent(proposal.tally.yes).toFixed()}%`"
show-progress
/>
<b-progress-bar
:id="'vote-no'+proposal.id"
variant="warning"
:value="proposal.tally.no"
:label="`${proposal.tally.no.toFixed()}%`"
:value="percent(proposal.tally.no)"
:label="`${percent(proposal.tally.no).toFixed()}%`"
show-progress
/>
<b-progress-bar
:id="'vote-veto'+proposal.id"
variant="danger"
:value="proposal.tally.veto"
:label="`${proposal.tally.veto.toFixed()}%`"
:value="percent(proposal.tally.veto)"
:label="`${percent(proposal.tally.veto).toFixed()}%`"
show-progress
/>
<b-progress-bar
:id="'vote-abstain'+proposal.id"
variant="info"
:value="proposal.tally.abstain"
:label="`${proposal.tally.abstain.toFixed()}%`"
:value="percent(proposal.tally.abstain)"
:label="`${percent(proposal.tally.abstain).toFixed()}%`"
show-progress
/>
</b-progress>
<b-tooltip
:target="'vote-yes'+proposal.id"
>
{{ proposal.tally.yes }}% voted Yes
{{ percent(proposal.tally.yes) }}% voted Yes
</b-tooltip>
<b-tooltip
:target="'vote-no'+proposal.id"
>
{{ proposal.tally.no }}% voted No
{{ percent(proposal.tally.no) }}% voted No
</b-tooltip>
<b-tooltip
:target="'vote-veto'+proposal.id"
>
{{ proposal.tally.veto }}% voted No With Veta
{{ percent(proposal.tally.veto) }}% voted No With Veta
</b-tooltip>
<b-tooltip
:target="'vote-abstain'+proposal.id"
>
{{ proposal.tally.abstain }}% voted Abstain
{{ percent(proposal.tally.abstain) }}% voted Abstain
</b-tooltip>
<b-table
v-if="votes.votes && votes.votes.length > 0"
@@ -206,7 +206,7 @@
<b-card no-body>
<b-card-header>
<b-card-title>
Deposits ({{ proposal.total_deposit }})
Deposits ({{ formatToken(proposal.total_deposit) }})
</b-card-title>
</b-card-header>
<b-card-body>
@@ -268,7 +268,9 @@ import {
import FlipCountdown from 'vue2-flip-countdown'
// import fetch from 'node-fetch'
import { getCachedValidators, getStakingValidatorByAccount, tokenFormatter } from '@/libs/utils'
import {
getCachedValidators, getStakingValidatorByAccount, percent, tokenFormatter,
} from '@/libs/utils'
import { Proposal, Proposer } from '@/libs/data'
import dayjs from 'dayjs'
import ObjectFieldComponent from './ObjectFieldComponent.vue'
@@ -392,6 +394,9 @@ export default {
})
},
methods: {
percent: v => percent(v),
formatDate: v => dayjs(v).format('YYYY-MM-DD HH:mm'),
formatToken: v => tokenFormatter(v, {}),
loadVotes() {
if (this.next) {
const pid = this.$route.params.proposalid