This commit is contained in:
Gdpao
2020-08-07 19:56:47 +08:00
parent 71e984b2ed
commit 502e020000
17 changed files with 238 additions and 136 deletions

View File

@@ -20,20 +20,21 @@
</view>
<swiper class="card" @change="dianji" :current="num">
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
<scroll-view style="width:100%;height:100%" scroll-y="true" lower-threshold="200" @scrolltolower="swiperBottom">
<view class="box">
<!-- <indexad style="width:690rpx"></indexad> -->
<u-swiper mode="dot" :list="indexImageSwiper" name="adv_code" @click="clickFImage"></u-swiper>
<view class="list">
<view>
<videoItem v-for="item in articleList.filter((_, index) => !(index&1))" :key="item.article_id" :item="item"
<videoItem v-for="(item,id) in articleList.filter((_, index) => !(index&1))" :key="id" :item="item"
@getArticlelist="getArticlelist"></videoItem>
</view>
<view style="margin-left:20rpx">
<videoItem v-for="item in articleList.filter((_, index) => index&1)" :key="item.article_id" :item="item"
<videoItem v-for="(item,id) in articleList.filter((_, index) => index&1)" :key="id" :item="item"
@getArticlelist="getArticlelist"></videoItem>
</view>
</view>
<u-loadmore :status="status" icon-type="iconType" margin-top="50" margin-bottom="50" :load-text="loadText" />
</view>
</scroll-view>
</swiper-item>
@@ -55,7 +56,7 @@
</scroll-view>
</swiper-item>
<swiper-item>
<scroll-view style="width:100%;height:100%" scroll-y="true">
<scroll-view style="width:100%;height:100%" scroll-y="true" @scrolltolower="followBotton" lower-threshold="200">
<view class="box">
<view class="tuijian">
<view class="title" @click="toSearchPage">
@@ -74,9 +75,11 @@
<view class="rec-list">
<view class="rec-box">
<!-- {{ fansList }} -->
<videoItem isguanzhu="true" v-for="item in fansList" :key="item.article_id"
:item="item"></videoItem>
<view class="no-data" v-show="!fansList.length">您还没有关注哦赶紧去点点关注</view>
<view class="item">
<videoItem isguanzhu="true" v-for="(item,id) in fansList" :key="id" :item="item"></videoItem>
</view>
<view class="no-data" v-if="!fansList.length">您还没有关注哦赶紧去点点关注</view>
<u-loadmore v-else :status="status_1" icon-type="iconType" margin-top="50" margin-bottom="50" :load-text="loadText" />
</view>
</view>
</view>
@@ -182,15 +185,19 @@
.rec-list {
width: 100%;
.rec-box {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.no-data {
margin: 200rpx auto 0;
width: 100%;
.item {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
}
}
}
.no-data {
margin: 200rpx auto 0;
text-align: center;
}
</style>
<script>
import { mapState } from 'vuex'
@@ -215,12 +222,21 @@
}],
num: 0,
page: 0, // 0即第一页
follow_page: 0, //
articleList: [],
recommendList: [], // 推荐达人
indexImageSwiper: [],
zhiboImageSwiper: [],
tabLiveLists: [],
fansList: [], // 关注的发现列表
status: 'loadmore',
status_1: 'loadmore',
iconType: 'circle',
loadText: {
loadmore: '轻轻上拉',
loading: '努力加载中',
nomore: '实在没有了'
}
}
},
components: {
@@ -230,6 +246,8 @@
darenItem
},
onShow() {
this.articleList = [];
this.page = 0;
this.getArticlelist();
this.getSwiper();
},
@@ -260,8 +278,9 @@
this.$u.api.attentionMember({
member_id: member_id
}).then((res) => {
console.log(res)
this.getRecommendList();
console.log(res);
this.follow_page = 0;
this.getRecommendList(); // 关注列表
this.getFollowList(); // 刷新发现的列表
})
},
@@ -282,12 +301,16 @@
}
// 状态请求
if (this.num == 0) {
this.page = 0;
this.status = "loadmore";
this.getArticlelist();
this.getSwiper();
} else if (this.num == 1) {
this.getZhiBoSwiper(); // 直播轮播
this.tabLiveList();
} else if (this.num == 2) {
this.follow_page = 0;
this.status = "loadmore";
if (this.hasLogin) {
this.getFollowList(); // 关注列表
}
@@ -300,13 +323,33 @@
page: this.page,
is_video_img: 0, // 查询视频1 图文2 都查0
}).then(res => {
// uni.stopPullDownRefresh();
// console.log('37647744ghj', res)
if (res.errCode == 0) {
this.articleList = res.data.list;
}
this.status = "loading";
if (res.errCode == 0) {
// uni.stopPullDownRefresh();
// console.log('37647744ghj', res)
if (this.page == 0) {
this.articleList = res.data.list;
this.status = "loadmore";
} else if (res.data.length == 0 && this.page > 0) {
this.status = "nomore";
} else {
this.articleList = this.articleList.concat(res.data.list);
}
this.page++;
} else {
this.status = "nomore"
}
})
},
// 发现下拉加载
swiperBottom(e) {
this.getArticlelist();
// console.log(e);
},
followBotton(e) {
this.getFollowList();
// console.log(e);
},
// 达人列表
getRecommendList() {
this.$u.api.getRecommendList().then(res => {
@@ -319,12 +362,24 @@
// 关注发现列表
getFollowList() {
this.$u.post("article/attentionArticleList",{
page: 0,
page: this.follow_page,
}).then(res => {
this.status_1 = "loading";
if (res.errCode == 0) {
this.fansList = res.data.list;
// uni.stopPullDownRefresh();
// console.log('37647744ghj', res)
if (this.follow_page == 0) {
this.fansList = res.data.list;
this.status_1 = "loadmore";
} else if (res.data.list.length == 0 && this.follow_page > 0) {
this.status_1 = "nomore";
} else {
this.fansList = this.fansList.concat(res.data.list);
}
this.follow_page++;
} else {
this.status_1 = "nomore"
}
// console.log(res);
})
},
toSearchPage() {