视频列表的上拉刷新

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> </view>
<view v-if="list.relevance.length == 1 && k===index" class="product"> <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"> scroll-with-animation show-scrollbar="true">
<view class="product-item" v-for="(goods,idx) in list.relevance" :key="idx" <view class="product-item" v-for="(goods,idx) in list.relevance" :key="idx"
v-if="goods.spu"> v-if="goods.spu">
@ -203,8 +203,8 @@
</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;'"> :style="'width: '+ windowWidth +'px; height: '+ windowHeight +'px;'" :refresher-triggered="isTriggered" @scrolltolower="GetList()" >
<block v-for="(item,index) in cateGoods" :key="item.uid"> <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>
<view class="botm"> <view class="botm">
@ -320,6 +320,7 @@
}, mapGetters(['isLogin', 'uid'])), }, mapGetters(['isLogin', 'uid'])),
data() { data() {
return { return {
isTriggered:false,
imgHost: HTTP_REQUEST_URL, imgHost: HTTP_REQUEST_URL,
videoID: 0, videoID: 0,
pinlunNum: 0, pinlunNum: 0,
@ -422,6 +423,7 @@
} }
}, },
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;
@ -446,6 +448,18 @@
}, },
onReady: function() {}, onReady: function() {},
methods: { 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) { giveStart(item) {
let status = item.relevance_id ? 0 : 1 let status = item.relevance_id ? 0 : 1
graphicStartApi(item.community_id, { graphicStartApi(item.community_id, {
@ -489,7 +503,6 @@
this.loadVideo = true; this.loadVideo = true;
this.dataList = []; this.dataList = [];
n == 1 ? this.get() : ''; n == 1 ? this.get() : '';
n == 2 ? this.getFocusList() : '';
n == 3 ? this.getGoods() : ''; n == 3 ? this.getGoods() : '';
}, },
/** /**
@ -691,6 +704,9 @@
if (this.k == this.dataList.length - 1 && this.currentNav !== 2) { if (this.k == this.dataList.length - 1 && this.currentNav !== 2) {
this.loadVideo = true; this.loadVideo = true;
this.GET() this.GET()
}else if(this.currentNav == 2){
this.loadVideo = true
this.getFocusList()
} }
}, },
//每一组结束时新的请求 //每一组结束时新的请求
@ -698,36 +714,55 @@
let that = this let that = this
if (!that.loadVideo) return if (!that.loadVideo) return
that.loadVideo = true that.loadVideo = true
that.isUser ? if(this.currentNav !== 2 ){
myVideoList(that.userUid, { that.isUser ?
page: that.page, myVideoList(that.userUid, {
limit: that.limit, page: that.page,
is_star: that.isSatrt, limit: that.limit,
community_id: that.videoID is_star: that.isSatrt,
}).then(res => { community_id: that.videoID
that.videoData(res.data.list) }).then(res => {
that.loadVideo = false that.videoData(res.data.list)
}).catch(err => { that.loadVideo = false
return uni.showToast({ }).catch(err => {
title: err, return uni.showToast({
icon: 'none', title: err,
duration: 2000 icon: 'none',
}); duration: 2000
}) : });
videoList({ }) :
page: that.page, videoList({
limit: that.limit, page: that.page,
id: that.videoID limit: that.limit,
}).then(res => { id: that.videoID
that.loadVideo = false }).then(res => {
that.videoData(res.data.list) that.loadVideo = false
}).catch(err => { that.videoData(res.data.list)
return uni.showToast({ }).catch(err => {
title: err, return uni.showToast({
icon: 'none', title: err,
duration: 2000 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() {
let that = this let that = this