This commit is contained in:
chaosBreaking
2019-10-07 19:52:58 +08:00
parent d094299226
commit cc76ad9940
17 changed files with 194 additions and 593 deletions

View File

@@ -7,9 +7,9 @@ export default {
errorMnemonic: '输入的密语无效', errorMnemonic: '输入的密语无效',
}, },
home: { home: {
titleOwner: '账户', titleOwner: '账户信息',
titleNode: '节点', titleNode: '用户操作',
titleNetwork: '网络', titleNetwork: '提现申请',
titleChain: '数据', titleChain: '数据',
titleToken: '通证', titleToken: '通证',
titleMarket: '应用', titleMarket: '应用',

View File

@@ -5,10 +5,8 @@ import store from './store'
import Home from './views/Home' import Home from './views/Home'
import Login from './views/Login' import Login from './views/Login'
import Owner from './views/Owner' import Owner from './views/Owner'
import Chain from './views/Chain'
import Netnode from './views/Netnode' import Netnode from './views/Netnode'
import Network from './views/Network' import Network from './views/Network'
import Market from './views/Market'
Vue.use(Router) Vue.use(Router)

View File

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

View File

@@ -1,67 +0,0 @@
import axios from 'axios'
export default {
namespaced: true,
state: {
pageEntity: [5, 10, 25],
headers: [
{ text: 'chain.thHeight', value: 'height', align: 'center' },
{ text: 'chain.thTimestamp', value: 'timestamp', align: 'center' },
{ text: 'chain.thType', value: 'type', align: 'center', sortable: false },
{ text: 'chain.thHash', value: 'hash', align: 'center' },
],
itemList: [
{
height: 'loading',
timestamp: 'loading',
type: 'loading',
hash: 'loading',
},
],
fetching: false,
filter: '',
modal: false,
isConnected: false,
},
mutations: {
inputFilter(state, filter) {
state.filter = filter
},
showModal(state) {
state.modal = true
},
hideModal(state) {
state.modal = false
},
setItemList(state, blockList) {
state.itemList = blockList
},
addItem(state, block) {
let temp = [block]
state.itemList = temp.concat(state.itemList)
},
SOCKET_CONNECT(state, status) {
state.isConnected = true
},
},
actions: {
async queryBlockList({ state, commit }) {
let result = await axios.post('Block/getBlockList', { config: { order: 'height DESC' } })
commit('setItemList', result.data || [])
},
addNewBlock({ state, commit }, block) {
console.log(block)
commit('addItem', JSON.parse(block))
},
},
getters: {},
}

View File

@@ -1,6 +1,4 @@
export { default as chain } from './chain' export { default as network } from './network'
export { default as market } from './market'
export { default as network } from './network'
export { default as netnode } from './netnode' export { default as netnode } from './netnode'
export { default as owner } from './owner' export { default as owner } from './owner'
export { default as login } from './login' export { default as login } from './login'

View File

@@ -4,32 +4,39 @@ import { i18n } from '../../i18n'
import _ from 'lodash' import _ from 'lodash'
import ticCrypto from 'tic.crypto' import ticCrypto from 'tic.crypto'
import axios from 'axios' import axios from 'axios'
import * as Ticrypto from 'tic.crypto'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
user: '', username: '',
passwd: '', passwd: '',
errorMnemonic: '', erroruser: '',
signing: false, signing: false,
renewing: false, renewing: false,
}, },
getters: { getters: {
inputError: state => !!state.errorMnemonic, inputError: state => !!state.erroruser,
}, },
mutations: { mutations: {
updateMnemonic(state, mnemonic) { updateUserName(state, username) {
if (state.errorMnemonic) { if (state.errorMnemonic) {
state.errorMnemonic = '' state.errorMnemonic = ''
} }
state.mnemonic = mnemonic state.username = username
},
updatePasswd(state, passwd) {
if (state.errorMnemonic) {
state.errorMnemonic = ''
}
state.passwd = passwd
}, },
updateError(state, error) { updateError(state, error) {
state.errorMnemonic = error state.erroruser = error
}, },
updateSign(state, signing) { updateSign(state, signing) {
@@ -39,15 +46,17 @@ export default {
actions: { actions: {
async login({ state, commit }) { async login({ state, commit }) {
console.log(state)
commit('updateSign', true) commit('updateSign', true)
let result = await axios.post('admin/in', { name: 'jojo', passwd: '941411d944c479af9a5e9d29d7430722d90a8e34d9585014e2f2c12b21db143d' }) const passwd = Ticrypto.hash(state.passwd)
let result = await axios.post('admin/in', { name: state.username, passwd })
commit('updateSign', false) commit('updateSign', false)
console.log(result.data) if (result.data.code === 0) {
if (result.code === 0) { commit('updateAccount', result.data.data, { root: true })
commit('updateAccount', 'xxx', { root: true }) commit('updatePasswd', '')
router.push('/home') router.push('/home')
} else { } else {
commit('updateError', '用户名或密码错误') commit('updateError', result.data.msg)
} }
}, },
async createSecword({ state, commit }) { async createSecword({ state, commit }) {

View File

@@ -1,7 +0,0 @@
export default {
namespaced: true,
state: {},
mutations: {},
actions: {},
getters: {},
}

View File

@@ -1,58 +1,104 @@
import axios from 'axios' import axios from 'axios'
import { app } from '../../services'
import { ticApi } from '../../services/api'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
pageEntity: [5, 10, 25], pageEntity: [5, 10, 25],
headers: [ headers: [
{ text: 'netnode.thHeight', value: 'height', align: 'center' }, { text: '类型', value: 'type', align: 'center' },
{ text: 'netnode.thType', value: 'type', align: 'center' }, { text: '用户id', value: '_id', align: 'center' },
{ text: 'netnode.thHash', value: 'hash', align: 'center' }, { text: '资金类型', value: 'tokenType', align: 'center' },
{ text: 'netnode.thTimestamp', value: 'timestamp', align: 'center' }, { text: '金额', value: 'amount', align: 'center' },
// { text: 'netnode.thWinner', value: 'winnerPubkey', align: 'center' }, { text: '创建时间', value: 'createdAt', align: 'center' },
{ text: 'netnode.thPacker', value: 'packerPubkey', align: 'center' },
{ text: 'netnode.thRewardPacker', value: 'rewardPacker', align: 'center' },
], ],
blockList: [ itemList: [
{ {
height: 'loading',
timestamp: 'loading',
type: 'loading', type: 'loading',
hash: 'loading', _id: 'loading',
rewardPacker: 'loading', tokenType: 'loading',
winnerPubkey: 'loading', createdAt: 'loading',
packerPubkey: 'loading', amount: 'loading',
}, },
], ],
fetching: false,
filter: '', userNumSum: 0,
modal: false,
ipAddress: '',
}, },
mutations: { mutations: {
inputFilter(state, filter) { inputFilter(state, filter) {
state.filter = filter state.filter = filter
}, },
setIpAddress(state, ipAddress) {
state.ipAddress = ipAddress setUserNumSum(state, address) {
state.address = address
}, },
setBlockList(state, blockList) {
state.blockList = blockList setUserList(state, actions) {
state.itemList = actions
}, },
}, },
actions: { actions: {
async updateNodeInfo({ state, commit }) { async queryUserInfo({ state, commit }) {
let account = sessionStorage.getItem('KEY_ACCOUNT') const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
commit('setIpAddress', axios.defaults.baseURL) const { userId, type = 0, op } = state
try { const result = await axios.post('admin/actions', { userId, type, op }, { headers: { token } })
account = JSON.parse(account) axios.post('admin/actions', { userId, type, op }, { headers: { token } })
const myBlocks = await axios.post('Block/getBlockList', { const arr = result.data && result.data.data || []
Block: { packerPubkey: account.pubkey }, commit('setUserList', arr)
}) },
commit('setBlockList', myBlocks && myBlocks.data ? myBlocks.data : []) async performTransfer({ state, commit, rootState }) {
} catch (e) {} commit('updateSubmitting', true)
const {
targetAddress,
transferAmount,
transferFee,
// transferRemark,
} = state
let wrongAddress, wrongAmount, wrongFee
if (!(await ticApi.isAddress(targetAddress))) {
wrongAddress = '错误的地址'
} else {
wrongAddress = ''
}
if (!(+transferAmount > 0)) {
wrongAmount = '请输入正确的交易金额'
} else {
wrongAmount = ''
}
if (!(+transferFee > 0)) {
wrongFee = '请输入正确的手续费'
} else {
wrongFee = ''
}
commit('updateWrongAddress', wrongAddress)
commit('updateWrongAmount', wrongAmount)
commit('updateWrongFee', wrongFee)
if (wrongAddress || wrongAmount || wrongFee) {
commit('updateSubmitting', false)
return
}
const res = await ticApi.transferTic({
mnemonic: rootState.account.mnemonic,
to: targetAddress,
amount: +transferAmount,
fee: +transferFee,
})
if (res) {
// success
commit('updateTransferResult', '转账成功')
await app.delay(1000)
commit('toggleTransferDlg', false)
} else {
// fail
commit('updateTransferResult', '转账失败')
}
commit('updateSubmitting', false)
}, },
}, },

View File

@@ -1,4 +1,6 @@
import axios from 'axios' import axios from 'axios'
import { app } from '../../services'
import { ticApi } from '../../services/api'
export default { export default {
namespaced: true, namespaced: true,
@@ -6,43 +8,43 @@ export default {
state: { state: {
pageEntity: [5, 10, 25], pageEntity: [5, 10, 25],
headers: [ headers: [
{ text: 'network.thIndex', value: 'index', align: 'center' }, { text: '类型', value: 'type', align: 'center' },
{ text: 'network.thAccessPoint', value: 'accessPoint', align: 'center' }, { text: '用户id', value: 'userId', align: 'center' },
{ text: 'network.thOwnerAddress', value: 'ownerAddress', align: 'center' }, { text: '状态', value: 'status', align: 'center' },
{ text: 'network.thStatus', value: 'status', align: 'center' }, { text: '目标地址', value: 'amount', align: 'center' },
{ text: '目标地址', value: 'targetAddress', align: 'center' },
{ text: '创建时间', value: 'createdAt', align: 'center' },
], ],
itemList: [ itemList: [
{ {
index: 'loading', type: 'loading',
accessPoint: 'loading', _id: 'loading',
ownerAddress: 'loading', tokenType: 'loading',
status: 'loading', createdAt: 'loading',
amount: 'loading',
}, },
], ],
fetching: false,
filter: '',
nodeNumber: 'unknown',
}, },
mutations: { mutations: {
inputFilter(state, filter) { inputFilter(state, filter) {
state.filter = filter state.filter = filter
}, },
setNodeNumber(state, nodeNumber) {
state.nodeNumber = nodeNumber updateTickets(state, tickets) {
}, state.itemList = tickets
setItemList(state, nodeList) {
state.itemList = nodeList
}, },
}, },
actions: { actions: {
async updateNetInfo({ state, commit }) { async queryTickets({ state, commit }) {
let result = await axios.post('Netnode/nodeStat', {}) const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
const { userId, type = 0, op } = state
commit('setNodeNumber', (result && result.data) ? result.data.length : 0) const result = await axios.post('admin/tickets', { userId, type, op }, { headers: { token } })
axios.post('admin/tickets', { userId, type, op }, { headers: { token } })
commit('setItemList', result.data || []) const arr = result.data && result.data.data || []
console.log(arr)
commit('updateTickets', arr)
}, },
}, },

View File

@@ -8,44 +8,21 @@ export default {
state: { state: {
pageEntity: [5, 10, 25], pageEntity: [5, 10, 25],
headers: [ headers: [
{ text: 'owner.thId', value: 'id', align: 'center' }, { text: '用户id', value: 'id', align: 'center' },
{ text: 'owner.thType', value: 'type', align: 'center' }, { text: '手机号', value: 'phone', align: 'center' },
{ text: 'owner.thSender', value: 'sender', align: 'center' }, { text: '邀请人数', value: 'group', align: 'center' },
{ text: 'owner.thReceiver', value: 'receiver', align: 'center' }, { text: '持有vic', value: 'vic', align: 'center' },
{ text: 'owner.thDate', value: 'date', align: 'center' },
{ text: 'owner.thAmount', value: 'amount', align: 'center' },
{ text: 'owner.thFee', value: 'fee', align: 'center' },
{ text: 'owner.thRemark', value: 'remark', align: 'center' },
], ],
itemList: [ itemList: [
{ {
id: 'loading', id: 'loading',
type: 'loading', phone: 'loading',
sender: 'loading', group: 'loading',
receiver: 'loading', vic: 'loading',
date: 'loading',
amount: 'loading',
fee: 'loading',
remark: 'loading',
}, },
], ],
fetching: false,
filter: '',
balance: 0,
address: '',
transferVisible: false, userNumSum: 0,
submitting: false, // 提交转账
targetAddress: '',
transferAmount: '',
transferFee: '',
transferRemark: '',
wrongAddress: '',
wrongAmount: '',
wrongFee: '',
transferResult: '',
}, },
mutations: { mutations: {
@@ -53,75 +30,24 @@ export default {
state.filter = filter state.filter = filter
}, },
setBalance(state, balance) { setUserNumSum(state, sum) {
state.balance = balance state.userNumSum = sum
}, },
setAddress(state, address) { setUserList(state, actions) {
state.address = address
},
setActions(state, actions) {
state.itemList = actions state.itemList = actions
}, },
toggleTransferDlg(state, value) {
state.transferVisible = value
state.transferResult = ''
},
changeTargetAddress(state, value) {
state.targetAddress = value
},
changeTransferAmount(state, value) {
state.transferAmount = value
},
changeTransferFee(state, value) {
state.transferFee = value
},
changeTransferRemark(state, value) {
state.transferRemark = value
},
updateSubmitting(state, submitting) {
state.submitting = submitting
},
updateWrongAddress(state, msg) {
state.wrongAddress = msg
},
updateWrongAmount(state, msg) {
state.wrongAmount = msg
},
updateWrongFee(state, msg) {
state.wrongFee = msg
},
updateTransferResult(state, msg) {
state.transferResult = msg
},
}, },
actions: { actions: {
async updateOwnerInfo({ state, commit }) { async queryUserInfo({ state, commit }) {
let account = sessionStorage.getItem('KEY_ACCOUNT') const { token } = JSON.parse(sessionStorage.getItem('KEY_ACCOUNT'))
try { const { id, phone } = state
account = JSON.parse(account) const result = await axios.post('admin/users', { id, phone }, { headers: { token } })
commit('setAddress', account.address) const arr = result.data && result.data.data || []
const balance = await axios.post('Account/getBalance', { const sum = result.data && result.data.sum || 0
Account: { address: account.address }, commit('setUserList', arr)
}) commit('setUserNumSum', sum)
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) {}
}, },
async performTransfer({ state, commit, rootState }) { async performTransfer({ state, commit, rootState }) {

View File

@@ -36,16 +36,16 @@ const sideMenus = [
icon: 'public', icon: 'public',
path: '/network', path: '/network',
}, },
{ // {
title: 'home.titleChain', // title: 'home.titleChain',
icon: 'timeline', // icon: 'timeline',
path: '/chain', // path: '/chain',
}, // },
{ // {
title: 'home.titleMarket', // title: 'home.titleMarket',
icon: 'apps', // icon: 'apps',
path: '/market', // path: '/market',
}, // },
] ]
export default { export default {
@@ -58,7 +58,7 @@ export default {
}, },
getters: { getters: {
isLogin: state => state.account.pubkey, isLogin: state => state.account.token,
currentPath: () => router.currentRoute.path, currentPath: () => router.currentRoute.path,
}, },

View File

@@ -1,186 +0,0 @@
<template>
<div class="chain-page">
<div class="card-content">
<div @click="showModal" class="app-card elevation-1"></div>
<div class="app-sep"></div>
<div class="app-card elevation-1"></div>
<div class="app-sep"></div>
<div class="app-card elevation-1"></div>
</div>
<div class="table-content elevation-1">
<div class="panel-header">
<h3>{{ $t('chain.tableHeader') }}</h3>
<div class="search-input">
<v-text-field
:placeholder="$t('chain.searchHolder')"
:value="filter"
@input="inputFilter"
append-icon="search" />
</div>
</div>
<template>
<v-data-table
:headers="headers"
:items="itemList"
:total-items="100"
:rows-per-page-items="pageEntity"
:loading="fetching"
class="panel-content elevation-1"
>
<template slot="headerCell" slot-scope="props">
<span>{{ $t(props.header.text) }}</span>
</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>
</template>
<template slot="no-results">
{{ $t('chain.tableNone') }}
</template>
</v-data-table>
</template>
</div>
<v-dialog v-model="modal" persistent>
<v-card class="app-modal">
<v-card-title>事务列表</v-card-title>
<v-data-table
:headers="headers"
:items="itemList"
:total-items="100"
:rows-per-page-items="pageEntity"
:loading="fetching"
class="panel-content elevation-1"
>
<template slot="headerCell" slot-scope="props">
<span>{{ $t(props.header.text) }}</span>
</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>
</template>
<template slot="no-results">
{{ $t('chain.tableNone') }}
</template>
</v-data-table>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary darken-1" flat @click.native="hideModal">Close</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
import {
createNamespacedHelpers,
} from 'vuex'
import Vue from 'vue'
import store from '../store'
import VueSocketio from 'vue-socket.io'
import io from 'socket.io-client'
// import axios from 'axios'
const { mapState, mapGetters, mapActions, mapMutations } = createNamespacedHelpers('chain')
const socketUrl = `ws://${location.hostname}:60000`
// Vue.use(VueSocketio, io(socketUrl), store)
export default {
name: 'Chain',
computed: {
...mapState([
'headers',
'itemList',
'pageEntity',
'fetching',
'filter',
'modal',
]),
...mapGetters([]),
},
// sockets: {
// connect() {
// console.log('socket connected')
// },
// newBlock(msg) {
// this.addNewBlock(msg)
// },
// },
methods: {
...mapActions([
'queryBlockList',
'addNewBlock',
]),
...mapMutations([
'inputFilter',
'showModal',
'hideModal',
'addItem',
]),
},
mounted() {
// this.queryBlockList()
},
}
</script>
<style scoped lang="scss">
.chain-page {
height: 0;
overflow: auto;
z-index: 1;
.card-content {
display: flex;
padding: 20px;
.app-card {
flex: 1;
height: 100px;
background-color: white;
}
.app-sep {
width: 20px;
}
}
.table-content {
flex: 1;
margin: 0 20px 20px;
background-color: white;
display: flex;
flex-direction: column;
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 20px;
.search-input {
width: 80%;
}
}
.panel-content {
margin: 0 20px 20px;
}
}
}
</style>

View File

@@ -9,11 +9,11 @@
dark autofocus dark autofocus
single-line single-line
:error="inputError" :error="inputError"
:error-messages="errorMnemonic" :error-messages="erroruser"
:value="user" :value="user"
:loading="signing" :loading="signing"
:renewing="renewing" :renewing="renewing"
@input="updateMnemonic" @input="updateUserName"
label="用户名" /> label="用户名" />
<v-text-field <v-text-field
@@ -21,11 +21,12 @@
dark autofocus dark autofocus
single-line single-line
:error="inputError" :error="inputError"
:error-messages="errorMnemonic" :error-messages="erroruser"
:value="passwd" :value="passwd"
:loading="signing" :loading="signing"
:renewing="renewing" :renewing="renewing"
@input="updateMnemonic" @input="updatePasswd"
type='password'
@keyup.13="login" @keyup.13="login"
label="密码" /> label="密码" />
@@ -72,7 +73,7 @@ export default {
...mapState([ ...mapState([
'user', 'user',
'passwd', 'passwd',
'errorMnemonic', 'erroruser',
'signing', 'signing',
'renewing', 'renewing',
]), ]),
@@ -87,7 +88,8 @@ export default {
methods: { methods: {
...mapMutations([ ...mapMutations([
'updateMnemonic', 'updateUserName',
'updatePasswd'
]), ]),
...mapActions([ ...mapActions([
'login', 'login',

View File

@@ -1,16 +0,0 @@
<template>
<div class="market-page">
Market
</div>
</template>
<script>
export default {
name: 'Market',
}
</script>
<style scoped lang="scss">
.market-page {
}
</style>

View File

@@ -1,15 +1,5 @@
<template> <template>
<div class="netnode-page"> <div class="netnode-page">
<div class="card-content">
<div class="app-card elevation-1">
<div>主机地址 <br> {{ ipAddress }}</div>
</div>
<div class="app-sep"></div>
<div class="app-card elevation-1">
<div>在线用户 <br> </div>
</div>
</div>
<div class="table-content elevation-1"> <div class="table-content elevation-1">
<div class="panel-header"> <div class="panel-header">
<h3>{{ $t('netnode.tableHeader') }}</h3> <h3>{{ $t('netnode.tableHeader') }}</h3>
@@ -21,11 +11,10 @@
append-icon="search" /> append-icon="search" />
</div> </div>
</div> </div>
<template> <template>
<v-data-table <v-data-table
:headers="headers" :headers="headers"
:items="blockList" :items="itemList"
:total-items="100" :total-items="100"
:rows-per-page-items="pageEntity" :rows-per-page-items="pageEntity"
:loading="fetching" :loading="fetching"
@@ -35,13 +24,11 @@
<span>{{ $t(props.header.text) }}</span> <span>{{ $t(props.header.text) }}</span>
</template> </template>
<template slot="items" slot-scope="props"> <template slot="items" slot-scope="props">
<td>{{ props.item.height }}</td>
<td>{{ props.item.type }}</td> <td>{{ props.item.type }}</td>
<td>{{ props.item.hash }}</td> <td>{{ props.item._id }}</td>
<td>{{ props.item.timestamp }}</td> <td>{{ props.item.tokenType }}</td>
<!-- <td>{{ props.item.winnerPubkey }}</td> --> <td>{{ props.item.amount }}</td>
<td>{{ props.item.packerPubkey }}</td> <td>{{ props.item.createdAt }}</td>
<td>{{ props.item.rewardPacker }}</td>
</template> </template>
<template slot="no-results"> <template slot="no-results">
{{ $t('netnode.tableNone') }} {{ $t('netnode.tableNone') }}
@@ -66,19 +53,17 @@ export default {
computed: { computed: {
...mapState([ ...mapState([
'headers', 'headers',
'blockList', 'itemList',
'pageEntity', 'pageEntity',
'fetching', 'fetching',
'filter',
'modal',
'ipAddress',
]), ]),
...mapGetters([]), ...mapGetters([]),
}, },
methods: { methods: {
...mapActions([ ...mapActions([
'updateNodeInfo', 'queryUserInfo',
'queryOne',
]), ]),
...mapMutations([ ...mapMutations([
'inputFilter', 'inputFilter',
@@ -87,7 +72,7 @@ export default {
}, },
mounted() { mounted() {
this.updateNodeInfo() this.queryUserInfo()
}, },
} }

View File

@@ -1,15 +1,5 @@
<template> <template>
<div class="network-page"> <div class="network-page">
<div class="card-content">
<div class="app-card elevation-1">
<div>当前邻居节点数 <br>{{ nodeNumber }}</div>
</div>
<div class="app-sep"></div>
<div class="app-card elevation-1">
<div>当前全网节点数 <br>{{ nodeNumber }}</div>
</div>
</div>
<div class="table-content elevation-1"> <div class="table-content elevation-1">
<div class="panel-header"> <div class="panel-header">
<h3>{{ $t('network.tableHeader') }}</h3> <h3>{{ $t('network.tableHeader') }}</h3>
@@ -35,10 +25,12 @@
<span>{{ $t(props.header.text) }}</span> <span>{{ $t(props.header.text) }}</span>
</template> </template>
<template slot="items" slot-scope="props"> <template slot="items" slot-scope="props">
<td>{{ props.item.index }}</td> <td>{{ props.item.type }}</td>
<td>{{ props.item.accessPoint }}</td> <td>{{ props.item.userId }}</td>
<td>{{ props.item.ownerAddress }}</td>
<td>{{ props.item.status }}</td> <td>{{ props.item.status }}</td>
<td>{{ props.item.targetAddress }}</td>
<td>{{ props.item.action.amount }}</td>
<td>{{ props.item.createdAt }}</td>
</template> </template>
<template slot="no-results"> <template slot="no-results">
{{ $t('network.tableNone') }} {{ $t('network.tableNone') }}
@@ -66,15 +58,13 @@ export default {
'pageEntity', 'pageEntity',
'fetching', 'fetching',
'filter', 'filter',
'nodeNumber',
'nodeNumber',
]), ]),
...mapGetters([]), ...mapGetters([]),
}, },
methods: { methods: {
...mapActions([ ...mapActions([
'updateNetInfo', 'queryTickets',
]), ]),
...mapMutations([ ...mapMutations([
'inputFilter', 'inputFilter',
@@ -84,7 +74,7 @@ export default {
}, },
mounted() { mounted() {
this.updateNetInfo() this.queryTickets()
}, },
} }

View File

@@ -1,77 +1,14 @@
<template> <template>
<div class="owner-page"> <div class="owner-page">
<v-dialog
:value="transferVisible"
@input="toggleTransferDlg"
:width="500"
:max-width="600"
persistent
>
<v-card>
<section class='dlg-body'>
<span class="title-decoration dlg-line">我的地址</span>
<span class="address-decoration dlg-line">{{ address }}</span>
<span class="title-decoration dlg-line">接受地址</span>
<v-text-field
autofocus
single-line
:error-messages="wrongAddress"
:value="targetAddress"
@input="changeTargetAddress"
></v-text-field>
<div class="group-line">
<span class="title-decoration title-left">转账金额</span>
<v-text-field
single-line
:error-messages="wrongAmount"
:value="transferAmount"
@input="changeTransferAmount"
></v-text-field>
<span class="title-decoration title-right">TIC</span>
</div>
<div class="group-line">
<span class="title-decoration title-left">手续费</span>
<v-text-field
single-line
:error-messages="wrongFee"
:value="transferFee"
@input="changeTransferFee"
></v-text-field>
<span class="title-decoration title-right">TIC</span>
</div>
<span class="title-decoration dlg-line">备注</span>
<v-text-field
:value="transferRemark"
@input="changeTransferRemark"
></v-text-field>
</section>
<v-card-actions>
<v-spacer></v-spacer>
<span class="result-hint">{{ transferResult }}</span>
<v-btn color="grey darken-1" flat @click="hideTransferDlg">关闭</v-btn>
<v-btn
color="blue darken-1"
flat
@click="performTransfer"
:loading="submitting"
>转账</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<div class="card-content"> <div class="card-content">
<div class="app-card elevation-1"> <div class="app-card elevation-1">
<div class="card-body"> <div class="card-body">
<span>主人地址</span> <span>用户总数</span>
<span>{{ address }}</span> <span>{{ userNumSum }}</span>
</div> </div>
</div> </div>
<div class="app-sep"></div> <div class="app-sep"></div>
<div class="app-card elevation-1"> <!-- <div class="app-card elevation-1">
<div class="card-body"> <div class="card-body">
<span>余额: {{ balance }}</span> <span>余额: {{ balance }}</span>
<v-btn <v-btn
@@ -79,11 +16,11 @@
color="info" color="info"
>转账</v-btn> >转账</v-btn>
</div> </div>
</div> </div> -->
</div> </div>
<div class="table-content elevation-1"> <div class="table-content elevation-1">
<div class="panel-header"> <div class="panel-header">
<h3>{{ $t('owner.tableHeader') }}</h3> <h3>用户列表</h3>
<div class="search-input"> <div class="search-input">
<v-text-field <v-text-field
:placeholder="$t('owner.searchHolder')" :placeholder="$t('owner.searchHolder')"
@@ -106,14 +43,10 @@
<span>{{ $t(props.header.text) }}</span> <span>{{ $t(props.header.text) }}</span>
</template> </template>
<template slot="items" slot-scope="props"> <template slot="items" slot-scope="props">
<td>{{ props.item.hash }}</td> <td>{{ props.item._id }}</td>
<td>{{ props.item.type }}</td> <td>{{ props.item.phone }}</td>
<td>{{ props.item.actorAddress }}</td> <td>{{ props.item.group.length }}</td>
<td>{{ props.item.toAddress }}</td> <td>{{ props.item.vic }}</td>
<td>{{ props.item.timestamp }}</td>
<td>{{ props.item.amount }}</td>
<td>{{ props.item.fee }}</td>
<td>{{ props.item.message }}</td>
</template> </template>
<template slot="no-results"> <template slot="no-results">
{{ $t('owner.tableNone') }} {{ $t('owner.tableNone') }}
@@ -136,31 +69,19 @@ export default {
computed: { computed: {
...mapState([ ...mapState([
'userNumSum',
'headers', 'headers',
'itemList', 'itemList',
'pageEntity', 'pageEntity',
'fetching', 'fetching',
'filter',
'balance',
'address',
'transferVisible',
'targetAddress',
'transferAmount',
'transferFee',
'transferRemark',
'submitting',
'wrongAddress',
'wrongAmount',
'wrongFee',
'transferResult',
]), ]),
...mapGetters([]), ...mapGetters([]),
}, },
methods: { methods: {
...mapActions([ ...mapActions([
'updateOwnerInfo', 'queryUserInfo',
'performTransfer', 'queryOne',
]), ]),
...mapMutations([ ...mapMutations([
'inputFilter', 'inputFilter',
@@ -183,7 +104,7 @@ export default {
}, },
mounted() { mounted() {
this.updateOwnerInfo() this.queryUserInfo()
}, },
} }