deming/pageE/mine/MineConcerns.vue

167 lines
4.1 KiB
Vue
Raw Normal View History

2020-06-08 07:23:23 +00:00
<template>
<view class="concerns">
2020-08-15 09:16:11 +00:00
<view class="tabs-top u-border-bottom">
<u-tabs ref="uTabs" :show-bar="false" :list="list" font-size="32" :current="current" @change="tabsChange" :is-scroll="false"
swiperWidth="750" active-color="#FF780F"></u-tabs>
2020-08-03 10:38:04 +00:00
</view>
2020-08-15 09:16:11 +00:00
<scroll-view v-if="current==0" scroll-y style="height: 100%;width: 100%;" class="store" @scrolltolower="onreachBottom">
<storeViwe ref="store"></storeViwe>
</scroll-view>
<scroll-view v-else scroll-y style="height: 100%;width: 100%;" @scrolltolower="onreachBottom">
<view class="concerns-container">
<view v-for="(info, index) in daren" :key="index">
<view class="daren-item">
<image class="head" :src="info.friend_tomavatar" @click="toDetailsPage({ id: info.friend_tomid })"></image>
<text class="name" @click="toDetailsPage({ id: info.friend_tomid })">{{ info.friend_tomname || '' }}</text>
<view class="guanzhu" @click="changeType(info.friend_tomid)" v-if="info.friend_followstate == 1">取消关注</view>
2020-08-14 08:51:55 +00:00
</view>
2020-08-15 09:16:11 +00:00
</view>
<u-loadmore :status="loadStatus" bg-color="#FFFFFF" v-if="daren.length > 9" @loadmore="loadmore" />
</view>
<u-empty mode="list" v-if="!daren.length" color="#000" img-width="200" font-size="30" margin-top="200"></u-empty>
</scroll-view>
2020-06-08 07:23:23 +00:00
</view>
</template>
<script>
2020-08-15 09:16:11 +00:00
import storeViwe from './storeConcerns'
2020-06-08 07:23:23 +00:00
export default {
data() {
return {
2020-09-09 01:33:08 +00:00
list: [{ name: "店铺" }, { name: "达人" }],
2020-08-15 09:16:11 +00:00
daren: [],
2020-08-14 08:51:55 +00:00
shangjia:[],
2020-08-15 09:16:11 +00:00
height: 0,
2020-08-14 08:51:55 +00:00
show: false,
2020-08-15 09:16:11 +00:00
current: 0,
page: 1,
loadStatus: 'loadmore',
timer: true,
2020-08-03 12:59:24 +00:00
}
},
2020-08-15 09:16:11 +00:00
components: {
storeViwe,
},
2020-08-03 12:59:24 +00:00
onShow() {
2020-08-15 09:16:11 +00:00
this.loadStatus = "loadmore"
this.page = 1
this.getPeopleList();
2020-08-14 08:51:55 +00:00
},
onLoad(){
2020-08-15 09:16:11 +00:00
this.setViewHeight();
2020-08-03 12:59:24 +00:00
},
methods: {
2020-08-15 09:16:11 +00:00
setViewHeight() {
const res = uni.getSystemInfoSync();
this.height = res.windowHeight - (res.windowWidth / 750 * 80) + 'px';
},
2020-08-14 08:51:55 +00:00
// tabs通知swiper切换
tabsChange(index) {
2020-08-15 09:16:11 +00:00
this.current = index;
2020-08-14 08:51:55 +00:00
},
// scroll-view到底部加载更多
onreachBottom() {
2020-08-15 09:16:11 +00:00
if(this.current == 0) this.$refs.loadmore();
else if(this.current == 1) this.loadmore();
2020-08-14 08:51:55 +00:00
},
2020-08-15 09:16:11 +00:00
loadmore() {
if(!this.timer) return false;
this.timer = false;
this.loadStatus = "loading";
this.page++;
this.getPeopleList({ load: 'loadmore' }).then(length => {
this.loadStatus = "nomore";
if(length == 0) this.page--;
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
2020-08-03 12:59:24 +00:00
})
2020-08-04 13:13:47 +00:00
},
2020-08-15 09:16:11 +00:00
async getPeopleList({ load = 'reload' } = {}) {
const res = await this.$u.api.attentionMemberList({
role: 3,
page: this.page
2020-08-14 08:51:55 +00:00
})
2020-08-15 09:16:11 +00:00
this.timer = true;
if(res.errCode == 0) {
if(load == 'reload') this.daren = res.data.data;
else if(load == 'loadmore') this.daren.push(...res.data.data);
}
return res.data.data.length;
2020-08-14 08:51:55 +00:00
},
2020-08-15 09:16:11 +00:00
// 取消关注
2020-08-04 13:13:47 +00:00
changeType(id) {
2020-08-15 09:16:11 +00:00
// console.log(id);
2020-08-14 08:51:55 +00:00
this.$u.api.attentionMember({
member_id: id
}).then(res => {
this.$u.toast(res.message);
2020-08-15 09:16:11 +00:00
this.getPeopleList();
2020-08-14 08:51:55 +00:00
})
},
toDetailsPage(id) {
2020-08-15 09:16:11 +00:00
this.$u.route('pageB/details/index', {
2020-08-14 08:51:55 +00:00
id: id
});
},
2020-06-08 07:23:23 +00:00
},
};
</script>
<style lang="scss" scoped>
.concerns {
2020-08-15 09:16:11 +00:00
background-color: #FFFFFF;
.store {
background-color: #FFFFFF;
}
2020-08-03 12:59:24 +00:00
.concerns-container {
padding: 30rpx;
2020-06-08 07:23:23 +00:00
display: flex;
2020-08-03 12:59:24 +00:00
flex-wrap: wrap;
2020-08-14 08:51:55 +00:00
margin-left: -20rpx;
2020-08-18 02:20:30 +00:00
.daren-item {
2020-08-03 12:59:24 +00:00
width: 215rpx;
2020-09-11 10:47:14 +00:00
height: 270rpx;
2020-08-03 12:59:24 +00:00
display: flex;
flex-direction: column;
align-items: center;
background-color: #fff;
border-radius: 10rpx;
overflow: hidden;
2020-08-14 08:51:55 +00:00
margin-left: 20rpx;
margin-bottom: 20rpx;
2020-08-18 04:12:01 +00:00
box-shadow: 0rpx 0rpx 6rpx 0rpx rgba(35,24,21,0.12);
2020-08-03 12:59:24 +00:00
.head{
width: 80rpx;
height: 80rpx;
border-radius: 50%;
margin-top: 24rpx;
background-color: #0f0;
}
.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;
2020-08-04 13:13:47 +00:00
background-color: #EDEDED;
2020-08-03 12:59:24 +00:00
font-size: 26rpx;
line-height: 50rpx;
color: #fff;
text-align: center;
margin-top: 19rpx;
border-radius: 25rpx;
}
.action{
background: #f3f3f3;
}
2020-06-08 07:23:23 +00:00
}
}
}
</style>