Fix issue in upgrade proposal

This commit is contained in:
liangping 2022-08-28 21:22:38 +08:00
parent 8d64e5c2e0
commit 9875281a7d
2 changed files with 5 additions and 9 deletions

View File

@ -24,6 +24,9 @@ export default class Proposal {
this.id = element.proposal_id || element.id this.id = element.proposal_id || element.id
this.status = element.status this.status = element.status
this.type = element.content.type this.type = element.content.type
if (element.content['@type']) {
this.type = element.content['@type']
}
this.tally = new ProposalTally().init(element.final_tally_result, total) this.tally = new ProposalTally().init(element.final_tally_result, total)
this.submit_time = element.submit_time this.submit_time = element.submit_time
this.voting_end_time = element.voting_end_time this.voting_end_time = element.voting_end_time

View File

@ -77,13 +77,6 @@
{{ $t('voting_time') }} {{ $t('voting_time') }}
</b-td><b-td>{{ formatDate(proposal.voting_start_time) }} - {{ formatDate(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-tr>
<b-td>
{{ $t('proposal_type') }}
</b-td><b-td>
{{ proposal.type }}
</b-td>
</b-tr>
</tbody> </tbody>
</b-table-simple> </b-table-simple>
<div> <div>
@ -91,7 +84,7 @@
:tablefield="proposal.contents" :tablefield="proposal.contents"
:small="false" :small="false"
/></div> /></div>
<b-table-simple v-if="proposal.type === 'cosmos-sdk/SoftwareUpgradeProposal'"> <b-table-simple v-if="proposal.type.indexOf('SoftwareUpgrade') > 0">
<b-tr> <b-tr>
<b-td class="text-center"> <b-td class="text-center">
{{ $t('upgrade_time') }} {{ upgradeTime }} {{ $t('upgrade_time') }} {{ upgradeTime }}
@ -356,7 +349,7 @@ export default {
}, },
computed: { computed: {
upgradeTime() { upgradeTime() {
if (this.proposal.type === 'cosmos-sdk/SoftwareUpgradeProposal') { if (this.proposal.type.indexOf('SoftwareUpgrade') > 0) {
if (Number(this.proposal?.contents.plan.height || 0) > 0 && this.latest?.block) { if (Number(this.proposal?.contents.plan.height || 0) > 0 && this.latest?.block) {
const blocks = Number(this.proposal.contents.plan.height) - Number(this.latest.block?.header?.height || 0) const blocks = Number(this.proposal.contents.plan.height) - Number(this.latest.block?.header?.height || 0)
if (blocks > 0) { if (blocks > 0) {