deming/pageD/attention/attention.vue

156 lines
3.3 KiB
Vue
Raw Normal View History

2020-06-11 08:43:51 +08:00
<template>
<view class="attention">
2020-08-10 16:55:45 +08:00
<view class="attention_box" v-for="(item,index) in attention" :key="index" @click="navto(item.friend_tomid)">
2020-08-11 18:27:19 +08:00
<view style="position:relative">
2020-08-06 20:42:03 +08:00
<image :src="item.friend_tomavatar" mode="aspectFill"></image>
2020-08-11 18:27:19 +08:00
<view class="tishi" v-if="item.unread_message"></view>
2020-06-11 08:43:51 +08:00
</view>
2020-08-06 20:42:03 +08:00
<view>{{item.friend_tomname}}</view>
<view>{{item.live_status ? '正在直播' : '未直播'}}</view>
2020-08-11 18:27:19 +08:00
<view class="cur_two" @click="tapClick(index)">已关注</view>
<!-- <view class="cur" @click="tapClick(index)" v-else = "item.about == 2">未关注</view> -->
2020-06-11 08:43:51 +08:00
</view>
2020-08-11 18:27:19 +08:00
<u-loadmore :status="status" icon-type="iconType" :load-text="loadText" />
2020-06-11 08:43:51 +08:00
</view>
2020-08-11 18:27:19 +08:00
2020-06-11 08:43:51 +08:00
</template>
<script>
export default {
name: "attention",
data() {
return {
rSelect:[],
type : '未关注',
2020-08-11 18:27:19 +08:00
attention: [],
page:1,
status:'loadmore'
2020-06-11 08:43:51 +08:00
};
},
2020-08-11 18:27:19 +08:00
onReachBottom(){
if(this.status == 'loading' || this.status == 'nomore'){
return ;
}else{
this.status = "loading"
this.page++
this.snsfriendList()
}
},
2020-07-09 16:35:23 +08:00
onLoad(){
this.snsfriendList()
},
2020-06-11 08:43:51 +08:00
methods: {
// 点击切换颜色
tapClick(index) {
console.log(index)
if (this.rSelect.indexOf(index) == -1) {
console.log(index) //打印下标
this.rSelect.push(index); //选中添加到数组里
} else {
this.rSelect.splice(this.rSelect.indexOf(index), 1); //取消
}
2020-07-09 16:35:23 +08:00
},
snsfriendList(){
2020-08-11 18:27:19 +08:00
this.$u.api.snsfriendList({page:this.page}).then((res)=>{
console.log(res)
if(this.page > 1){
this.attention.push(...res.data.data)
}else{
this.attention = res.data.data;
}
this.status = "loadmore"
if(res.data.data.length < 15){
this.status = "nomore"
}
2020-07-09 16:35:23 +08:00
})
2020-08-10 16:55:45 +08:00
},
navto(id){
// /pageB/details/index
this.$u.route({
url:"/pageB/details/index",
params:{
id
}
})
2020-06-11 08:43:51 +08:00
}
},
components: {
}
};
</script>
<style lang="scss" scoped>
2020-08-11 18:27:19 +08:00
.tishi{
position: absolute;
top: 5rpx;
left: 80rpx;
background-color: #ff5d00;
width: 12rpx;
height: 12rpx;
border-radius: 50%;
}
2020-06-11 08:43:51 +08:00
.attention {
display: flex;
flex-wrap: wrap;
justify-content: initial;
padding: 30rpx 30rpx 0 30rpx;
border-top: 1px #ECECEC solid;
.attention_box:nth-child(3n+3){
margin-right: 0;
}
.attention_box {
width: 215rpx;
height: 282rpx;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 3px 7px 0px rgba(153, 153, 153, 0.35);
border-radius: 10rpx;
margin-right: 24rpx;
margin-bottom: 33rpx;
float: left;
view image {
width: 80rpx;
height: 80rpx;
2020-08-06 20:42:03 +08:00
border-radius: 50%;
2020-06-11 08:43:51 +08:00
margin: 24rpx auto 0;
}
view {
text-align: center;
}
view:nth-child(2) {
font-size: 26rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
margin: 20rpx 0;
text-align: center;
}
view:nth-child(3) {
font-size: 22rpx;
font-family: PingFang SC;
font-weight: 400;
color: rgba(153, 153, 153, 1);
}
view:nth-child(4) {
width: 130rpx;
height: 50rpx;
line-height: 50rpx;
background: rgba(221, 221, 221, 1);
border-radius: 25rpx;
font-size: 26rpx;
color: rgba(255, 255, 255, 1);
margin: 19rpx auto;
}
}
}
// 选中的样式
.cur {
background-color: #ff5d00!important;
color: #fff!important;
}
</style>