zhenghy

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

@@ -15,7 +15,7 @@ import { DisplayDirection } from 'wdConstant/Index'; @@ -15,7 +15,7 @@ import { DisplayDirection } from 'wdConstant/Index';
15 import { window } from '@kit.ArkUI'; 15 import { window } from '@kit.ArkUI';
16 import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index'; 16 import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index';
17 import { DateTimeUtils } from 'wdKit/Index'; 17 import { DateTimeUtils } from 'wdKit/Index';
18 -import {TrackConstants,TrackingPageBrowse } from 'wdTracking/Index'; 18 +import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
19 19
20 interface loadMoreData { 20 interface loadMoreData {
21 pageNum: number; 21 pageNum: number;
@@ -61,17 +61,17 @@ export struct VideoChannelDetail { @@ -61,17 +61,17 @@ export struct VideoChannelDetail {
61 @State totalCount: number = 0 61 @State totalCount: number = 0
62 @State isMouted: boolean = false 62 @State isMouted: boolean = false
63 @State isRequestError: boolean = false 63 @State isRequestError: boolean = false
64 - pageShowTime:number = 0;  
65 - pageHideTime:number = 0; 64 + @State isRequesting: boolean = false
  65 + pageShowTime: number = 0;
  66 + pageHideTime: number = 0;
66 67
67 autoRefreshChange() { 68 autoRefreshChange() {
68 - if (this.topNavIndex === 0) { 69 + if (this.topNavIndex === 0 && !this.isRequesting) {
69 this.data = [] 70 this.data = []
70 this.interactDataList = [] 71 this.interactDataList = []
71 this.totalCount = 0 72 this.totalCount = 0
72 this.isMouted = false 73 this.isMouted = false
73 this.getRecCompInfo() 74 this.getRecCompInfo()
74 - this.getRecCompInfo()  
75 } 75 }
76 76
77 } 77 }
@@ -95,8 +95,9 @@ export struct VideoChannelDetail { @@ -95,8 +95,9 @@ export struct VideoChannelDetail {
95 console.log(TAG, '一级视频隐藏') 95 console.log(TAG, '一级视频隐藏')
96 this.pageHideTime = DateTimeUtils.getTimeStamp() 96 this.pageHideTime = DateTimeUtils.getTimeStamp()
97 let duration = 0 97 let duration = 0
98 - duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000)  
99 - TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration) 98 + duration = Math.floor((this.pageHideTime - this.pageShowTime) / 1000)
  99 + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,
  100 + TrackConstants.PageName.Customer_Personal, duration)
100 } 101 }
101 102
102 /** 103 /**
@@ -187,7 +188,7 @@ export struct VideoChannelDetail { @@ -187,7 +188,7 @@ export struct VideoChannelDetail {
187 AlertDialog.show({ message: '没有更多视频了~' }) 188 AlertDialog.show({ message: '没有更多视频了~' })
188 return 189 return
189 } 190 }
190 - 191 + this.isRequesting = true
191 const params: getRecCompInfoParams = { 192 const params: getRecCompInfoParams = {
192 groupId: this.groupId, 193 groupId: this.groupId,
193 pageId: this.pageId, 194 pageId: this.pageId,
@@ -237,6 +238,7 @@ export struct VideoChannelDetail { @@ -237,6 +238,7 @@ export struct VideoChannelDetail {
237 }).catch(() => { 238 }).catch(() => {
238 // 获取内容失败请重试 239 // 获取内容失败请重试
239 this.isRequestError = true 240 this.isRequestError = true
  241 + this.isRequesting = false
240 }) 242 })
241 } 243 }
242 244
@@ -251,7 +253,14 @@ export struct VideoChannelDetail { @@ -251,7 +253,14 @@ export struct VideoChannelDetail {
251 this.data = this.data.concat(res.data) 253 this.data = this.data.concat(res.data)
252 } 254 }
253 console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data)) 255 console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
  256 + }).finally(() => {
  257 + setTimeout(() => {
  258 + this.isRequesting = false
  259 + }, 2000)
  260 +
254 }) 261 })
  262 + } else {
  263 + this.isRequesting = false
255 } 264 }
256 } 265 }
257 266
@@ -268,6 +277,7 @@ export struct VideoChannelDetail { @@ -268,6 +277,7 @@ export struct VideoChannelDetail {
268 }) 277 })
269 } 278 }
270 } 279 }
  280 +
271 build() { 281 build() {
272 Column() { 282 Column() {
273 if (this.isRequestError) { 283 if (this.isRequestError) {