wuyanan

ref |> 修复缺陷 19128-进入热点-大图卡-姜尚竖屏直播,向右滑动,点击清屏按钮,返回卡顿,清屏按钮没立马消失

... ... @@ -41,6 +41,8 @@ export struct DetailPlayVLivePage {
@Consume @Watch('closeFullScreen') pageHide: number
@Consume contentId: string
@State swiperIndex: number = 1
///是否展示清屏按钮
@State showClearButton: boolean = false
@Consume liveDetailPageLogic: LiveDetailPageLogic
@Provide lastInputedComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的消息
//播放错误
... ... @@ -198,6 +200,7 @@ export struct DetailPlayVLivePage {
playerController: this.playerController,
swiperController: this.swiperController,
swiperIndex: $swiperIndex,
showClearButton: $showClearButton
})
// 直播资源加载失败
... ... @@ -241,7 +244,7 @@ export struct DetailPlayVLivePage {
Image($r('app.media.icon_live_more'))
.width(40)
.aspectRatio(1)
.visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden)
.visibility(this.showClearButton ? Visibility.Visible : Visibility.Hidden)
.position({ x: '100%', y: '100%' })
.markAnchor({ x: 56, y: this.bottomSafeHeight })
.onClick(() => {
... ...
... ... @@ -10,9 +10,9 @@ export struct PlayerInfoComponent {
@Consume liveState: string
@Consume isShowControl: boolean
@Link swiperIndex: number
@Link showClearButton: boolean
@Provide isFullScreen: boolean = false // 判断是否全屏,全屏状态下swiper禁止切换
build() {
Column() {
Swiper(this.swiperController) {
... ... @@ -35,12 +35,23 @@ export struct PlayerInfoComponent {
this.isShowControl = !this.isShowControl
}
})
.onChange((index) => {
this.swiperIndex = index
.onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => {
this.dealShowClearButton(index,extraInfo.currentOffset)
})
.onAnimationEnd((index: number, extraInfo: SwiperAnimationEvent) => {
this.dealShowClearButton(index,extraInfo.currentOffset)
})
.disableSwipe(this.isFullScreen)
}
.height('100%')
.width('100%')
}
dealShowClearButton(index:number, currentOffset: number) {
this.swiperIndex = index
if (index == 0) {
this.showClearButton = currentOffset >= 0;
}else if (index == 1) {
this.showClearButton = false
}
}
}
\ No newline at end of file
... ...