补充了一些信息;区块列表最新块出现在最上面

This commit is contained in:
Nova
2019-02-11 00:10:03 +08:00
parent da901b9e79
commit f6f8eecff0
10 changed files with 79 additions and 34 deletions

View File

@@ -43,7 +43,8 @@ export default {
},
addItem(state, block) {
state.itemList.push(block)
let temp = [block]
state.itemList = temp.concat(state.itemList)
},
SOCKET_CONNECT(state, status) {

View File

@@ -42,7 +42,7 @@ export default {
actions: {
async updateNetInfo({ state, commit }) {
let result = await axios.post('Peer/getPeerList', {})
let result = await axios.post('Peer/peerStat', {})
commit('setPeerNumber', (result && result.data) ? result.data.length : 0)

View File

@@ -6,16 +6,22 @@ export default {
pageEntity: [5, 10, 25],
headers: [
{ text: 'node.thHeight', value: 'height', align: 'center' },
{ text: 'node.thTimestamp', value: 'timestamp', align: 'center' },
{ text: 'node.thType', value: 'type', align: 'center' },
{ text: 'node.thHash', value: 'hash', align: 'center' },
{ text: 'node.thTimestamp', value: 'timestamp', align: 'center' },
// { text: 'node.thWinner', value: 'winnerPubkey', align: 'center' },
{ text: 'node.thPacker', value: 'packerPubkey', align: 'center' },
{ text: 'node.thRewardPacker', value: 'rewardPacker', align: 'center' },
],
itemList: [
blockList: [
{
height: 'loading',
timestamp: 'loading',
type: 'loading',
hash: 'loading',
rewardPacker: 'loading',
winnerPubkey: 'loading',
packerPubkey: 'loading',
},
],
fetching: false,
@@ -31,14 +37,22 @@ export default {
setIpAddress(state, ipAddress) {
state.ipAddress = ipAddress
},
setItemList(state, itemList) {
state.itemList = itemList
setBlockList(state, blockList) {
state.blockList = blockList
},
},
actions: {
updateNodeInfo({ state, commit }) {
async updateNodeInfo({ state, commit }) {
let account = sessionStorage.getItem('KEY_ACCOUNT')
commit('setIpAddress', axios.defaults.baseURL)
try {
account = JSON.parse(account)
const myBlocks = await axios.post('Block/getBlockList', {
Block: { packerPubkey: account.pubkey },
})
commit('setBlockList', myBlocks && myBlocks.data ? myBlocks.data : [])
} catch (e) {}
},
},

View File

@@ -16,16 +16,16 @@ export default {
{ text: 'owner.thRemark', value: 'remark', align: 'center' },
],
itemList: [
// {
// id: 'xxxxx',
// type: 'zzz',
// sender: 'xxx',
// receiver: 'dddd',
// date: '333',
// amount: '12',
// fee: 32,
// remark: 'xxxx',
// },
{
id: 'loading',
type: 'loading',
sender: 'loading',
receiver: 'loading',
date: 'loading',
amount: 'loading',
fee: 'loading',
remark: 'loading',
},
],
fetching: false,
filter: '',
@@ -45,6 +45,9 @@ export default {
setAddress(state, address) {
state.address = address
},
setActions(state, actions) {
state.itemList = actions
},
},
actions: {
@@ -53,10 +56,14 @@ export default {
try {
account = JSON.parse(account)
commit('setAddress', account.address)
const result = await axios.post('Account/getBalance', {
const balance = await axios.post('Account/getBalance', {
Account: { address: account.address },
})
commit('setBalance', (result && result.data) ? result.data : 0)
commit('setBalance', (balance && balance.data) ? balance.data : 0)
const actions = await axios.post('Action/getActionList', {
Action: { actorAddress: account.address },
})
commit('setActions', actions && actions.data ? actions.data : [])
} catch (e) {}
},
},