给 Node 页面添加了 本节点打包的区块列表模板。

给 各页面都读入了页头的数据,如IP地址,邻居数量。
This commit is contained in:
luk.lu
2018-11-28 16:38:52 +08:00
parent aca23682ca
commit f70e5bd73d
11 changed files with 241 additions and 55 deletions

View File

@@ -1,4 +1,6 @@
export default {
import axios from 'axios'
export default {
namespaced: true,
state: {
@@ -7,27 +9,45 @@
{ text: 'network.thIndex', value: 'index', align: 'center' },
{ text: 'network.thAddress', value: 'address', align: 'center' },
{ text: 'network.thStatus', value: 'status', align: 'center' },
{ text: 'network.thNeighbour', value: 'neighbour', align: 'center' },
{ text: 'network.thPeerOwnerAddress', value: 'peerOwnerAddress', align: 'center' },
],
desserts: [
{
index: '1',
address: '192.168.0.1',
status: '0',
neighbour: 'ajlk;gaklewklgjqwejj',
},
// {
// index: '',
// address: '',
// status: '',
// peerOwnerAddress: '',
// },
],
fetching: false,
filter: '',
peerNumber: 'unknown',
nodeNumber: ' unknown',
},
mutations: {
inputFilter(state, filter) {
state.filter = filter
},
updatePeerNumber(state, peerNumber) {
state.peerNumber = peerNumber
},
updateNodeNumber(state, nodeNumber) {
state.nodeNumber = nodeNumber
},
updateDesserts(state, peerList) {
state.desserts = peerList
},
},
actions: {},
actions: {
async updateNetInfo({ state, commit }) {
let result = await axios.post('Peer/sharePeer', {})
commit('updatePeerNumber', (result && result.data) ? result.data.length : 0)
commit('updateDesserts', result.data || [])
},
},
getters: {},
}

View File

@@ -1,7 +1,46 @@
export default {
import axios from 'axios'
export default {
namespaced: true,
state: {},
mutations: {},
actions: {},
state: {
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' },
],
desserts: [
{
height: '1',
timestamp: '2011-11-20',
type: '0',
hash: 'null',
},
],
fetching: false,
filter: '',
modal: false,
ipAddress: '',
},
mutations: {
inputFilter(state, filter) {
state.filter = filter
},
updateIpAddress(state, ipAddress) {
state.ipAddress = ipAddress
},
updateDesserts(state, desserts) {
state.desserts = desserts
},
},
actions: {
updateNodeInfo({ state, commit }) {
commit('updateIpAddress', axios.defaults.baseURL)
},
},
getters: {},
}

View File

@@ -29,7 +29,7 @@ export default {
],
fetching: false,
filter: '',
balance: 0,
balance: '',
address: '',
},
@@ -44,11 +44,11 @@ export default {
updateAddress(state, address) {
state.address = address
}
},
},
actions: {
async queryAccount({ state, commit }) {
async updateOwnerInfo({ state, commit }) {
let account = sessionStorage.getItem('KEY_ACCOUNT')
try {
account = JSON.parse(account)
@@ -56,7 +56,7 @@ export default {
const result = await axios.post('Account/getBalance', {
Account: { address: account.address },
})
commit('updateBalance', result.data || 0)
commit('updateBalance', (result && result.data) ? result.data : 0)
} catch (e) {}
},
},