deming/components/index/daren-item/index.vue

100 lines
2.2 KiB
Vue
Raw Normal View History

2020-06-02 11:14:51 +08:00
<template>
2020-08-05 21:06:29 +08:00
<view class="daren-item">
<image class="head" @click="toDetailsPage" :src="info.member_avatar"></image>
2020-06-30 18:06:50 +08:00
<text class="name">{{ info.member_nickname }}</text>
<text class="zhuangtai">状态: {{ info.live_status == 1 ? '正在直播' : '未开播' }}</text>
2020-08-04 22:34:03 +08:00
<view class="guanzhu action" @tap="changeType(info.member_id)" v-if="info.is_attention == 1">已关注</view>
<view class="guanzhu" @tap="changeType(info.member_id)" v-else >未关注</view>
2020-06-02 11:14:51 +08:00
</view>
</template>
<script>
2020-08-05 21:06:29 +08:00
import { mapState } from 'vuex';
2020-06-02 11:14:51 +08:00
export default {
2020-06-30 18:06:50 +08:00
name:"daren-item",
props: {
info: Object,
2020-07-01 17:32:36 +08:00
},
2020-08-05 21:06:29 +08:00
computed: {
...mapState(["login","hasLogin"]),
},
watch: {
info(newVal, old) {
// console.log(newVal);
},
deep: true
},
2020-07-01 17:32:36 +08:00
methods: {
toDetailsPage() {
2020-08-05 21:06:29 +08:00
// console.log();
if (this.hasLogin) {
this.$u.route({
url: "/pageB/details/index",
params: {
id: this.info.member_id
}
});
2020-07-18 19:52:47 +08:00
}else{
uni.navigateTo({
url: '/pageA/login/login'
})
}
// this.$u.route({
// url: '',
// params: {
// name: 'lisa'
// }
// })
2020-07-01 17:32:36 +08:00
},
2020-07-18 19:52:47 +08:00
changeType:function(type){
2020-08-05 21:06:29 +08:00
// console.log("111")
this.$emit("pChangeType",type);
2020-07-18 19:52:47 +08:00
},
2020-07-01 17:32:36 +08:00
},
2020-06-02 11:14:51 +08:00
}
</script>
<style lang="scss" scoped>
.daren-item{
width: 215rpx;
height: 282rpx;
display: flex;
flex-direction: column;
align-items: center;
background-color: #fff;
border-radius: 10rpx;
overflow: hidden;
.head{
width: 80rpx;
height: 80rpx;
border-radius: 50%;
margin-top: 24rpx;
2020-08-06 20:42:03 +08:00
background-color: #0077AA;
2020-06-02 11:14:51 +08:00
}
.name{
font-size: 26rpx;
color: #333;
font-weight: 400;
margin-top: 23rpx;
}
.zhuangtai{
font-size:22rpx;
color: #999;
margin-top: 19rpx;
}
.guanzhu{
width: 130rpx;
height: 50rpx;
background-color: #FF780F;
font-size: 26rpx;
line-height: 50rpx;
color: #fff;
text-align: center;
margin-top: 19rpx;
border-radius: 25rpx;
}
2020-07-20 17:14:18 +08:00
.action{
background: #f3f3f3;
2020-08-04 22:34:03 +08:00
color: #FF780F;
2020-07-20 17:14:18 +08:00
}
2020-06-02 11:14:51 +08:00
}
</style>