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

View File

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