视频列表的上拉刷新

This commit is contained in:
THK3121 2023-06-02 16:51:36 +08:00
parent ef90cf2e9b
commit ea85ebbfa9

View File

@ -87,7 +87,7 @@
</view>
</view>
<view v-if="list.relevance.length == 1 && k===index" class="product">
<scroll-view scroll-x="true" style="white-space: nowrap; display: flex;"
<scroll-view scroll-x="true" style="white-space: nowrap; display: flex;"
scroll-with-animation show-scrollbar="true">
<view class="product-item" v-for="(goods,idx) in list.relevance" :key="idx"
v-if="goods.spu">
@ -203,8 +203,8 @@
</swiper-item>
</swiper>
<scroll-view scroll-y="true" v-if="currentNav === 3" class="video-list"
:style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;'">
<block v-for="(item,index) in cateGoods" :key="item.uid">
:style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;'" :refresher-triggered="isTriggered" @scrolltolower="GetList()" >
<block v-for="(item,index) in cateGoods" :key="index">
<view class="goods_item" @click="gogogo(item)">
<image class="goods_img" :src="item.image[0]" mode="aspectFill"></image>
<view class="botm">
@ -320,6 +320,7 @@
}, mapGetters(['isLogin', 'uid'])),
data() {
return {
isTriggered:false,
imgHost: HTTP_REQUEST_URL,
videoID: 0,
pinlunNum: 0,
@ -422,6 +423,7 @@
}
},
onLoad(options) {
console.log(options);
this.getOptions(options);
this.videoID = options.id;
this.isUser = options.user == 1 ? true : false;
@ -446,6 +448,18 @@
},
onReady: function() {},
methods: {
async GetList(){
console.log('123');
const {data} = await graphicLstApi({
page: this.page++,
limit: this.limit,
is_star: this.isSatrt,
community_id: this.videoID
})
console.log(data);
this.cateGoods.push(...data.list)
},
giveStart(item) {
let status = item.relevance_id ? 0 : 1
graphicStartApi(item.community_id, {
@ -489,7 +503,6 @@
this.loadVideo = true;
this.dataList = [];
n == 1 ? this.get() : '';
n == 2 ? this.getFocusList() : '';
n == 3 ? this.getGoods() : '';
},
/**
@ -691,6 +704,9 @@
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()
}
},
//每一组结束时新的请求
@ -698,36 +714,55 @@
let that = this
if (!that.loadVideo) return
that.loadVideo = true
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
});
}) :
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
});
})
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
});
}) :
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() {
let that = this