提交 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) { ...@@ -129,10 +129,10 @@ export function stringToBase58(value) {
bytes[0] += ALPHABET_MAP[c]; bytes[0] += ALPHABET_MAP[c];
let carry = 0; let carry = 0;
for (j = 0; j < bytes.length; ++j) { for (j = 0; j < bytes.length; ++j) {
bytes[j] += carry; bytes[j] += carry;
carry = bytes[j] >> 8; carry = bytes[j] >> 8;
// 0xff --> 11111111 // 0xff --> 11111111
bytes[j] &= 0xff; bytes[j] &= 0xff;
} }
while (carry) { while (carry) {
bytes.push(carry & 0xff); bytes.push(carry & 0xff);
...@@ -201,7 +201,15 @@ export function Bytes2Str(arr) ...@@ -201,7 +201,15 @@ export function Bytes2Str(arr)
return str; 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) export function consensusProtocolFormat(flag)
{ {
var str = ""; var str = "";
......
...@@ -6,7 +6,7 @@ import nj from 'nornj'; ...@@ -6,7 +6,7 @@ import nj from 'nornj';
import { registerTmpl } from 'nornj-react'; import { registerTmpl } from 'nornj-react';
import { autobind } from 'core-decorators'; import { autobind } from 'core-decorators';
import { Drawer} from 'antd'; 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 { BlockCollapse,BlockCollapseSmall,BlockCollapsePanel } from '../../components/blockCollapse';
import styles from './transactionInfo.m.scss'; import styles from './transactionInfo.m.scss';
import tmpls from './transactionInfo.t.html'; import tmpls from './transactionInfo.t.html';
...@@ -25,6 +25,7 @@ export default class TransactionInfo extends Component { ...@@ -25,6 +25,7 @@ export default class TransactionInfo extends Component {
formatData(type,data){ formatData(type,data){
data=data&&data.value&&data.value||'';
let result=''; let result='';
switch (type.toUpperCase()) { switch (type.toUpperCase()) {
case 'INT64': case 'INT64':
...@@ -43,6 +44,10 @@ export default class TransactionInfo extends Component { ...@@ -43,6 +44,10 @@ export default class TransactionInfo extends Component {
let hex=stringToBase58(data); let hex=stringToBase58(data);
result=Bytes2Str(hex); result=Bytes2Str(hex);
break; break;
case 'INT32':
let int32=stringToBase58(data);
result=Int32ToStr(int32);
break;
default: default:
result=data; result=data;
break; break;
...@@ -50,6 +55,21 @@ export default class TransactionInfo extends Component { ...@@ -50,6 +55,21 @@ export default class TransactionInfo extends Component {
return result; 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() { render() {
const { data,visible} = this.props; const { data,visible} = this.props;
return tmpls.container({ return tmpls.container({
......
...@@ -80,7 +80,7 @@ ...@@ -80,7 +80,7 @@
<table style="line-height:41px;"> <table style="line-height:41px;">
<tr> <tr>
<td>合约参数:</td> <td>合约参数:</td>
<td>{{this.args}}</td> <td>{{argsToList(this.args)}}</td>
</tr> </tr>
<tr> <tr>
<td>合约地址:</td> <td>合约地址:</td>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册