feat: 查看钱包优化,地址增加链上查询
This commit is contained in:
@@ -22,7 +22,25 @@
|
||||
.addr-chain-unknown, .addr-chain-unkno { background: #909399; }
|
||||
.addr-monitor-on { color: #16b777; font-weight: 600; }
|
||||
.addr-monitor-off { color: #ff5722; font-weight: 600; }
|
||||
.addr-cell { word-break: break-all; font-family: Menlo, Monaco, Consolas, monospace; font-size: 12px; }
|
||||
.addr-cell { font-family: Menlo, Monaco, Consolas, monospace; font-size: 12px; }
|
||||
.addr-cell-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
}
|
||||
.addr-cell-row .addr-text {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.addr-cell-row .addr-explorer {
|
||||
flex: 0 0 auto;
|
||||
font-family: inherit;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
<div class="layui-card">
|
||||
<form class="layui-form layui-card-header layuiadmin-card-header-auto" lay-filter="LAY-addr-search">
|
||||
@@ -145,6 +163,39 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
return '<span class="' + cls + '">' + raw + '</span>';
|
||||
}
|
||||
|
||||
function explorerUrl(chain, address) {
|
||||
var addr = String(address || '').trim();
|
||||
if (!addr) return '';
|
||||
var c = String(chain || '').trim().toUpperCase();
|
||||
if (c === 'TRON' || c === 'TRX') return 'https://tronscan.org/#/address/' + encodeURIComponent(addr);
|
||||
if (c === 'ETH' || c === 'ETHEREUM' || c === 'EVM') return 'https://etherscan.io/address/' + encodeURIComponent(addr);
|
||||
if (c === 'BSC' || c === 'BNB' || c === 'BINANCE') return 'https://bscscan.com/address/' + encodeURIComponent(addr);
|
||||
if (c === 'BTC' || c === 'BITCOIN') return 'https://mempool.space/address/' + encodeURIComponent(addr);
|
||||
if (c === 'SOL' || c === 'SOLANA') return 'https://solscan.io/account/' + encodeURIComponent(addr);
|
||||
return '';
|
||||
}
|
||||
|
||||
function escHtml(s) {
|
||||
return String(s == null ? '' : s)
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"');
|
||||
}
|
||||
|
||||
function addressCellHtml(d) {
|
||||
var addr = d.address || '';
|
||||
var url = explorerUrl(d.chain_type, addr);
|
||||
var html = '<div class="addr-cell addr-cell-row">';
|
||||
html += '<span class="addr-text" title="' + escHtml(addr) + '">' + escHtml(addr) + '</span>';
|
||||
if (url) {
|
||||
html += '<a class="layui-btn layui-btn-primary layui-btn-xs addr-explorer" href="' + escHtml(url) +
|
||||
'" target="_blank" rel="noopener noreferrer">链上查询</a>';
|
||||
}
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
function assetsForRow(d) {
|
||||
var type = String(d.chain_type || '').toUpperCase();
|
||||
var addr = String(d.address || '');
|
||||
@@ -243,9 +294,7 @@ layui.use(['table', 'form', 'layer'], function () {
|
||||
{ field: 'id', title: 'ID', width: 70, sort: true },
|
||||
{ field: 'source', title: '来源', width: 120 },
|
||||
{ field: 'device_key', title: '设备 ID', width: 150, sort: true },
|
||||
{ field: 'address', title: '地址', minWidth: 360, templet: function (d) {
|
||||
return '<span class="addr-cell">' + (d.address || '') + '</span>';
|
||||
}},
|
||||
{ field: 'address', title: '地址', minWidth: 420, templet: addressCellHtml },
|
||||
{ field: 'chain_type', title: 'Chain', width: 110, templet: function (d) {
|
||||
return chainTag(d.chain_type);
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user