Files
pupil/components/myAvatar/myAvatar.vue

66 lines
1.5 KiB
Vue

<template>
<view class="my_avatar">
<view style="border-radius: 50rpx;">
<u-avatar :src="avatar" size="100rpx" shape="circle"></u-avatar>
</view>
<view style="margin-top: 10rpx;margin-bottom: 4rpx;">
<u--image v-if="member=='2'" :src="normal" width="84rpx" height="30rpx">
</u--image>
<u--image v-if="member=='3'" :src="VIP" width="84rpx" height="30rpx">
</u--image>
</view>
<view style="display: flex;align-items: center;">
<text style="margin-right: 8rpx;">{{nickname}}</text>
<u--image v-if="showEdit==true" src="/static/my/wd_icon_bj.png" width="22rpx" height="22rpx"
@click="changeAvatar()">
</u--image>
</view>
</view>
</template>
<script>
export default {
name: "myAvatar",
props: {
center: {
type: String,
default: ''
}
},
data() {
return {
member: false,
showEdit: true,
avatar: '',
nickname: '',
normal: '/static/my/wo_icon_pthy.png',
VIP: '/static/my/wo_icon_vip.png',
};
},
created() {
if (this.center != false) {
this.showEdit = false
}
this.getUser()
},
methods: {
//修改头像
changeAvatar() {
uni.navigateTo({
url: '../../packageMy/changeAvatar/changeAvatar'
})
},
//获取普通会员和VIP会员
getUser() {
this.$apiServe.getUser().then(res => {
// console.log('个人信息==', res.data.data);
var data = res.data.data
this.avatar = data.avatar
this.nickname = data.nickname
this.member = data.member
}).finally(_ => {})
}
}
}
</script>