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

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

@@ -44,4 +44,16 @@ export default {
thHash: 'Hash',
tableNone: '暂无数据',
},
node: {
tableHeader: '本节点打包的区块列表',
searchHolder: '输入要查询的区块高度或者区块哈希',
thHeight: '区块高度',
thTimestamp: '时间戳',
thType: '区块类型',
thHash: '区块哈希',
tableNone: '暂无数据',
thWinner: '获胜者',
thPacker: '打包区块者',
thRewardPacker: '打包奖励',
},
}

View File

@@ -15,7 +15,7 @@ export default {
},
owner: {
tableHeader: '我的交易',
searchHolder: '请输入该输入的',
searchHolder: '请输入查询内容',
thId: '交易 ID',
thType: '类型',
thSender: '发送者',
@@ -48,9 +48,12 @@ export default {
tableHeader: '本节点打包的区块列表',
searchHolder: '输入要查询的区块高度或者区块哈希',
thHeight: '区块高度',
thTimestamp: '时间戳',
thType: '区块类型',
thHash: '区块哈希',
thTimestamp: '时间戳',
thWinner: '获胜者',
thPacker: '打包区块者',
thRewardPacker: '打包奖励',
tableNone: '暂无数据',
},
}

View File

@@ -1,5 +1,9 @@
import axios from 'axios'
// import app from './app'
// let baseURL = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/api/`
// let baseURL = `${window.location.protocol}//${window.location.hostname}:8888/api/`
let baseURL = `http://test-us.bittic.net:8888/api/`
let socketUrl = 'ws://test-us.bittic.net:8888'
// 控制台应当默认访问控制台所在主机(localhost 或者 window.location.hostname)的 TIC后台或者让用户在控制台启动时自己设置一个节点主机。
axios.defaults.baseURL = `${window.location.protocol}//${window.location.hostname}:${window.location.port}/api/`
axios.defaults.baseURL = baseURL
axios.defaults.socketUrl = socketUrl

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) {}
},
},

View File

@@ -92,8 +92,9 @@ import io from 'socket.io-client'
import axios from 'axios'
const { mapState, mapGetters, mapActions, mapMutations } = createNamespacedHelpers('chain')
const socketUrl = 'ws://test-us.bittic.net:8888'
Vue.use(VueSocketio, io(axios.defaults.baseURL), store)
Vue.use(VueSocketio, io(socketUrl), store)
export default {
name: 'Chain',

View File

@@ -25,7 +25,7 @@
<template>
<v-data-table
:headers="headers"
:items="itemList"
:items="blockList"
:total-items="100"
:rows-per-page-items="pageEntity"
:loading="fetching"
@@ -36,9 +36,12 @@
</template>
<template slot="items" slot-scope="props">
<td>{{ props.item.height }}</td>
<td>{{ props.item.timestamp }}</td>
<td>{{ props.item.type }}</td>
<td>{{ props.item.hash }}</td>
<td>{{ props.item.timestamp }}</td>
<!-- <td>{{ props.item.winnerPubkey }}</td> -->
<td>{{ props.item.packerPubkey }}</td>
<td>{{ props.item.rewardPacker }}</td>
</template>
<template slot="no-results">
{{ $t('node.tableNone') }}
@@ -63,7 +66,7 @@ export default {
computed: {
...mapState([
'headers',
'itemList',
'blockList',
'pageEntity',
'fetching',
'filter',

View File

@@ -2,11 +2,11 @@
<div class="owner-page">
<div class="card-content">
<div class="app-card elevation-1">
<div>主人地址 <br> {{ address }}</div>
<div>主人地址 <br> <span>{{ address }} </span> </div>
</div>
<div class="app-sep"></div>
<div class="app-card elevation-1">
<div>余额 <br> {{ balance }}</div>
<div>余额 <br><span> {{ balance }} </span></div>
</div>
</div>
<div class="table-content elevation-1">
@@ -34,14 +34,14 @@
<span>{{ $t(props.header.text) }}</span>
</template>
<template slot="items" slot-scope="props">
<td>{{ props.item.id }}</td>
<td>{{ props.item.hash }}</td>
<td>{{ props.item.type }}</td>
<td>{{ props.item.sender }}</td>
<td>{{ props.item.receiver }}</td>
<td>{{ props.item.date }}</td>
<td>{{ props.item.actorAddress }}</td>
<td>{{ props.item.toAddress }}</td>
<td>{{ props.item.timestamp }}</td>
<td>{{ props.item.amount }}</td>
<td>{{ props.item.fee }}</td>
<td>{{ props.item.remark }}</td>
<td>{{ props.item.message }}</td>
</template>
<template slot="no-results">
{{ $t('owner.tableNone') }}