修改一些跳转逻辑
This commit is contained in:
parent
11f9f297ea
commit
143601a9ea
@ -83,8 +83,9 @@
|
||||
style="display: none"
|
||||
></a>
|
||||
<div class="dropdown-content">
|
||||
<a href="# ">Quest Info</a>
|
||||
<a href="# ">Log out</a>
|
||||
<a href="/recommend" id="sign_href" style="display: none;">Sign up</a>
|
||||
<a href="/rankinglist" id="quest_info">Quest Info</a>
|
||||
<a href="javascript:void(0)" id="logout_btn">Log out</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -339,6 +340,15 @@
|
||||
<script src="js/model.js"></script>
|
||||
<script src="js/time.js"></script>
|
||||
<script>
|
||||
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;
|
||||
}
|
||||
var invitecode = getUrlParam('code')
|
||||
if (invitecode) {
|
||||
localStorage.setItem('invite_code', invitecode)
|
||||
}
|
||||
var loadPic = [];
|
||||
for (var i = 1; i < 101; i++) {
|
||||
loadPic.push("images/xl1/c (" + i + ").jpg");
|
||||
@ -422,13 +432,19 @@
|
||||
if (res.status == 4) {
|
||||
$("#page_login_btn").hide();
|
||||
$("#page_quest_btn").show();
|
||||
$("#quest_info").show();
|
||||
$("#sign_href").hide();
|
||||
} else if (res.status == 1) {
|
||||
$("#page_login_btn").show();
|
||||
$("#page_quest_btn").hide();
|
||||
$("#quest_info").hide();
|
||||
$("#sign_href").show();
|
||||
$("#page_login_btn").attr("href", "/sinup");
|
||||
} else {
|
||||
$("#page_login_btn").show();
|
||||
$("#page_quest_btn").hide();
|
||||
$("#quest_info").hide();
|
||||
$("#sign_href").show();
|
||||
$("#page_login_btn").attr("href", "/login");
|
||||
}
|
||||
}
|
||||
@ -457,9 +473,14 @@
|
||||
}
|
||||
};
|
||||
checkLogin();
|
||||
$("#wallet_login_btn").click(function () {
|
||||
$("#wallet_login_btn").click(function () {
|
||||
location.href = "/sinup";
|
||||
});
|
||||
$('#logout_btn').click(function(){
|
||||
window.chain.logout().then(() => {
|
||||
console.log('logout')
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
$(".anmode").each(function () {
|
||||
@ -480,6 +501,8 @@
|
||||
th.addClass("animated");
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$(function () {
|
||||
|
||||
$(".rule_sliders").click(function () {
|
||||
@ -543,7 +566,7 @@
|
||||
$('#logined_btn').html(formatAddress(address));
|
||||
$('#wallet_login_btn').hide();
|
||||
$('#logined_btn').show();
|
||||
$('#page_login_btn').attr('href', '/sinup');
|
||||
$('#page_login_btn').attr('href', '/signup');
|
||||
checkActivity(address, function() {
|
||||
|
||||
});
|
||||
|
21
src/App.vue
21
src/App.vue
@ -6,6 +6,27 @@
|
||||
<script>
|
||||
var jcchain = require("./chain/jcchain.js");
|
||||
window.jcchain = jcchain;
|
||||
window.chain = new jcchain.JCChain()
|
||||
export default {
|
||||
methods: {
|
||||
loadLocalData() {
|
||||
let userInfo = localStorage.getItem('userinfo')
|
||||
if (userInfo) {
|
||||
try {
|
||||
let userData = JSON.parse(userInfo)
|
||||
this.account = userData.account;
|
||||
this.$store.commit('updataAccount', userData.account);
|
||||
console.log(this.$store.state.account)
|
||||
} catch(err) {
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
console.log('app mounted')
|
||||
this.loadLocalData();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
body{
|
||||
|
@ -1,7 +1,11 @@
|
||||
import axios from "axios";
|
||||
|
||||
export function checkStatus(account) {
|
||||
return axios.post(process.env.VUE_APP_API_HOST + "/aa1/user_status", {
|
||||
account,
|
||||
});
|
||||
return axios
|
||||
.post(process.env.VUE_APP_API_HOST + "/aa1/user_status", {
|
||||
account,
|
||||
})
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
});
|
||||
}
|
||||
|
@ -67,22 +67,11 @@ export default {
|
||||
this.offset += 1;
|
||||
this.updateData();
|
||||
},
|
||||
loadLocalData() {
|
||||
let userInfo = localStorage.getItem('userinfo')
|
||||
if (userInfo) {
|
||||
try {
|
||||
let userData = JSON.parse(userInfo)
|
||||
this.account = userData.account;
|
||||
console.log(userData)
|
||||
} catch(err) {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateData() {
|
||||
this.$axios
|
||||
.post(process.env.VUE_APP_API_HOST + "/aa1/leaderboard", {
|
||||
account: this.account,
|
||||
account: this.$store.state.account,
|
||||
offset: this.offset,
|
||||
limit: 10,
|
||||
})
|
||||
@ -97,13 +86,12 @@ export default {
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.loadLocalData()
|
||||
if (!this.account) {
|
||||
if (!this.$store.state.account) {
|
||||
return
|
||||
}
|
||||
this.$axios
|
||||
.post(process.env.VUE_APP_API_HOST + "/aa1/leaderboard", {
|
||||
account: this.account,
|
||||
account: this.$store.state.account,
|
||||
offset: 0,
|
||||
limit: 10,
|
||||
})
|
||||
@ -117,7 +105,7 @@ export default {
|
||||
});
|
||||
this.$axios
|
||||
.post(process.env.VUE_APP_API_HOST + "/aa1/leaderboard_me", {
|
||||
account: this.account,
|
||||
account: this.$store.state.account,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("成功", res.data);
|
||||
|
@ -158,13 +158,12 @@ export default {
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.loadLocalData()
|
||||
if (!this.account) {
|
||||
if (!this.$store.state.account) {
|
||||
return;
|
||||
}
|
||||
this.$axios
|
||||
.post(process.env.VUE_APP_API_HOST + "/aa1/user_info", {
|
||||
account: "0xCC8EFe18ca9f000786D73D993e85A9eFc3ac9417",
|
||||
account: this.$store.state.account,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("成功", res.data);
|
||||
@ -176,7 +175,7 @@ export default {
|
||||
});
|
||||
this.$axios
|
||||
.post(process.env.VUE_APP_API_HOST + "/aa1/list_event_log", {
|
||||
account: "0xCC8EFe18ca9f000786D73D993e85A9eFc3ac9417",
|
||||
account: this.$store.state.account,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("成功", res.data);
|
||||
@ -196,16 +195,6 @@ export default {
|
||||
}, 500);
|
||||
},
|
||||
methods: {
|
||||
loadLocalData() {
|
||||
let userInfo = localStorage.getItem('userinfo')
|
||||
if (userInfo) {
|
||||
try {
|
||||
let userData = JSON.parse(userInfo)
|
||||
this.account = userData.account;
|
||||
} catch(err) {
|
||||
}
|
||||
}
|
||||
},
|
||||
navigator() {
|
||||
this.$router.push("lisitdetails");
|
||||
},
|
||||
|
@ -13,6 +13,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {checkStatus} from '@/api/webapi'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -20,19 +21,30 @@ export default {
|
||||
number:''
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.loadLocalData()
|
||||
this.checkStatus()
|
||||
},
|
||||
methods: {
|
||||
loadLocalData() {
|
||||
let code = localStorage.getItem('invite_code')
|
||||
if (code) {
|
||||
this.number = code
|
||||
}
|
||||
},
|
||||
navigator() {
|
||||
let userinfo = localStorage.getItem("userinfo");
|
||||
//JSON.parse(userinfo).account
|
||||
let userData = JSON.parse(userinfo)
|
||||
this.$axios
|
||||
.post(process.env.VUE_APP_API_HOST + "/aa1/join", {
|
||||
account: '0xCC8EFe15ca9f000786D73D993e85A9eFc3ac9419' ,
|
||||
account: this.$store.state.account ,
|
||||
invite_code: this.number,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("成功", res.data);
|
||||
this.feedList = res.data.data;
|
||||
this.pagnation = res.data.pagnation;
|
||||
console.log(res);
|
||||
if (res.data.errcode == -3) {
|
||||
alert('alreay joined')
|
||||
return;
|
||||
}
|
||||
console.log("success", res.data);
|
||||
//this.$router.push("success");
|
||||
this.$router.push({name:'Success',params:res.data });
|
||||
})
|
||||
|
@ -15,6 +15,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {checkStatus} from '@/api/webapi'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -23,11 +24,13 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
console.log("mounted");
|
||||
this.checkStatus()
|
||||
window.addEventListener("message", (e) => {
|
||||
if (e.data?.type === "w3wCampaignJoinSuccess") {
|
||||
console.log("on get iframe message: ");
|
||||
console.log(e.data);
|
||||
//TODO:: 这里调用接口上报给服务端, 服务端进行检查
|
||||
this.checkStatus()
|
||||
}
|
||||
});
|
||||
let iframe = document.getElementById("iframe");
|
||||
@ -36,12 +39,22 @@ export default {
|
||||
console.log("iframe load");
|
||||
setTimeout(() => {
|
||||
console.log("send wallet address to remote page");
|
||||
// TODO:: 这里传真实的钱包地址
|
||||
self.sendAddressToIframe("0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1");
|
||||
self.sendAddressToIframe(this.$store.state.account);
|
||||
}, 1000);
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
async checkStatus() {
|
||||
let res = await checkStatus(this.$store.state.account)
|
||||
if (res.errcode) {
|
||||
return;
|
||||
}
|
||||
if (res.status === 4) {
|
||||
this.$router.push("rankinglist")
|
||||
} else if (res.status === 1) {
|
||||
this.$router.push("recommend")
|
||||
}
|
||||
},
|
||||
navigator() {
|
||||
this.$router.push("recommend");
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user