Files
SMANAGE/TempLate/CCCRB/wallet.html
T
2026-06-16 11:55:14 +08:00

281 lines
8.8 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>银河锋锐 - GC钱包</title>
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
transition: background-color 0.5s, color 0.5s;
}
.wallet-container {
text-align: center;
padding: 40px;
border-radius: 15px;
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
max-width: 500px;
width: 90%;
transition: all 0.3s ease;
}
.wallet-container:hover {
box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}
.logo {
width: 100px;
height: 100px;
margin-bottom: 20px;
border-radius: 50%;
border: 2px solid currentColor;
padding: 10px;
}
h1 {
margin: 0 0 20px;
font-size: 28px;
font-weight: 600;
}
.wallet-type {
font-size: 16px;
opacity: 0.8;
margin-bottom: 30px;
}
.balance {
font-size: 48px;
font-weight: bold;
margin: 20px 0;
font-family: 'Courier New', monospace;
letter-spacing: 1px;
}
.currency {
font-size: 24px;
margin-left: 8px;
font-weight: 500;
}
.address-container {
background-color: rgba(255, 255, 255, 0.1);
padding: 15px;
border-radius: 8px;
margin: 30px 0;
word-break: break-all;
}
.address-label {
font-size: 14px;
margin-bottom: 8px;
opacity: 0.8;
}
.address {
font-family: 'Courier New', monospace;
font-size: 14px;
line-height: 1.5;
}
.qr-code-container {
margin: 30px auto;
width: 180px;
height: 180px;
padding: 10px;
background-color: white;
border-radius: 8px;
display: flex;
justify-content: center;
align-items: center;
}
.qr-code {
width: 100%;
height: 100%;
}
.share-text {
margin-top: 15px;
font-size: 14px;
opacity: 0.8;
}
#unbound-message {
display: none;
padding: 10px;
border-radius: 5px;
margin: 20px 0;
}
/* 颜色主题 */
.default-theme {
background-color: #f5f5f5;
color: #333;
}
.default-theme .wallet-container {
background-color: white;
}
.green-theme {
background-color: #e8f5e9;
color: #2e7d32;
}
.green-theme .wallet-container {
background-color: #ffffff;
}
.blue-theme {
background-color: #e3f2fd;
color: #1565c0;
}
.blue-theme .wallet-container {
background-color: #ffffff;
}
.gold-theme {
background-color: #212121;
color: #ffd700;
}
.gold-theme .wallet-container {
background-color: #333333;
}
.corporate-theme {
background-color: #0d47a1;
color: white;
}
.corporate-theme .wallet-container {
background-color: #1565c0;
}
.default-theme #unbound-message,
.green-theme #unbound-message,
.blue-theme #unbound-message {
background-color: #ffebee;
color: #b71c1c;
}
.gold-theme #unbound-message,
.corporate-theme #unbound-message {
background-color: rgba(255, 255, 255, 0.1);
color: #ff8a80;
}
</style>
</head>
<body class="default-theme">
<div class="wallet-container">
<h1>枢机信用储备银行 GC 钱包</h1>
<div class="wallet-type">中心化数字资产钱包</div>
<div class="balance">
<span id="gc-amount">数据加载中...</span>
<span class="currency">GC</span>
</div>
<div id="unbound-message" style="display: none; font-weight: bold; margin: 20px 0;">
账户未绑定玩家
</div>
<div class="address-container">
<div class="address-label">玩家地址</div>
<div class="address" id="Player-uuid">等待请求...</div>
<div class="address-label">账户地址</div>
<div class="address" id="User-uuid">等待请求...</div>
</div>
<div class="qr-code-container">
<img id="share-qr" class="qr-code" alt="分享二维码" />
</div>
<div class="share-text">扫描二维码分享您的钱包</div>
</div>
<script>
// 根据GC数量设置主题(排除-1的情况)
function setThemeByGC(amount) {
const body = document.body;
body.className = ''; // 清除所有主题类
if (amount === 0) {
body.classList.add('default-theme');
} else if (amount > 0 && amount <= 9999) {
body.classList.add('green-theme');
} else if (amount > 9999 && amount <= 999999) {
body.classList.add('blue-theme');
} else if (amount > 999999 && amount <= 9999999) {
body.classList.add('gold-theme');
} else if (amount > 9999999) {
body.classList.add('corporate-theme');
} else {
// 默认主题
body.classList.add('default-theme');
}
}
// 查找GC类型的余额
function getGCBalance(balances) {
const gcBalance = balances.find(item => item.Type === 'GC');
return gcBalance ? gcBalance.Balance : -1;
}
fetch('/api/crb/wallet-balances/')
.then(response => {
if (!response.ok) {
throw new Error('网络响应不正常');
}
return response.json();
})
.then(data => {
// 从新API结构中解析GC余额
const GC = getGCBalance(data.Balances || []);
if (GC === -1) {
document.getElementById('gc-amount').textContent = '0';
document.getElementById('unbound-message').style.display = 'block';
} else {
// 格式化数字显示(保留三位小数,添加千分位)
const formattedGC = GC.toLocaleString(undefined, {
minimumFractionDigits: 3,
maximumFractionDigits: 3
});
document.getElementById('gc-amount').textContent = formattedGC;
document.getElementById('unbound-message').style.display = 'none';
}
// 设置二维码链接
const qrCodeUrl = GC === -1
? 'https://api.qrtool.cn/?text=https://3crb.gvsds.com/ShareWallet.html?gc=0'
: `https://api.qrtool.cn/?text=https://3crb.gvsds.com/ShareWallet.html?gc=${GC}`;
document.getElementById('share-qr').src = qrCodeUrl;
// 设置UUID显示
document.getElementById('Player-uuid').textContent = data.PlayerUUID || '无数据';
document.getElementById('User-uuid').textContent = data.UserUUID || '无数据';
// 设置主题
setThemeByGC(GC);
})
.catch(error => {
console.error('请求出错:', error);
// 错误处理:显示默认值
document.getElementById('gc-amount').textContent = '0';
document.getElementById('Player-uuid').textContent = '请求失败';
document.getElementById('User-uuid').textContent = '请求失败';
document.getElementById('unbound-message').style.display = 'block';
document.getElementById('unbound-message').textContent = '数据加载失败,请刷新页面';
});
</script>
</body>
</html>