This commit is contained in:
huangjinming 2022-11-17 01:18:34 +08:00
parent d3b9fac751
commit 5872cb0a52
2 changed files with 132 additions and 132 deletions

View File

@ -38,9 +38,6 @@
margin-top: 0.2rem; margin-top: 0.2rem;
color: #fff; color: #fff;
} }
.headerbtn:hover .dropdown-content {
display: block;
}
</style> </style>
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.ico" /> <link rel="icon" type="image/png" sizes="32x32" href="/favicon.ico" />
<script> <script>
@ -83,7 +80,9 @@
style="display: none" style="display: none"
></a> ></a>
<div class="dropdown-content"> <div class="dropdown-content">
<a href="/recommend" id="sign_href" style="display: none;">Sign up</a> <a href="/recommend" id="sign_href" style="display: none"
>Sign up</a
>
<a href="/rankinglist" id="quest_info">Quest Info</a> <a href="/rankinglist" id="quest_info">Quest Info</a>
<a href="javascript:void(0)" id="logout_btn">Log out</a> <a href="javascript:void(0)" id="logout_btn">Log out</a>
</div> </div>
@ -341,13 +340,14 @@
<script src="js/time.js"></script> <script src="js/time.js"></script>
<script> <script>
function getUrlParam(name) { function getUrlParam(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg); var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null; if (r != null) return unescape(r[2]);
return null;
} }
var invitecode = getUrlParam('code') var invitecode = getUrlParam("code");
if (invitecode) { if (invitecode) {
localStorage.setItem('invite_code', invitecode) localStorage.setItem("invite_code", invitecode);
} }
var loadPic = []; var loadPic = [];
for (var i = 1; i < 101; i++) { for (var i = 1; i < 101; i++) {
@ -476,9 +476,9 @@
$("#wallet_login_btn").click(function () { $("#wallet_login_btn").click(function () {
location.href = "/sinup"; location.href = "/sinup";
}); });
$('#logout_btn').click(function(){ $("#logout_btn").click(function () {
localStorage.removeItem('userinfo') localStorage.removeItem("userinfo");
}) });
}); });
$(".anmode").each(function () { $(".anmode").each(function () {
@ -498,110 +498,104 @@
if (!th.hasClass("animated")) { if (!th.hasClass("animated")) {
th.addClass("animated"); th.addClass("animated");
} }
} }
}) });
}) });
$(function () { $(function () {
$(".rule_sliders").click(function () {
if (!$(this).hasClass("sliderOn")) {
$(".rule_sliders").removeClass("sliderOn");
$(this).addClass("sliderOn");
$(".rule_descprition").slideUp();
$(this).find(".rule_descprition").slideDown();
} else {
$(this).removeClass("sliderOn");
$(this).find(".rule_descprition").slideUp();
}
});
var address = "";
var token = "";
$(".rule_sliders").click(function () { var checkActivity = function (address, cb) {
var settings = {
url: "http://192.168.100.83:3000/aa1/user_status",
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: JSON.stringify({
account: address,
}),
};
if (!$(this).hasClass("sliderOn")) { $.ajax(settings).done(function (res) {
if (!res.errcode) {
$(".rule_sliders").removeClass("sliderOn"); if (res.status == 4) {
$(this).addClass("sliderOn"); $("#page_login_btn").hide();
$(".rule_descprition").slideUp(); $("#page_quest_btn").show();
$(this).find(".rule_descprition").slideDown(); } else if (res.status == 1) {
$("#page_login_btn").show();
} else { $("#page_quest_btn").hide();
$(this).removeClass("sliderOn"); $("#page_login_btn").attr("href", "/recommend");
$(this).find(".rule_descprition").slideUp(); } else {
$("#page_login_btn").show();
} $("#page_quest_btn").hide();
}) $("#page_login_btn").attr("href", "/login");
var address = ''; }
var token = ''
var checkActivity = function(address, cb) {
var settings = {
"url": "http://192.168.100.83:3000/aa1/user_status",
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"data": JSON.stringify({
"account": address
})
};
$.ajax(settings).done(function (res) {
if (!res.errcode) {
if (res.status == 4) {
$('#page_login_btn').hide();
$('#page_quest_btn').show();
} else if (res.status == 1) {
$('#page_login_btn').show();
$('#page_quest_btn').hide();
$('#page_login_btn').attr('href', '/recommend');
}else {
$('#page_login_btn').show();
$('#page_quest_btn').hide();
$('#page_login_btn').attr('href', '/login');
}
}
});
} }
var checkLogin = function() { });
let userinfo = window.localStorage.getItem("userinfo"); };
if (!userinfo) { var checkLogin = function () {
return false let userinfo = window.localStorage.getItem("userinfo");
} if (!userinfo) {
try { return false;
let udata = JSON.parse(userinfo) }
console.log(udata); try {
address = udata.account; let udata = JSON.parse(userinfo);
token = udata.token; console.log(udata);
if (address) { address = udata.account;
$('#logined_btn').html(formatAddress(address)); token = udata.token;
$('#wallet_login_btn').hide(); if (address) {
$('#logined_btn').show(); $("#logined_btn").html(formatAddress(address));
$('#page_login_btn').attr('href', '/signup'); $("#wallet_login_btn").hide();
checkActivity(address, function() { $("#logined_btn").show();
$("#page_login_btn").attr("href", "/signup");
}); checkActivity(address, function () {});
}
return true;
} catch (err) {
return false;
}
} }
checkLogin(); return true;
$('#wallet_login_btn').click(function() { } catch (err) {
location.href = '/sinup' return false;
}) }
};
checkLogin();
$("#wallet_login_btn").click(function () {
location.href = "/sinup";
});
});
}) $(".anmode").each(function () {
var th = $(this);
$(".anmode").each(function () { var dura = th.data("dura");
var th = $(this); var delay = th.data("delay");
var dura = th.data("dura"); th.css("animation-duration", dura);
var delay = th.data("delay"); th.css("animation-delay", delay);
th.css("animation-duration", dura); });
th.css("animation-delay", delay);
})
$(window).scroll(function () {
var windowtop = $(window).scrollTop();
$(".section").each(function (index, element) {
var th = $(this);
var thtops = th.offset().top;
if (windowtop >= (thtops - $(window).height() * 0.8)) {
if (!th.hasClass("animated")) {
th.addClass("animated");
}
}
});
})
$(window).scroll(function () {
var windowtop = $(window).scrollTop();
$(".section").each(function (index, element) {
var th = $(this);
var thtops = th.offset().top;
if (windowtop >= thtops - $(window).height() * 0.8) {
if (!th.hasClass("animated")) {
th.addClass("animated");
}
}
});
});
$(".headerbtn").click(function () {
$(".dropdown-content").show();
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -4,13 +4,14 @@
<div class="logo-img"> <div class="logo-img">
<img class="imgs" src="../../assets/mobile/logo.png" alt="" /> <img class="imgs" src="../../assets/mobile/logo.png" alt="" />
</div> </div>
<div class="header-login"> <div class="header-login" @click="header">
<span >WALLET CONNECT</span> <span>WALLET CONNECT</span>
<div class="dropdown-content"> <div v-show="hide" class="dropdown-content">
<a href="javascript:void(0)" @click.stop="toQuest">Quest Info</a> <a href="javascript:void(0)" @click.stop="toQuest">Quest Info</a>
<a href="javascript:void(0);" @click="logout">Log out</a> <a href="javascript:void(0);" @click="logout">Log out</a>
</div>
</div> </div>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -18,23 +19,30 @@
<script> <script>
export default { export default {
name: "Header", name: "Header",
data() {
return {
hide:false
};
},
created() { created() {
chain.chainManager.init().then(() => { chain.chainManager.init().then(() => {
console.log('header wallet init') console.log("header wallet init");
}) });
}, },
methods: { methods: {
header(){
this.hide = true
},
logout() { logout() {
chain.logout(); chain.logout();
localStorage.removeItem('userinfo'); localStorage.removeItem("userinfo");
location.href = '/desktop.html' location.href = "/desktop.html";
}, },
toQuest(e) { toQuest(e) {
this.$router.push('rankinglist') this.$router.push("rankinglist");
} },
} },
}; };
</script> </script>
<style lang="less"> <style lang="less">
@ -53,6 +61,7 @@ export default {
} }
.header-login { .header-login {
width: 9rem; width: 9rem;
margin-top: 0.2vh;
border-radius: 50px; border-radius: 50px;
line-height: 4vh; line-height: 4vh;
background: rgb(12, 0, 0); background: rgb(12, 0, 0);
@ -65,20 +74,17 @@ export default {
} }
.dropdown-content { .dropdown-content {
display: none; top: 4.2vh;
top:4.2vh; width: 36vw;
position: absolute; position: absolute;
background-color: rgb(18, 18, 18); background-color: rgb(18, 18, 18);
min-width: 100%;
border-radius: 4px; border-radius: 4px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2); box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
// padding: 12px 16px; // padding: 12px 16px;
z-index: 1; z-index: 1;
} }
.header-login:hover .dropdown-content {
display: block;
}
.dropdown-content a { .dropdown-content a {
text-decoration: none; text-decoration: none;
padding: 0.2vw 0.3vw; padding: 0.2vw 0.3vw;