From 537dcdb6ffdc977ec56391c6bad604d6742b36b2 Mon Sep 17 00:00:00 2001
From: MickeyWang <1244134672@qq.com>
Date: Tue, 21 Jan 2020 18:37:58 +0800
Subject: [PATCH] update vote records weight
---
src/renderer/components/Node/Vote/Detail.vue | 2 +-
src/renderer/store/modules/Vote.js | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/renderer/components/Node/Vote/Detail.vue b/src/renderer/components/Node/Vote/Detail.vue
index 68ef9ea..dbd2a2a 100644
--- a/src/renderer/components/Node/Vote/Detail.vue
+++ b/src/renderer/components/Node/Vote/Detail.vue
@@ -23,7 +23,7 @@
v-if="!isVoter">
- {{vote.approves}}
+ {{vote.rejects}}
votes
diff --git a/src/renderer/store/modules/Vote.js b/src/renderer/store/modules/Vote.js
index fc8624b..6c68188 100644
--- a/src/renderer/store/modules/Vote.js
+++ b/src/renderer/store/modules/Vote.js
@@ -379,7 +379,7 @@ const actions = {
return;
},
- async getVotedRecords({ commit, state }, { hash }) {
+ async getVotedRecords({ commit, dispatch, state }, { hash }) {
const net = localStorage.getItem('net');
const client = getRestClient()
const contract = new Crypto.Address(utils.reverseHex(contract_hash[net]))
@@ -397,10 +397,12 @@ const actions = {
isApproval: formatNumber(i[1]) === 1 ? true : false
}
})
+ const voters = await dispatch('getVoters', {hash})
for (let item of records) {
- for (let voter of state.all_voters) {
+ for (let voter of voters) {
if (voter.address === item.address) {
- item.name = voter.name
+ const voter_with_name = state.all_voters.find(item => item.address === voter.address)
+ item.name = voter_with_name ? voter_with_name.name : ''
item.weight = voter.weight
}
}