登陆成功后,增加当前帐号返回

This commit is contained in:
cebgcontract 2022-10-20 14:46:49 +08:00
parent 7a8f0972b4
commit d6eb43e36c
2 changed files with 35 additions and 34 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,42 +1,43 @@
var jcchain = require('./jcchain.js')
var jcchain = require("./jcchain.js");
var chain = new jcchain.JCChain()
var chain = new jcchain.JCChain();
var toggleLoginBtn = function () {
if (chain.logined) {
$('#header_loginbtn').hide()
$('#header_logoutbtn').show()
$("#header_loginbtn").hide();
$("#header_logoutbtn").show();
} else {
$('#header_loginbtn').show()
$('#header_logoutbtn').hide()
$("#header_loginbtn").show();
$("#header_logoutbtn").hide();
}
}
toggleLoginBtn()
};
toggleLoginBtn();
var logSuccess = function () {
console.log('login success')
toggleLoginBtn()
}
$('#header_loginbtn').click(function () {
chain.login().then(logSuccess.bind(this))
})
console.log("login success");
console.log(chain);
toggleLoginBtn();
};
$("#header_loginbtn").click(function () {
chain.login().then(logSuccess.bind(this));
});
$('#header_logoutbtn').click(function () {
$("#header_logoutbtn").click(function () {
chain.logout().then(() => {
toggleLoginBtn()
})
})
toggleLoginBtn();
});
});
jcchain.EventBus.$on(jcchain.SHOW_CHAIN_MODAL, function () {
console.log('show chain modal')
$('#wallet_modal').show()
})
$('#metamask_card').click(function () {
chain.selectWalletAndLogin(1).then(logSuccess.bind(this))
$('#wallet_modal').hide()
})
$('#wc_card').click(function () {
chain.selectWalletAndLogin(2).then(logSuccess.bind(this))
$('#wallet_modal').hide()
})
console.log("show chain modal");
$("#wallet_modal").show();
});
$("#metamask_card").click(function () {
chain.selectWalletAndLogin(1).then(logSuccess.bind(this));
$("#wallet_modal").hide();
});
$("#wc_card").click(function () {
chain.selectWalletAndLogin(2).then(logSuccess.bind(this));
$("#wallet_modal").hide();
});
$('.comingSoon').click(function(){
$.message({type:'default',content:'Coming Soon.'});
})
$(".comingSoon").click(function () {
$.message({ type: "default", content: "Coming Soon." });
});