84 lines
1.6 KiB
Vue
84 lines
1.6 KiB
Vue
<template>
|
|
<view class="page page-fill">
|
|
<!-- 判断是否登录更改头像 -->
|
|
<view class="header">
|
|
<view v-if="userIsLogin">
|
|
<image src="https://maomaochong.top:8088/i/2024/04/08/661380416b130.png" class="face" ></image>
|
|
</view>
|
|
<view v-else>
|
|
<image src="https://maomaochong.top:8088/i/2024/04/08/66138065e7824.png" class="face"></image>
|
|
</view>
|
|
|
|
<!-- 判断是否登录显示用户名 -->
|
|
<view class="info-wapper" v-if="userIsLogin">
|
|
<view class="nickname">
|
|
{{res.usernameCn}}
|
|
</view>
|
|
<view class="nav-info">{{res.username}}</view>
|
|
</view>
|
|
|
|
<view v-else>
|
|
<navigator url="../login/login">
|
|
<view class="nickname regist-login">
|
|
登录
|
|
</view>
|
|
</navigator>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="info-wapper" v-if="userIsLogin">
|
|
<view class="footer-wapper">
|
|
<view class="footer-words" style="margin-top: 10upx;" @click="logout">
|
|
退出登录
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
userIsLogin:false,
|
|
res : {}
|
|
}
|
|
},
|
|
onLoad() {
|
|
var res=uni.getStorageSync(
|
|
'token'
|
|
)
|
|
if(res == null ||res == "" || res == undefined){
|
|
uni.navigateBack({
|
|
delta:100
|
|
})
|
|
}
|
|
},
|
|
onShow() {
|
|
var res=uni.getStorageSync(
|
|
'token'
|
|
)
|
|
if(res!=""&&res!=null&&res!=undefined){
|
|
this.userIsLogin=true
|
|
this.res =res
|
|
}else{
|
|
this.userIsLogin=false
|
|
this.res={}
|
|
}
|
|
},
|
|
methods: {
|
|
//退出登录
|
|
logout(){
|
|
uni.clearStorageSync()
|
|
uni.navigateTo({
|
|
url:"../login/login"
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
@import url("me.css");
|
|
</style>
|