149 lines
4.5 KiB
HTML
149 lines
4.5 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8" />
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||
<meta name="renderer" content="webkit">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||
<title>CEBG: CRYPTO ELITE‘S BATTLEGROUNDS</title>
|
||
</head>
|
||
<body>
|
||
<section class="main">
|
||
<section class="header">
|
||
<img src="img/applyother/amt.jpg" width="100%" />
|
||
<script>cur = 'activity'; sub='act1'</script>
|
||
<%- include('../comp/desktopNav.html') %>
|
||
</section>
|
||
<section class="main-con amb-con">
|
||
<div class="amb-detail">
|
||
<div class="amb-de-l">
|
||
<div class="amb-de-l-img">
|
||
<img id="info_portrait" src="img/applyother/am12.jpg" width="284" height="278" />
|
||
</div>
|
||
<div class="amb-i-3">
|
||
<p class="amb-i-txt" id="info_account">0x123456........445855</p>
|
||
</div>
|
||
<div class="amb-i-4">
|
||
<p class="amb-i-txt" id="info_email">Kawabonga123@gmail.com</p>
|
||
</div>
|
||
</div>
|
||
<div class="amb-de-r">
|
||
<div class="amb-i-5"><img src="img/applyother/am5.png" /></div>
|
||
<div class="amb-i-wrap">
|
||
<div class="amb-i-6">
|
||
<p class="amb-i-txt" id="info_name">Kawabonga</p>
|
||
</div>
|
||
<div class="amb-i-7">
|
||
<p class="amb-i-txt" id="info_loc">Japan</p>
|
||
</div>
|
||
<div class="amb-i-8">
|
||
<p class="amb-i-txt" id="info_commander">9,999,999</p>
|
||
</div>
|
||
</div>
|
||
<div class="amb-i-9"><img src="img/applyother/am9.png" /></div>
|
||
<div class="amb-i-10">
|
||
<div class="amb-i-10-scroll" id="info_intro">
|
||
He didn't write anything
|
||
</div>
|
||
</div>
|
||
<div class="amb-i-11">
|
||
<span><a href="./join.html?amb=" id="apply_href">Apply to be his/her commander</a></span>
|
||
<a id="copyBtn"></a>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</section>
|
||
<%- include('../comp/footer.html') %>
|
||
</section>
|
||
<%- include('../comp/walletModal.html') %> <%- include('../comp/jslib.html')
|
||
%>
|
||
<script>
|
||
const DETAIL_URL = 'https://invitation.cebggame.com/invitation/get_amb'
|
||
$(function() {
|
||
function getUrlParam(name) {
|
||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||
var r = window.location.search.substr(1).match(reg);
|
||
if (r != null) return unescape(r[2]); return null;
|
||
}
|
||
function formatAddress(address) {
|
||
if (address.length >= 10) {
|
||
return address.substring(0, 6) + '......' + address.substring(address.length - 4)
|
||
} else if (address.length > 0 && address.length < 10) {
|
||
return address
|
||
} else {
|
||
return '-'
|
||
}
|
||
}
|
||
|
||
$("#copyBtn").click(function() {
|
||
var host = location.origin;
|
||
var path = location.pathname.replace('ambassadorinfo', 'join');
|
||
var _text = `${host}${path}?amb=${account}`;
|
||
const input = document.createElement('input');
|
||
document.body.appendChild(input);
|
||
input.value = _text;
|
||
input.select();
|
||
if (document.execCommand('copy')) {
|
||
document.execCommand('copy');
|
||
alert('copy success')
|
||
}
|
||
document.body.removeChild(input);
|
||
})
|
||
let account = getUrlParam('amb');
|
||
if (!account) {
|
||
return
|
||
}
|
||
function showInfo(data) {
|
||
$('#info_name').html(data.name || "-");
|
||
$('#info_loc').html(data.comefrom || "-");
|
||
$('#info_commander').html(data.cache_a_num || "-");
|
||
$('#info_email').html(data.email || "-");
|
||
$('#info_account').html(formatAddress(data.account));
|
||
if (data.aboutme) {
|
||
$('#info_intro').html(data.aboutme);
|
||
}
|
||
if (data.headpic) {
|
||
$('#info_portrait').attr('src', data.headpic);
|
||
}
|
||
}
|
||
var fetchDatas = async () => {
|
||
var headers = new Headers();
|
||
headers.append("Content-Type", "application/json");
|
||
if (window.chain.logined) {
|
||
headers.append("Authorization", `Bearer ${window.chain.token}`)
|
||
}
|
||
try {
|
||
let data = await fetch(
|
||
DETAIL_URL,
|
||
{
|
||
method: 'POST',
|
||
headers,
|
||
mode: 'cors',
|
||
cache: 'no-cache',
|
||
body: JSON.stringify({
|
||
account
|
||
})
|
||
},
|
||
|
||
)
|
||
.then(res => {
|
||
return res.json()
|
||
})
|
||
if (!data.errcode) {
|
||
console.log(data.data)
|
||
showInfo(data.data);
|
||
}
|
||
} catch (err) {
|
||
console.log('error get data', err);
|
||
}
|
||
}
|
||
fetchDatas();
|
||
window.addEventListener('account_ready', function() {
|
||
$('#apply_href').attr('href', `./join.html?amb=${window.chain.account}`)
|
||
})
|
||
})
|
||
</script>
|
||
</body>
|
||
</html>
|