This commit is contained in:
huangjinming 2022-11-17 01:30:16 +08:00
commit ae22ec3f1c
4 changed files with 19 additions and 91 deletions

View File

@ -464,7 +464,7 @@
$("#logined_btn").html(formatAddress(address)); $("#logined_btn").html(formatAddress(address));
$("#wallet_login_btn").hide(); $("#wallet_login_btn").hide();
$("#logined_btn").show(); $("#logined_btn").show();
$("#page_login_btn").attr("href", "/sinup"); $("#page_login_btn").attr("href", "/signup");
checkActivity(address, function () {}); checkActivity(address, function () {});
} }
return true; return true;
@ -473,12 +473,14 @@
} }
}; };
checkLogin(); checkLogin();
$("#wallet_login_btn").click(function () { $("#wallet_login_btn").click(function () {
location.href = "/sinup"; location.href = "/login";
});
$("#logout_btn").click(function () {
localStorage.removeItem("userinfo");
}); });
$('#logout_btn').click(function(){
localStorage.removeItem('userinfo')
localStorage.removeItem('invite_code');
location.reload()
})
}); });
$(".anmode").each(function () { $(".anmode").each(function () {
@ -498,88 +500,12 @@
if (!th.hasClass("animated")) { if (!th.hasClass("animated")) {
th.addClass("animated"); th.addClass("animated");
} }
} }
}); })
}); })
$(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 = "";
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) {
return false;
}
try {
let udata = JSON.parse(userinfo);
console.log(udata);
address = udata.account;
token = udata.token;
if (address) {
$("#logined_btn").html(formatAddress(address));
$("#wallet_login_btn").hide();
$("#logined_btn").show();
$("#page_login_btn").attr("href", "/signup");
checkActivity(address, function () {});
}
return true;
} catch (err) {
return false;
}
};
checkLogin();
$("#wallet_login_btn").click(function () {
location.href = "/sinup";
});
});
$(".anmode").each(function () {
var th = $(this);
var dura = th.data("dura");
var delay = th.data("delay");
th.css("animation-duration", dura);
th.css("animation-delay", delay);
});
$(window).scroll(function () { $(window).scroll(function () {
var windowtop = $(window).scrollTop(); var windowtop = $(window).scrollTop();

View File

@ -35,8 +35,9 @@ export default {
}, },
logout() { logout() {
chain.logout(); chain.logout();
localStorage.removeItem("userinfo"); localStorage.removeItem('userinfo');
location.href = "/desktop.html"; localStorage.removeItem('invite_code');
location.href = '/desktop.html'
}, },
toQuest(e) { toQuest(e) {
this.$router.push("rankinglist"); this.$router.push("rankinglist");

View File

@ -13,7 +13,7 @@
</template> </template>
<script> <script>
import {checkStatus} from '@/api/webapi'
export default { export default {
data() { data() {
return { return {
@ -23,7 +23,7 @@ export default {
}, },
mounted() { mounted() {
this.loadLocalData() this.loadLocalData()
this.checkStatus()
}, },
methods: { methods: {
loadLocalData() { loadLocalData() {

View File

@ -61,6 +61,7 @@ export default {
return { return {
data: null, data: null,
time: "", time: "",
account: ''
}; };
}, },
created() { created() {