修改视频列表的错误

This commit is contained in:
luofei 2023-06-03 11:12:28 +08:00
parent 205176ee94
commit 854788c1a7

View File

@ -203,7 +203,7 @@
</swiper-item> </swiper-item>
</swiper> </swiper>
<scroll-view scroll-y="true" v-if="currentNav === 3" class="video-list" <scroll-view scroll-y="true" v-if="currentNav === 3" class="video-list"
:style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;'" :refresher-triggered="isTriggered" @scrolltolower="GetList()" > :style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;'" :refresher-triggered="isTriggered" @scrolltolower="getGoods()" >
<block v-for="(item,index) in cateGoods" :key="index"> <block v-for="(item,index) in cateGoods" :key="index">
<view class="goods_item" @click="gogogo(item)"> <view class="goods_item" @click="gogogo(item)">
<image class="goods_img" :src="item.image[0]" mode="aspectFill"></image> <image class="goods_img" :src="item.image[0]" mode="aspectFill"></image>
@ -388,10 +388,11 @@
where: { where: {
category_id: -1, category_id: -1,
page: 1, page: 1,
limit: 10 limit: 5
}, },
communityId:'', communityId:'',
Listcount:'' Listcount:'',
loadMore: true,
} }
}, },
watch: { watch: {
@ -426,7 +427,6 @@
} }
}, },
onLoad(options) { onLoad(options) {
console.log(options);
this.getOptions(options); this.getOptions(options);
this.videoID = options.id; this.videoID = options.id;
this.isUser = options.user == 1 ? true : false; this.isUser = options.user == 1 ? true : false;
@ -451,27 +451,6 @@
}, },
onReady: function() {}, onReady: function() {},
methods: { methods: {
async GetList(){
// if(this.cateGoods.length > )
console.log(this.Listcount);
if(this.cateGoods.length < this.Listcount){
console.log('123');
const {data} = await graphicLstApi({
category_id:-1,
page: this.page++,
limit: this.limit,
})
this.cateGoods.push(...data.list)
if(data.list.length < this.limit){
this.$util.Tips({
title: '没有更多了',
});
}
}
// console.log(this.cateGoods.length);
},
giveStart(item) { giveStart(item) {
let status = item.relevance_id ? 0 : 1 let status = item.relevance_id ? 0 : 1
graphicStartApi(item.community_id, { graphicStartApi(item.community_id, {
@ -514,6 +493,7 @@
this.page = 1; this.page = 1;
this.loadVideo = true; this.loadVideo = true;
this.dataList = []; this.dataList = [];
this.loadMore = true;
n == 1 ? this.get() : ''; n == 1 ? this.get() : '';
n == 2 ? this.getFocusList() : ''; n == 2 ? this.getFocusList() : '';
n == 3 ? this.getGoods() : ''; n == 3 ? this.getGoods() : '';
@ -528,12 +508,17 @@
this.navTap(1) this.navTap(1)
}, },
async getGoods() { async getGoods() {
if (!this.loadMore) {
return;
}
const { const {
data data
} = await graphicLstApi(this.where) } = await graphicLstApi(this.where)
console.log(data); this.cateGoods.push(...data.list)
this.Listcount=data.count this.where.page++
this.cateGoods = data.list if(data.list.length < this.where.limit){
this.loadMore = false
}
}, },
/** /**
* 获取个人用户信息 * 获取个人用户信息
@ -713,68 +698,15 @@
this.communityId = this.dataList[this.k]['community_id']; this.communityId = this.dataList[this.k]['community_id'];
}, },
animationfinish(event) { animationfinish(event) {
// 1.这里进行判断,如果是最后一个视频就进入 get() 方法加载视频进入列表
if (this.k == this.dataList.length - 1 && this.currentNav !== 2) {
this.loadVideo = true;
this.GET()
}else if(this.currentNav == 2){
this.loadVideo = true
this.getFocusList()
}
},
//每一组结束时新的请求
GET() {
let that = this let that = this
if (!that.loadVideo) return if (!that.loadVideo || !that.loadMore) return
that.loadVideo = true if (this.k == this.dataList.length - 1 && this.currentNav === 1) {
if(this.currentNav !== 2 ){ that.loadVideo = false
that.isUser ? this.get()
myVideoList(that.userUid, { }
page: that.page, if (this.k == this.dataList.length - 1 && this.currentNav === 2) {
limit: that.limit, that.loadVideo = false
is_star: that.isSatrt, this.getFocusList()
community_id: that.videoID
}).then(res => {
that.videoData(res.data.list)
that.loadVideo = false
}).catch(err => {
return uni.showToast({
title: err,
icon: 'none',
duration: 2000
});
}) :
videoList({
page: that.page,
limit: that.limit,
id: that.videoID
}).then(res => {
that.loadVideo = false
that.videoData(res.data.list)
}).catch(err => {
return uni.showToast({
title: err,
icon: 'none',
duration: 2000
});
})
}else if(this.currentNav == 2 ){
that.isUser ?
myVideoList(that.userUid, {
page: that.page,
limit: that.limit,
is_star: that.isSatrt,
community_id: that.videoID
}).then(res => {
that.videoData(res.data.list)
that.loadVideo = false
}).catch(err => {
return uni.showToast({
title: err,
icon: 'none',
duration: 2000
});
}) : this.getFocusList()
} }
}, },
get() { get() {
@ -787,8 +719,10 @@
is_star: that.isSatrt, is_star: that.isSatrt,
community_id: that.videoID community_id: that.videoID
}).then(res => { }).then(res => {
console.log(res);
that.videoData(res.data.list) that.videoData(res.data.list)
if (res.data.list.length < that.limit) {
this.loadMore = false;
}
}).catch(err => { }).catch(err => {
return uni.showToast({ return uni.showToast({
title: err, title: err,
@ -802,6 +736,9 @@
id: that.videoID id: that.videoID
}).then(res => { }).then(res => {
that.videoData(res.data.list) that.videoData(res.data.list)
if (res.data.list.length < that.limit) {
this.loadMore = false;
}
}).catch(err => { }).catch(err => {
return uni.showToast({ return uni.showToast({
title: err, title: err,
@ -809,26 +746,20 @@
duration: 2000 duration: 2000
}); });
}) })
that.loadVideo = true
}, },
getFocusList() { getFocusList() {
let that = this; let that = this;
if (!that.loadVideo) return
that.loadVideo = true
focusArticleLst({ focusArticleLst({
page: that.page, page: that.page,
limit: that.limit, limit: that.limit,
type: 2 type: 2
}).then(res => { }).then(res => {
console.log(res); that.loadVideo = true
that.loadVideo = false
// const arr=[]
// res.data.list.forEach(item=>{
// if(item.is_type == '2'){
// return arr.push(item)
// }
// })
// this.limit=arr.length
that.videoData(res.data.list) that.videoData(res.data.list)
if (res.data.list.length < that.limit) {
this.loadMore = false;
}
}).catch(err => { }).catch(err => {
return uni.showToast({ return uni.showToast({
title: err, title: err,