提交 32374a5b 编写于 作者: W wangzhe18

Merge branch 'wz' of http://git.jd.com/jd-blockchain/explorer into develop

因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -129,10 +129,10 @@ export function stringToBase58(value) {
bytes[0] += ALPHABET_MAP[c];
let carry = 0;
for (j = 0; j < bytes.length; ++j) {
bytes[j] += carry;
carry = bytes[j] >> 8;
// 0xff --> 11111111
bytes[j] &= 0xff;
bytes[j] += carry;
carry = bytes[j] >> 8;
// 0xff --> 11111111
bytes[j] &= 0xff;
}
while (carry) {
bytes.push(carry & 0xff);
......@@ -201,7 +201,15 @@ export function Bytes2Str(arr)
return str;
}
export function Int32ToStr(bytes)
{
let value;
for (var i = 0; i < 4; i++) {
value = value | ((bytes[i] & 0xFF) << (8 * (3 - i)));
}
return value;
}
export function consensusProtocolFormat(flag)
{
var str = "";
......
......@@ -6,7 +6,7 @@ import nj from 'nornj';
import { registerTmpl } from 'nornj-react';
import { autobind } from 'core-decorators';
import { Drawer} from 'antd';
import {tranBase58,stringToBase58,byteToLong,byteToString,Bytes2Str} from '../../../utils/util';
import {tranBase58,stringToBase58,byteToLong,byteToString,Bytes2Str,Int32ToStr} from '../../../utils/util';
import { BlockCollapse,BlockCollapseSmall,BlockCollapsePanel } from '../../components/blockCollapse';
import styles from './transactionInfo.m.scss';
import tmpls from './transactionInfo.t.html';
......@@ -25,6 +25,7 @@ export default class TransactionInfo extends Component {
formatData(type,data){
data=data&&data.value&&data.value||'';
let result='';
switch (type.toUpperCase()) {
case 'INT64':
......@@ -43,6 +44,10 @@ export default class TransactionInfo extends Component {
let hex=stringToBase58(data);
result=Bytes2Str(hex);
break;
case 'INT32':
let int32=stringToBase58(data);
result=Int32ToStr(int32);
break;
default:
result=data;
break;
......@@ -50,6 +55,21 @@ export default class TransactionInfo extends Component {
return result;
}
argsToList(data){
let json=[];
if(data&&data.values&&data.values.length>0){
for (let i = 0; i < data.values.length; i++) {
json.push({
type:data.values[i].type,
value:this.formatData(data.values[i].type,data.values[i].value),
});
}
var str = JSON.stringify(json);
return str;
}
}
render() {
const { data,visible} = this.props;
return tmpls.container({
......
......@@ -80,7 +80,7 @@
<table style="line-height:41px;">
<tr>
<td>合约参数:</td>
<td>{{this.args}}</td>
<td>{{argsToList(this.args)}}</td>
</tr>
<tr>
<td>合约地址:</td>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册