2024-10-27 00:26:19 +08:00
|
|
|
<!-- 我的 -->
|
|
|
|
<template>
|
|
|
|
<view class="my">
|
|
|
|
<!-- 顶部背景 -->
|
|
|
|
<view class="head-Bg">
|
|
|
|
<lwTopnav :bgColor="bgColor" lwColor="#fff" lwTitle="我的"></lwTopnav>
|
|
|
|
<view class="my-avatar">
|
2024-11-28 10:09:55 +08:00
|
|
|
<u-avatar size="130" :showSex="isLogin" :sexIcon="userMessage.gender?'woman':'man'"
|
|
|
|
:src="isLogin?avatars[userMessage.gender||0]:''"
|
2024-10-27 00:26:19 +08:00
|
|
|
@click="toShowDetail"></u-avatar>
|
2024-10-31 21:24:54 +08:00
|
|
|
<!-- :src="userMessage.avatar" -->
|
|
|
|
<text @click="toShowDetail">{{isLogin?userMessage.nickName:'请点击登录'}}</text>
|
2024-10-27 00:26:19 +08:00
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="my-detail" @click="toShowDetail">
|
|
|
|
<text>个人信息</text>
|
|
|
|
<u-icon name="arrow-right" size="28" color="#aab1c0"></u-icon>
|
|
|
|
</view>
|
2024-10-31 21:24:54 +08:00
|
|
|
<view class="login-out" v-if="isLogin" @click="loginOut">
|
2024-10-27 00:26:19 +08:00
|
|
|
退出登录
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import lwTopnav from "@/components/lw-topnav/lw-topnav";
|
2024-10-31 21:24:54 +08:00
|
|
|
import configService from '@/common/config.service';
|
2024-10-27 00:26:19 +08:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
lwTopnav
|
|
|
|
},
|
|
|
|
data(){
|
|
|
|
return{
|
2024-10-31 21:24:54 +08:00
|
|
|
userMessage: this.$store.state.vuex_token === ''?{}:JSON.parse(this.$store.state.user_message),
|
|
|
|
// avatar: '',//头像
|
2024-11-28 10:09:55 +08:00
|
|
|
// gender: 'man',// 性别-man、woman
|
2024-10-31 21:24:54 +08:00
|
|
|
isLogin: this.$store.state.vuex_token !== '',// 是否登录
|
|
|
|
avatars:[
|
|
|
|
configService.ip+"upload/20241028/82f6d605d70645a0aa30c94ee51714a3.png",
|
|
|
|
configService.ip+"upload/20241028/2cafd18a34364a70ba9bb8e0cd0ae023.png",
|
|
|
|
],
|
2024-10-27 00:26:19 +08:00
|
|
|
}
|
|
|
|
},
|
2024-11-01 23:30:43 +08:00
|
|
|
onLoad() {
|
2024-10-27 00:26:19 +08:00
|
|
|
uni.setNavigationBarTitle({
|
|
|
|
title: '我的'
|
2024-10-31 21:24:54 +08:00
|
|
|
});
|
2024-10-27 00:26:19 +08:00
|
|
|
},
|
|
|
|
methods:{
|
2024-10-31 21:24:54 +08:00
|
|
|
refresh(){
|
|
|
|
this.userMessage = this.$store.state.vuex_token === ''?{}:JSON.parse(this.$store.state.user_message);
|
|
|
|
this.isLogin = this.$store.state.vuex_token !== '';
|
|
|
|
this.$forceUpdate();
|
|
|
|
},
|
2024-10-27 00:26:19 +08:00
|
|
|
// 前往我的信息
|
|
|
|
toShowDetail(){
|
|
|
|
uni.navigateTo({
|
|
|
|
url: '/pages/my/mySetting'
|
|
|
|
})
|
2024-10-31 21:24:54 +08:00
|
|
|
},
|
|
|
|
// 登出
|
|
|
|
loginOut(){
|
|
|
|
uni.showModal({
|
|
|
|
title: '登出',
|
|
|
|
content: '是否确认退出登录?',
|
|
|
|
showCancel: true,
|
|
|
|
success: (res) => {
|
|
|
|
if (!res.confirm) return;
|
|
|
|
this.isLogin = false;
|
2024-11-28 10:09:55 +08:00
|
|
|
this.userMessage = {gender:0,nickName:'',avatar:''}
|
2024-10-31 21:24:54 +08:00
|
|
|
this.$u.vuex('vuex_token', '');
|
|
|
|
this.$u.vuex('user_message', {});
|
|
|
|
}
|
|
|
|
})
|
2024-10-27 00:26:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
.my{
|
2024-10-31 21:24:54 +08:00
|
|
|
// background-color: #f9f9f9;
|
2024-10-27 00:26:19 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
flex-direction: column;
|
2024-10-31 21:24:54 +08:00
|
|
|
// height: max-content;
|
2024-10-27 00:26:19 +08:00
|
|
|
.head-Bg{
|
|
|
|
height: 500rpx;
|
|
|
|
top: 0rpx;
|
|
|
|
left: 0rpx;
|
|
|
|
z-index: 1;
|
|
|
|
width: 100%;
|
|
|
|
background-color: #FFFFFF;
|
|
|
|
overflow: hidden;
|
|
|
|
background: -webkit-linear-gradient( 190deg, #4BACFF 0%, rgba(255,255,255,0.77) 100%);
|
|
|
|
background: linear-gradient( 190deg, #4BACFF 0%, rgba(255,255,255,0.77) 100%);
|
|
|
|
border-radius: 0% 0% 50% 50% / 0% 0% 20% 20%;
|
|
|
|
}
|
|
|
|
.my-avatar{
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
flex-direction: column;
|
|
|
|
margin-top: 30rpx;
|
|
|
|
text{
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
font-weight: 600;
|
|
|
|
margin-top: 20rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.my-detail{
|
|
|
|
margin-top: -70rpx;
|
|
|
|
border-radius: 12rpx;
|
|
|
|
z-index: 2;
|
|
|
|
width: 85%;
|
|
|
|
height: 130rpx;
|
|
|
|
color: #000;
|
|
|
|
background-color: #fff;
|
|
|
|
font-size: 30rpx;
|
|
|
|
display: flex;
|
|
|
|
justify-content: space-between;
|
|
|
|
align-items: center;
|
|
|
|
padding: 20rpx;
|
|
|
|
box-shadow: 0px 7px 30px 0px rgba(100, 100, 111, 0.2);
|
|
|
|
}
|
|
|
|
.login-out{
|
|
|
|
position: absolute;
|
|
|
|
box-shadow: 0px 5px 9px 0px rgba(100, 100, 111, 0.2);
|
2024-10-31 21:24:54 +08:00
|
|
|
bottom: 15%;
|
2024-10-27 00:26:19 +08:00
|
|
|
width: 85%;
|
|
|
|
border-radius: 80rpx;
|
|
|
|
border: 2rpx solid #ff2e0a;
|
|
|
|
height: 90rpx;
|
|
|
|
color: #ff2e0a;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
background-color: #fff;
|
|
|
|
font-size: 34rpx;
|
2024-11-28 10:09:55 +08:00
|
|
|
&:active{
|
|
|
|
filter: opacity(0.8);
|
|
|
|
}
|
2024-10-27 00:26:19 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|