This commit is contained in:
cebgcontract 2022-11-17 00:21:09 +08:00
parent dc13c05d22
commit 939f577276
2 changed files with 39 additions and 22 deletions

View File

@ -5,10 +5,10 @@
<img class="imgs" src="../../assets/mobile/logo.png" alt="" />
</div>
<div class="header-login">
<span href="">WALLET CONNECT</span>
<span >WALLET CONNECT</span>
<div class="dropdown-content">
<a href="# ">Quest Info</a>
<a href="# ">Log out</a>
<a href="/rankinglist">Quest Info</a>
<a href="javascript:void(0);" @click="logout">Log out</a>
</div>
</div>
</div>
@ -19,10 +19,14 @@
export default {
name: "Header",
created() {
this.chain = new jcchain.JCChain();
this.chain.chainManager.init().then(() => {
console.log('wallet init')
chain.chainManager.init().then(() => {
console.log('header wallet init')
})
},
methods: {
logout() {
chain.logout();
}
}
};

View File

@ -9,8 +9,9 @@
src="../../assets/mobile/portrait.png"
alt=""
/>
<span class="text">{{address}}</span>
</div>
<div class="text">{{ account }}</div>
</div>
<div class="twitter-btn">
<div>
@ -19,9 +20,9 @@
src="../../assets/mobile/twitter.png"
alt=""
/>
<span class="text"> {{ userinfo.twitter }}</span>
<span class="text">@{{twitter}}</span>
</div>
<!-- <div ></div> -->
</div>
<div class="discard-btn">
<div>
@ -30,8 +31,9 @@
src="../../assets/mobile/discard.png"
alt=""
/>
<span class="text"> {{ userinfo.discord }}</span>
<span class="text">{{discord}}</span>
</div>
</div>
</div>
<div class="switch">
@ -177,9 +179,12 @@ export default {
data() {
return {
userinfo: {},
listevent: [],
listevent: null,
currentIndex: 0,
account: "",
account: '',
discord: '',
twitter: '',
address: '',
time: {},
endTime: "2022-11-20 18:00:00",
flag: false,
@ -199,13 +204,16 @@ export default {
if (!this.$store.state.account) {
return;
}
this.address = this.formatAddress(this.$store.state.account)
this.$axios
.post(process.env.VUE_APP_API_HOST + "/aa1/user_info", {
account: this.$store.state.account,
})
.then((res) => {
console.log("成功", res.data);
console.log("success", res.data);
this.userinfo = res.data;
this.discord = res.data.discord;
this.twitter = res.data.twitter
})
.catch((err) => {
console.error(err);
@ -216,7 +224,7 @@ export default {
account: this.$store.state.account,
})
.then((res) => {
console.log("成功", res.data);
console.log("success", res.data);
this.listevent = res.data.data;
})
.catch((err) => {
@ -233,14 +241,19 @@ export default {
}, 500);
},
methods: {
loadLocalData() {
let userInfo = localStorage.getItem("userinfo");
if (userInfo) {
try {
let userData = JSON.parse(userInfo);
this.account = userData.account;
} catch (err) {}
}
formatAddress(address) {
console.log(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 "-";
}
},
navigator() {
this.$router.push("listdetails");