提交 dc0d2097 编写于 作者: J jinlong12

数据账户页面代码提交

上级 85dd18a9
......@@ -49,6 +49,7 @@ const contract = require('./routes/contract');
app.use('/contract', contract);
const ledgers = require('./routes/ledgers');
app.use('/ledgers', ledgers);
app.use('/keys', ledgers);
app.use('/blockHeight', overview);
app.use('/transactionAccount', overview);
app.use('/userTotal', overview);
......
......@@ -87,29 +87,104 @@ router.get('', function(req, res) {
});
Object.assign({
"success": true,
"data": [
{
"value": "67nubBh1nBtv9otJTkWw89WXSq7XnxshL74u33f5ipNYS"
},
{
"value": "67nubBh1nBtv9otJTkWw89WXSq7XnxshL74u33f5ipNYS"
}
]
"data": {
"address": "www.jd.com",
"pubKey": {
"value": "UUi8Ku8aypHYnNkJRuFnkEYSuXT"
}
},
"success": true
});
res.send({
"success": true,
"data": [
{
"value": "67nubBh1nBtv9otJTkWw89WXSq7XnxshL74u33f5ipNYS"
},
{
"value": "67nubBh1nBtv9otJTkWw89WXSq7XnxshL74u33f5ipNYS"
}
]
"data": {
"address": "www.jd.com",
"pubKey": {
"value": "UUi8Ku8aypHYnNkJRuFnkEYSuXT"
}
},
"success": true
});
});
// 获取数据账户中某些Key的结果
router.post('/keys', function(req, res) {
res.type('json');
let params = req.body,
ret = {};
const datas = _.times(100, function(i) {
let num = i + 1;
return {
test1: num + 100000,
test2: '测试' + num,
test4: _.random(10, 90) + '%',
test5: _.random(10, 90) + '%',
test6: _.random(10, 90) + '%',
test8: _.random(1, 10),
test9: _.random(1, 10),
test10: _.random(1, 10),
test11: _.random(1, 10),
test12: _.random(1, 10),
test14: _.random(10, 90) + '%',
test15: _.random(10, 90) + '%',
test16: _.random(1, 24),
test17: _.random(10, 90) + '%',
test18: _.random(1, 100000)
};
});
const pageIndex = params.currentPage,
pageSize = params.pageSize,
start = (pageIndex - 1) * pageSize,
end = pageIndex * pageSize,
data = datas.filter((obj, i) => {
if (i >= start && i < end) {
return true;
}
});
Object.assign({
"data": [
{
"value": "value1",
"nil": false,
"key": "key1",
"type": "TEXT",
"version": 1
},
{
"value": "value2",
"nil": false,
"key": "key2",
"type": "TEXT",
"version": 2
}
],
"success": true
});
res.send({
"data": [
{
"value": "value1",
"nil": false,
"key": "key1",
"type": "TEXT",
"version": 1
},
{
"value": "value2",
"nil": false,
"key": "key2",
"type": "TEXT",
"version": 2
}
],
"success": true
});
});
// 区块高度
router.get('/blockHeight', function(req, res) {
res.type('json');
......@@ -1655,63 +1730,65 @@ router.get('/transactionHash', function(req, res) {
},
"transactionContent": {
"hash": {
"value": "fH9d8BYxU"
},
"value": "fH9d8BYxU"
},
"ledgerHash": {
"value": "6EqXXS9c1njm6XPorwgstGLd1rdAywbQKrTfoaxe4SYY9"
},
"operations": [
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
"accountAddress": "31xnWp5RYLThS47S6yfwqbUW3toZrw5Mm3t",
"writeSet": [{
"expectedVersion": 25,
"key": "Name",
"value": "QUFB"
}]
}, {
"addressSignature": {
"digest": {
"algorithm": "ED25519",
"rawDigest": "d2FuZ3d1"
},
"pubKey": {
"value": "6gtyw9HjZbi"
}
],
"accountAddress": "31xnWp5RYLThS47S6yfwqbUW3toZrw5Mm3t"
},
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
}
],
"accountAddress": "undefined"
},
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
}
],
"accountAddress": "undefined"
},
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
}
],
"accountAddress": "undefined"
},
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
},
"chainCode": "emhhbmdzYW4=",
"contractID": {
"address": "31kiRWCxNm8tYxhFK5wnDp3wNxLCuiVyDA7",
"pubKey": {
"value": "KXywstVY1tEAgEsc7kox48L"
}
}
}, {
"args": "YXJncw==",
"contractAddress": "contract-address",
"event": "contract-event"
}, {
"accountID": {
"address": "31r5f9D8kCxkiat2GvRJfjNi1fnFvaWaBEu",
"pubKey": {
"value": "5CYw7ztKJRxVt6Mfgz6vSQ"
}
},
"addressSignature": {
"digest": {
"algorithm": "ED25519",
"rawDigest": "emhhb2xpdQ=="
},
"pubKey": {
"value": "6gtyw9HjZbi"
}
],
"accountAddress": "undefined"
}
}, {
"userID": {
"address": "321ZeecJ99N7RJGSHkRqkfBZDEAxRMHd6d5",
"pubKey": {
"value": "3qHAWiGwaF6FU2o7Lg"
}
}
}
],
"ledgerHash": {
"value": "6EqXXS9c1njm6XPorwgstGLd1rdAywbQKrTfoaxe4SYY9"
}
]
},
"endpointSignatures": [
{
......@@ -1774,63 +1851,65 @@ router.get('/transactionHash', function(req, res) {
},
"transactionContent": {
"hash": {
"value": "fH9d8BYxU"
},
"value": "fH9d8BYxU"
},
"ledgerHash": {
"value": "6EqXXS9c1njm6XPorwgstGLd1rdAywbQKrTfoaxe4SYY9"
},
"operations": [
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
"accountAddress": "31xnWp5RYLThS47S6yfwqbUW3toZrw5Mm3t",
"writeSet": [{
"expectedVersion": 25,
"key": "Name",
"value": "QUFB"
}]
}, {
"addressSignature": {
"digest": {
"algorithm": "ED25519",
"rawDigest": "d2FuZ3d1"
},
"pubKey": {
"value": "6gtyw9HjZbi"
}
],
"accountAddress": "31xnWp5RYLThS47S6yfwqbUW3toZrw5Mm3t"
},
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
}
],
"accountAddress": "undefined"
},
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
}
],
"accountAddress": "undefined"
},
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
}
],
"accountAddress": "undefined"
},
{
"writeSet": [
{
"key": "Name",
"expectedVersion": 25,
"value": "QUFB"
},
"chainCode": "emhhbmdzYW4=",
"contractID": {
"address": "31kiRWCxNm8tYxhFK5wnDp3wNxLCuiVyDA7",
"pubKey": {
"value": "KXywstVY1tEAgEsc7kox48L"
}
}
}, {
"args": "YXJncw==",
"contractAddress": "contract-address",
"event": "contract-event"
}, {
"accountID": {
"address": "31r5f9D8kCxkiat2GvRJfjNi1fnFvaWaBEu",
"pubKey": {
"value": "5CYw7ztKJRxVt6Mfgz6vSQ"
}
},
"addressSignature": {
"digest": {
"algorithm": "ED25519",
"rawDigest": "emhhb2xpdQ=="
},
"pubKey": {
"value": "6gtyw9HjZbi"
}
],
"accountAddress": "undefined"
}
}, {
"userID": {
"address": "321ZeecJ99N7RJGSHkRqkfBZDEAxRMHd6d5",
"pubKey": {
"value": "3qHAWiGwaF6FU2o7Lg"
}
}
}
],
"ledgerHash": {
"value": "6EqXXS9c1njm6XPorwgstGLd1rdAywbQKrTfoaxe4SYY9"
}
]
},
"endpointSignatures": [
{
......
......@@ -429,26 +429,18 @@
<div><span>预期版本 :</span>&nbsp;&nbsp;&nbsp;v2</div>
</div>
</div>
<div class="{styles.kv}">
<!-- <div class="{styles.kv}">
<div class="{styles.key}">
键 :&nbsp;&nbsp;&nbsp;UPcaZ1JRCehRwvuNS8Ty
<div class="{styles.arrow} {styles.arrowBottom}"></div>
</div>
<!-- <div class="{styles.value}">
<div><span>值 :</span>&nbsp;&nbsp;&nbsp;xUPcaZ1JRCehR</div>
<div><span>预期版本 :</span>&nbsp;&nbsp;&nbsp;v2</div>
</div> -->
</div>
<div class="{styles.kv}">
<div class="{styles.key}">
键 :&nbsp;&nbsp;&nbsp;UPcaZ1JRCehRwvuNS8Ty
<div class="{styles.arrow} {styles.arrowBottom}"></div>
</div>
<!-- <div class="{styles.value}">
<div><span>值 :</span>&nbsp;&nbsp;&nbsp;xUPcaZ1JRCehR</div>
<div><span>预期版本 :</span>&nbsp;&nbsp;&nbsp;v2</div>
</div> -->
</div>
</div> -->
</div>
<div class="{styles.optionTitle}">
......
......@@ -6,16 +6,20 @@ import '../../common/containerConfig';
import 'flarej/lib/components/antd/button';
import 'flarej/lib/components/antd/breadcrumb';
import 'flarej/lib/components/antd/table';
import 'flarej/lib/components/antd/input';
import 'flarej/lib/components/antd/select';
import { Message } from 'flarej/lib/components/antd/message';
import { Select } from 'flarej/lib/components/antd/select';
import { autobind } from 'core-decorators';
import '../../components/header';
import '../../components/sider';
import ContainerHoc from '../../components/higherOrders/container';
import styles from './ledgers.m.less';
import tmpls from './ledgers.t.html';
import { observable } from 'mobx';
import { observable, toJS } from 'mobx';
import LedgersStore from '../../stores/LedgersStore';
const ledgersStore = new LedgersStore();
const Option = Select.Option;
//页面容器组件
@inject('store')
......@@ -28,7 +32,6 @@ class Container extends Component {
render() {
const { store } = this.props;
store.test();
return this.props.tmpls[0](this, {
store,
styles
......@@ -42,11 +45,17 @@ ContainerHoc('Container', Container, ledgersStore);
@observer
class DataTable extends Component {
@observable dataLedger = ''; // 合约账户
@observable keys = []; // key数组
inputChange = (e) => {
this.dataLedger = e.target.value;
}
keyChange = (e) => {
let str = e.target.value;
this.keys = str.split(',');
}
query = () => {
const { store } = this.props;
Promise.all([
......@@ -58,8 +67,29 @@ class DataTable extends Component {
});
}
queryKey = () => {
const { store } = this.props;
Promise.all([
store.getKeyData(this.keys)
]).then(
).catch((err) => {
console.log(err);
});
}
// 待确认
selectItem = () => (
<Select defaultValue = "1">
<Option value = "1">原始内容</Option>
<Option value = "2">转码内容</Option>
</Select>
)
render() {
const { store } = this.props;
return tmpls.dataTable(this.state, this.props, this, {
store,
styles
});
}
......
......@@ -48,7 +48,7 @@
box-shadow: 0 0 4px 0 rgba(0,0,0,0.10);
border-radius: 6px;
padding: 30px;
height: 672px;
min-height: 672px;
& .dataTitle {
font-family: MicrosoftYaHei;
font-size: 14px;
......@@ -84,6 +84,72 @@
width: 90%;
}
}
& .keyContent {
padding: 0 30px;
& .queryLedger {
text-align: center;
padding-top: 40px;
font-family: MicrosoftYaHei;
font-size: 14px;
color: #666666;
& span {
font-weight: bold;
color: #151515;
}
}
& .inputQuery {
margin-bottom: 30px;
& .inputValue {
max-width: 718px;
width: 100%;
height: 36px;
line-height: 36px;
padding-left: 18px;
background: #FFFFFF;
border: 1px solid #CCCCCC;
border-radius: 4px;
color: #C8C8C7;
}
& .queryButton {
background: #5A77D3;
border-radius: 4px;
height: 36px;
margin-left: 40px;
color: #FFFFFF;
}
}
& .keyStates {
& .keyState {
& .key {
background: #ADC6FF;
border-radius: 4px;
height: 50px;
line-height: 50px;
color: #FFFFFF;
padding-left: 20px;
}
& .values {
padding: 0 20px;
& p {
padding: 4px 0;
font-family: MicrosoftYaHei;
font-size: 14px;
color: #92918D;
& span {
font-weight: bold;
font-size: 14px;
color: #67635D;
}
}
& .keyText {
min-height: 36px;
height: 36px;
margin-bottom: 14px;
}
}
}
}
}
}
}
}
......
......@@ -14,29 +14,55 @@
<!-- 列表区域 -->
<div class="{styles.dataList}">
<p class="{styles.dataTitle}">数据信息</p>
<div class="{styles.dataTable}">
<table>
<tbody>
<tr>
<td>地址&nbsp;:</td>
<td>{store.dataData.address || ''}</td>
</tr>
<tr>
<td>合约版本&nbsp;:</td>
<td>{store.dataData.chaincodeVersion || ''}</td>
</tr>
<tr>
<td>公钥内容&nbsp;:</td>
<td>{store.dataData.pubKey.value || ''}</td>
</tr>
<tr>
<td>公钥算法&nbsp;:</td>
<td>{store.dataData.pubKey.algorithm || ''}</td>
</tr>
</tbody>
</table>
</div>
<#if {{store.showLdegerList == 1}}>
<div class="{styles.dataTable}">
<table>
<tbody>
<tr>
<td>地址&nbsp;:</td>
<td>{store.ledgerData.address || ''}</td>
</tr>
<tr>
<td>公钥内容&nbsp;:</td>
<td>{store.ledgerData.pubKey.value || ''}</td>
</tr>
<tr>
<td>公钥算法&nbsp;:</td>
<td>{store.algorithm || ''}</td>
</tr>
</tbody>
</table>
<div class="{styles.keyContent}">
<#if {{store.showKeyList == 1}}>
<p class="{styles.queryLedger}">
在账户&nbsp;<span>ESJKL1342j123NV</span>&nbsp;中查询
</p>
<div class="{styles.inputQuery}">
<ant-input class="{styles.inputValue}" onChange={keyChange} placeholder="请输入键,多个键之间用英文“,”隔开" />
<ant-Button class="{styles.queryButton}" icon="search" onClick={queryKey}>查询</ant-Button>
</div>
<div class="{styles.keyStates}">
<#each {{store.keyData}}>
<div class="{styles.keyState}">
<p class="{styles.key}">&nbsp;:&nbsp;<span>{{key}}</span></p>
<div class="{styles.values}">
<p>版本号&nbsp;:&nbsp;{{version}}</p>
<p>&nbsp;:&nbsp;</p>
<ant-TextArea class="{styles.keyText}" value={{value}}/>
<#if {{@item.value != ''}}>
<p>查看方式&nbsp;:&nbsp;
{selectItem()}
</p>
</#if>
</div>
</div>
</#each>
</div>
</#if>
</div>
</div>
</#if>
</div>
</div>
......
......@@ -5,22 +5,12 @@ import { Notification } from 'flarej/lib/components/antd/notification';
import { tranBase58 } from '../common/util';
export default class LedgersStore {
@observable ledgerData = [
{
'key': 'key1',
'nil': false,
'type': 'TEXT',
'value': 'value1',
'version': 1
},
{
'key': 'key2',
'nil': false,
'type': 'TEXT',
'value': 'value2',
'version': 2
}
]
@observable showLdegerList = 1; // 1----->正常页面 0----->请求出错页面 -1----->异常页面
@observable showKeyList = 0; // 0----->隐藏页面 1----->显示页面
@observable showKeys = 0;
@observable ledgerData = {};
@observable algorithm = ''; // 公钥算法
@observable keyData = [];
@autobind
@action
......@@ -35,6 +25,27 @@ export default class LedgersStore {
}
setLedgerData = (result) => {
console.log(result);
let response = result && result.data ? result.data : {};
this.showKeyList = 1;
this.ledgerData = {...response};
this.algorithm = tranBase58(this.ledgerData['pubKey']['value']);
}
@autobind
@action
getKeyData(e) {
console.log(e);
fetchData(`${G_WEB_DOMAIN}/ledgers/keys`,
this.setKeyData,
'', { method: 'post',}, {e}
).catch(error => {
console.log(error);
});
}
setKeyData = (result) => {
let response = result && result.data ? result.data : [];
console.log(result, response);
this.keyData = {...response};
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册