增加commander页面
@ -7,7 +7,9 @@
|
||||
"desktop": "webpack --config ./webpack.desktop.js",
|
||||
"mobile": "webpack --config ./webpack.mobile.js",
|
||||
"deploy:prod": "rm -f ./dist/.DS_Store && aws s3 sync ./dist s3://cebg.games.new --acl public-read --exclude \"pubgv4/*\" --exclude \"release/*\"",
|
||||
"deploy:test": "rm -f ./dist/.DS_Store && aws s3 sync ./dist s3://test-client.cebg.games",
|
||||
"refresh:prod": "aws cloudfront create-invalidation --distribution-id E34PEY4AGTMS0Y --paths \"/*\"",
|
||||
"refresh:test": "aws cloudfront create-invalidation --distribution-id EE4HC9OXEQC7Y --paths \"/*\"",
|
||||
"dev:desktop": "webpack --config ./webpack.desktop.dev.js --watch",
|
||||
"dev:mobile": "webpack --config ./webpack.mobile.dev.js --watch"
|
||||
},
|
||||
|
@ -86,7 +86,7 @@
|
||||
input.select();
|
||||
if (document.execCommand('copy')) {
|
||||
document.execCommand('copy');
|
||||
alert('复制成功')
|
||||
alert('copy success')
|
||||
}
|
||||
document.body.removeChild(input);
|
||||
})
|
||||
@ -97,7 +97,7 @@
|
||||
function showInfo(data) {
|
||||
$('#info_name').html(data.name || "-");
|
||||
$('#info_loc').html(data.comefrom || "-");
|
||||
$('#info_commander').html(data.commander || "-");
|
||||
$('#info_commander').html(data.cache_a_num || "-");
|
||||
$('#info_email').html(data.email || "-");
|
||||
$('#info_account').html(formatAddress(data.account));
|
||||
if (data.aboutme) {
|
||||
|
@ -46,7 +46,7 @@
|
||||
$('.info_href', dom).attr('href', `ambassadorinfo.html?amb=${data.account}`)
|
||||
$('.name', dom).replaceWith(`<span>${data.name || '-'}</span>`)
|
||||
$('.loc', dom).replaceWith(`<span>${data.comefrom || '-'}</span>`)
|
||||
$('.commander', dom).replaceWith(`<span>${data.commander || '-'}</span>`)
|
||||
$('.commander', dom).replaceWith(`<span>${data.cache_a_num || '-'}</span>`)
|
||||
dom.show().appendTo('#amb_container')
|
||||
}
|
||||
var retry = 0;
|
||||
|
222
src/desktop/commander.html
Normal file
@ -0,0 +1,222 @@
|
||||
<!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 commander " id="info_div" >
|
||||
<div class="amb-de-l">
|
||||
<div class="amb-i-3">
|
||||
<p class="amb-i-txt" id="info_account"></p>
|
||||
</div>
|
||||
<div class="amb-i-4">
|
||||
<p class="amb-i-txt" id="info_email"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="amb-de-r">
|
||||
<div class="amb-i-5"><img src="img/applyother/com-tip.png" /></div>
|
||||
<div class="amb-i-wrap">
|
||||
<div class="amb-i-6">
|
||||
<p class="amb-i-txt" id="info_name"></p>
|
||||
</div>
|
||||
<div class="amb-i-7">
|
||||
<p class="amb-i-txt" id="info_loc"></p>
|
||||
</div>
|
||||
<div class="amb-i-8">
|
||||
<p class="amb-i-txt" id="info_commander"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="amb-i-11 gray" id="apply_btn">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="feedback-inner tac hide" id="success_tip">
|
||||
<img src="img/applyother/cmd-title.png"/>
|
||||
<div class="feedback-tips" id="tip_title">You already have an identity.</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
<%- include('../comp/footer.html') %>
|
||||
</section>
|
||||
<%- include('../comp/walletModal.html') %> <%- include('../comp/jslib.html')
|
||||
%>
|
||||
<script>
|
||||
// const HOST = 'http://192.168.100.88:3000'
|
||||
const HOST = 'https://invitation.cebggame.com'
|
||||
const DETAIL_URL = `${HOST}/invitation/get_commander_base`
|
||||
const CHECK_URL = `${HOST}/invitation/check_bind_commander`
|
||||
const JOIN_URL = `${HOST}/invitation/add_user`
|
||||
$(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}?cmdr=${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 cmdr = getUrlParam('cmdr');
|
||||
if (!cmdr) {
|
||||
return
|
||||
}
|
||||
function showInfo(data) {
|
||||
$('#info_name').html(data.name || "-");
|
||||
$('#info_loc').html(data.comefrom || "-");
|
||||
$('#info_commander').html(data.cache_c_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 (url, data) => {
|
||||
var headers = new Headers();
|
||||
headers.append("Content-Type", "application/json");
|
||||
if (window.chain.logined) {
|
||||
headers.append("Authorization", `Bearer ${window.chain.token}`)
|
||||
}
|
||||
return fetch(
|
||||
url,
|
||||
{
|
||||
method: 'POST',
|
||||
headers,
|
||||
mode: 'cors',
|
||||
cache: 'no-cache',
|
||||
body: JSON.stringify(data)
|
||||
},
|
||||
|
||||
)
|
||||
.then(res => {
|
||||
return res.json()
|
||||
})
|
||||
}
|
||||
var checkBind = async() => {
|
||||
try {
|
||||
let data = await fetchDatas(CHECK_URL, {account: window.chain.account});
|
||||
if (!data.errcode && data.result) {
|
||||
userLvl = data.result.rank_level;
|
||||
if (data.result.chk === 0 && data.result.rank_level === 0) {
|
||||
canJoin = true
|
||||
} else {
|
||||
canJoin = false
|
||||
}
|
||||
updateStatus()
|
||||
if (!canJoin) {
|
||||
showTips()
|
||||
}
|
||||
}
|
||||
} catch(err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
var join = async() => {
|
||||
try {
|
||||
let data = await fetchDatas(JOIN_URL, {
|
||||
account: window.chain.account,
|
||||
commander: cmdr
|
||||
});
|
||||
if (!data.errcode) {
|
||||
updateStatus();
|
||||
showTips();
|
||||
}
|
||||
|
||||
} catch(err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
var getCmdrInfo = async() => {
|
||||
try {
|
||||
let data = await fetchDatas(DETAIL_URL, {account: cmdr});
|
||||
showInfo(data.info);
|
||||
updateStatus();
|
||||
} catch (err){
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
$('#apply_btn').click(async ()=>{
|
||||
if (window.chain.logined) {
|
||||
await checkBind();
|
||||
if (canJoin) {
|
||||
join();
|
||||
} else {
|
||||
showTips();
|
||||
}
|
||||
} else {
|
||||
window.chainLogin(async function(){
|
||||
await checkBind();
|
||||
if (canJoin) {
|
||||
join();
|
||||
} else {
|
||||
showTips();
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
var showTips = ()=> {
|
||||
$('#info_div').hide();
|
||||
$('#success_tip').show();
|
||||
}
|
||||
|
||||
let account = ''
|
||||
let useLvl = 0
|
||||
let canJoin = true
|
||||
if (window.chain.logined) {
|
||||
account = window.chain.account
|
||||
}
|
||||
var updateStatus = () => {
|
||||
if (canJoin) {
|
||||
$('#apply_btn').removeClass('gray')
|
||||
} else {
|
||||
$('#apply_btn').addClass('gray')
|
||||
}
|
||||
}
|
||||
updateStatus();
|
||||
getCmdrInfo();
|
||||
if(window.chain.logined) {
|
||||
let time = setInterval(()=>{
|
||||
if (window.chain.account) {
|
||||
clearInterval(time);
|
||||
checkBind();
|
||||
}
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1197,6 +1197,7 @@ span.swiper-pagination-bullet {
|
||||
|
||||
.feedback-inner {
|
||||
padding: 80px 0 300px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.amb-con{
|
||||
@ -1378,12 +1379,70 @@ span.swiper-pagination-bullet {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.amb-detail.commander{
|
||||
background: url('../img/applyother/com-bg.png') no-repeat center top;
|
||||
width: 1282px;
|
||||
height: 500px;
|
||||
margin: 0px auto 30px;
|
||||
display: flex;
|
||||
flex-flow: row;
|
||||
}
|
||||
.commander .amb-i-11{
|
||||
background: url('../img/applyother/btn_become.png') no-repeat top;
|
||||
height: 88px;
|
||||
}
|
||||
.commander .amb-i-11 span {
|
||||
line-height: 84px;
|
||||
}
|
||||
.commander .amb-i-4 {
|
||||
width: 312px;
|
||||
height: 147px;
|
||||
background: url('../img/applyother/com-mail.png') no-repeat top;
|
||||
}
|
||||
.commander .amb-i-3 {
|
||||
width: 312px;
|
||||
height: 147px;
|
||||
background: url('../img/applyother/com-account.png') no-repeat top;
|
||||
}
|
||||
.commander .amb-i-txt{
|
||||
top: 83px;
|
||||
}
|
||||
.commander .amb-de-r .amb-i-txt{
|
||||
top: 75px;
|
||||
}
|
||||
.commander .amb-i-8{
|
||||
width: 280px;
|
||||
height: 132px;
|
||||
background: url('../img/applyother/com-total.png') no-repeat top;
|
||||
}
|
||||
.commander .amb-de-r {
|
||||
padding: 54px 0 0 25px;
|
||||
}
|
||||
.feedback-tips{
|
||||
left: 0;
|
||||
top: 0;
|
||||
margin: auto;
|
||||
position: absolute;
|
||||
width: 1040px;
|
||||
height: 128px;
|
||||
padding: 467px 440px 20px;
|
||||
font-size: 60px;
|
||||
}
|
||||
#apply_btn{
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
|
||||
.hide{
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.gray {
|
||||
-webkit-filter: grayscale(100%); /* Chrome, Safari, Opera */
|
||||
filter: grayscale(100%);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
BIN
src/desktop/img/applyother/btn_become.png
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
src/desktop/img/applyother/cmd-title.png
Normal file
After Width: | Height: | Size: 211 KiB |
BIN
src/desktop/img/applyother/com-account.png
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
src/desktop/img/applyother/com-area.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/desktop/img/applyother/com-bg.png
Executable file
After Width: | Height: | Size: 152 KiB |
BIN
src/desktop/img/applyother/com-input.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
src/desktop/img/applyother/com-mail.png
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
src/desktop/img/applyother/com-name.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
src/desktop/img/applyother/com-tip.png
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
src/desktop/img/applyother/com-total.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
@ -10,6 +10,7 @@ var jcchain = require("./jcchain.js");
|
||||
})(jQuery);
|
||||
|
||||
var chain = new jcchain.JCChain();
|
||||
chain.chainManager.init();
|
||||
window.chain = chain;
|
||||
var toggleLoginBtn = function () {
|
||||
if (chain.logined) {
|
||||
|