deming/pageB/components/details/userinfo.vue

169 lines
5.0 KiB
Vue
Raw Normal View History

2020-06-03 02:53:38 +00:00
<template>
<view class="userinfo">
<view class="user">
<view class="info">
2020-08-05 13:06:29 +00:00
<view class="avatar">
2020-08-06 12:42:03 +00:00
<image :src="item.member_avatar" mode="aspectFill"></image>
2020-08-15 10:03:52 +00:00
<view class="posi-type" v-if="item.live_status != 0" @click="tozhibo">
2020-08-06 12:42:03 +00:00
<view>
<u-icon name="play-right-fill" color="#fff" size="20rpx"></u-icon>
</view>
<text>正在直播</text>
</view>
2020-08-05 13:06:29 +00:00
</view>
<view class="box">
<view class="name">{{ item.member_nickname }}</view>
<view class="num">
<text>粉丝数{{ item.fans_num }}</text>
<text>评论数{{ item.comment_num }}</text>
</view>
2020-06-03 02:53:38 +00:00
</view>
</view>
2020-08-05 13:06:29 +00:00
<view class="btn" :class="[ is_follow ? 'btn-follow' : 'btn-unfollow' ]" @click="following">{{ is_follow ? "已关注" : "关注" }}</view>
2020-06-03 02:53:38 +00:00
</view>
2020-08-05 13:06:29 +00:00
<view class="profile" :class="{'u-line-2': is_open }" @click="openPro">
个性签名{{ item.recommend ? item.recommend : "对方很懒没有留下任何东西~~" }}
</view>
2020-06-03 02:53:38 +00:00
</view>
</template>
<style lang="scss" scoped>
.userinfo{
width: 100%;
2020-08-05 13:06:29 +00:00
// height: 261rpx;
2020-06-03 02:53:38 +00:00
padding: 30rpx;
.user{
display: flex;
margin-top: 10rpx;
align-items: center;
justify-content: space-between;
.info{
display: flex;
align-items: center;
2020-08-05 13:06:29 +00:00
.avatar {
2020-08-06 12:42:03 +00:00
position: relative;
2020-08-05 13:06:29 +00:00
&>image{
2020-08-06 12:42:03 +00:00
z-index: 99;
2020-08-05 13:06:29 +00:00
width: 140rpx;
height: 140rpx;
border-radius: 50%;
}
2020-08-06 12:42:03 +00:00
.posi-type {
z-index: 100;
position: absolute;
bottom: 0;
left: 0;
display: flex;
align-items: center;
border-radius: 30rpx;
background-color: rgba(0,0,0,0.3);
& > view {
width: 40rpx;
height: 40rpx;
flex-shrink: 0;
text-align: center;
line-height: 30rpx;
border-radius: 50%;
background-color: rgba(0,0,0,0.5);
}
& > text {
padding: 0 12rpx 0 6rpx;
color: #FF3131;
height: 40rpx;
line-height: 40rpx;
font-size: 20rpx;
}
}
2020-06-03 02:53:38 +00:00
}
2020-08-05 13:06:29 +00:00
.box {
2020-06-03 02:53:38 +00:00
display: flex;
justify-content: space-between;
flex-direction: column;
2020-08-05 13:06:29 +00:00
height: 79rpx;
margin-left: 40rpx;
color: #333;
.name {
2020-06-03 02:53:38 +00:00
font-size: 28rpx;
}
2020-08-05 13:06:29 +00:00
.num {
2020-06-03 02:53:38 +00:00
font-size: 24rpx;
2020-08-05 13:06:29 +00:00
& > :first-child {
margin-right: 20rpx;
}
2020-06-03 02:53:38 +00:00
}
}
}
2020-08-05 13:06:29 +00:00
.btn{
2020-06-03 02:53:38 +00:00
width: 140rpx;
height: 60rpx;
font-size: 26rpx;
line-height: 60rpx;
2020-08-05 13:06:29 +00:00
text-align: center;
color:#fff;
2020-06-03 02:53:38 +00:00
border-radius: 30rpx;
2020-08-05 13:06:29 +00:00
}
.btn-follow {
2020-08-06 12:42:03 +00:00
background-color: #999999;
2020-08-05 13:06:29 +00:00
}
.btn-unfollow {
2020-06-03 02:53:38 +00:00
background-color: #FF780F;
}
}
.profile{
2020-08-05 13:06:29 +00:00
margin-top: 20rpx;
2020-06-03 02:53:38 +00:00
font-size: 24rpx;
color: #333;
2020-08-05 13:06:29 +00:00
line-height: 1.2;
2020-06-03 02:53:38 +00:00
}
}
</style>
<script>
export default {
name:"userinfo",
2020-08-05 13:06:29 +00:00
props: ["list"],
2020-06-03 02:53:38 +00:00
data(){
return {
2020-08-05 13:06:29 +00:00
item: {},
is_open: true,
is_follow: false,
}
},
watch: {
list(newVal, old) {
// console.log(newVal);
this.item = newVal;
this.is_follow = newVal.is_attention;
},
deep: true
},
methods: {
2020-08-15 10:03:52 +00:00
tozhibo(){
this.$u.route({
url:"/pages/zhibo/index",
params:{
url:item.url,
id:item.live_id,
rid:item.chatroom_id
}
})
},
2020-08-05 13:06:29 +00:00
// 打开个性
openPro() {
this.is_open = !this.is_open;
},
// 关注
following() {
this.$u.api.attentionMember({
member_id: this.item.member_id
}).then(res => {
console.log(res);
if (res.errCode == 0) {
this.is_follow = !this.is_follow;
this.$u.toast(res.message);
} else {
this.$u.toast(res.message);
}
})
2020-06-03 02:53:38 +00:00
}
}
}
</script>