zhenghy

修复视频频道点击接口重复调用

... ... @@ -15,7 +15,7 @@ import { DisplayDirection } from 'wdConstant/Index';
import { window } from '@kit.ArkUI';
import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index';
import { DateTimeUtils } from 'wdKit/Index';
import {TrackConstants,TrackingPageBrowse } from 'wdTracking/Index';
import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
interface loadMoreData {
pageNum: number;
... ... @@ -61,17 +61,17 @@ export struct VideoChannelDetail {
@State totalCount: number = 0
@State isMouted: boolean = false
@State isRequestError: boolean = false
pageShowTime:number = 0;
pageHideTime:number = 0;
@State isRequesting: boolean = false
pageShowTime: number = 0;
pageHideTime: number = 0;
autoRefreshChange() {
if (this.topNavIndex === 0) {
if (this.topNavIndex === 0 && !this.isRequesting) {
this.data = []
this.interactDataList = []
this.totalCount = 0
this.isMouted = false
this.getRecCompInfo()
this.getRecCompInfo()
}
}
... ... @@ -95,8 +95,9 @@ export struct VideoChannelDetail {
console.log(TAG, '一级视频隐藏')
this.pageHideTime = DateTimeUtils.getTimeStamp()
let duration = 0
duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration)
duration = Math.floor((this.pageHideTime - this.pageShowTime) / 1000)
TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,
TrackConstants.PageName.Customer_Personal, duration)
}
/**
... ... @@ -187,7 +188,7 @@ export struct VideoChannelDetail {
AlertDialog.show({ message: '没有更多视频了~' })
return
}
this.isRequesting = true
const params: getRecCompInfoParams = {
groupId: this.groupId,
pageId: this.pageId,
... ... @@ -237,6 +238,7 @@ export struct VideoChannelDetail {
}).catch(() => {
// 获取内容失败请重试
this.isRequestError = true
this.isRequesting = false
})
}
... ... @@ -251,7 +253,14 @@ export struct VideoChannelDetail {
this.data = this.data.concat(res.data)
}
console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
}).finally(() => {
setTimeout(() => {
this.isRequesting = false
}, 2000)
})
} else {
this.isRequesting = false
}
}
... ... @@ -268,6 +277,7 @@ export struct VideoChannelDetail {
})
}
}
build() {
Column() {
if (this.isRequestError) {
... ...