wuyanan

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

@@ -41,6 +41,8 @@ export struct DetailPlayVLivePage { @@ -41,6 +41,8 @@ export struct DetailPlayVLivePage {
41 @Consume @Watch('closeFullScreen') pageHide: number 41 @Consume @Watch('closeFullScreen') pageHide: number
42 @Consume contentId: string 42 @Consume contentId: string
43 @State swiperIndex: number = 1 43 @State swiperIndex: number = 1
  44 + ///是否展示清屏按钮
  45 + @State showClearButton: boolean = false
44 @Consume liveDetailPageLogic: LiveDetailPageLogic 46 @Consume liveDetailPageLogic: LiveDetailPageLogic
45 @Provide lastInputedComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的消息 47 @Provide lastInputedComment: LiveRoomItemBean = {} as LiveRoomItemBean // 上次输入的消息
46 //播放错误 48 //播放错误
@@ -198,6 +200,7 @@ export struct DetailPlayVLivePage { @@ -198,6 +200,7 @@ export struct DetailPlayVLivePage {
198 playerController: this.playerController, 200 playerController: this.playerController,
199 swiperController: this.swiperController, 201 swiperController: this.swiperController,
200 swiperIndex: $swiperIndex, 202 swiperIndex: $swiperIndex,
  203 + showClearButton: $showClearButton
201 }) 204 })
202 205
203 // 直播资源加载失败 206 // 直播资源加载失败
@@ -241,7 +244,7 @@ export struct DetailPlayVLivePage { @@ -241,7 +244,7 @@ export struct DetailPlayVLivePage {
241 Image($r('app.media.icon_live_more')) 244 Image($r('app.media.icon_live_more'))
242 .width(40) 245 .width(40)
243 .aspectRatio(1) 246 .aspectRatio(1)
244 - .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) 247 + .visibility(this.showClearButton ? Visibility.Visible : Visibility.Hidden)
245 .position({ x: '100%', y: '100%' }) 248 .position({ x: '100%', y: '100%' })
246 .markAnchor({ x: 56, y: this.bottomSafeHeight }) 249 .markAnchor({ x: 56, y: this.bottomSafeHeight })
247 .onClick(() => { 250 .onClick(() => {
@@ -10,9 +10,9 @@ export struct PlayerInfoComponent { @@ -10,9 +10,9 @@ export struct PlayerInfoComponent {
10 @Consume liveState: string 10 @Consume liveState: string
11 @Consume isShowControl: boolean 11 @Consume isShowControl: boolean
12 @Link swiperIndex: number 12 @Link swiperIndex: number
  13 + @Link showClearButton: boolean
13 @Provide isFullScreen: boolean = false // 判断是否全屏,全屏状态下swiper禁止切换 14 @Provide isFullScreen: boolean = false // 判断是否全屏,全屏状态下swiper禁止切换
14 15
15 -  
16 build() { 16 build() {
17 Column() { 17 Column() {
18 Swiper(this.swiperController) { 18 Swiper(this.swiperController) {
@@ -35,12 +35,23 @@ export struct PlayerInfoComponent { @@ -35,12 +35,23 @@ export struct PlayerInfoComponent {
35 this.isShowControl = !this.isShowControl 35 this.isShowControl = !this.isShowControl
36 } 36 }
37 }) 37 })
38 - .onChange((index) => {  
39 - this.swiperIndex = index 38 + .onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => {
  39 + this.dealShowClearButton(index,extraInfo.currentOffset)
  40 + })
  41 + .onAnimationEnd((index: number, extraInfo: SwiperAnimationEvent) => {
  42 + this.dealShowClearButton(index,extraInfo.currentOffset)
40 }) 43 })
41 .disableSwipe(this.isFullScreen) 44 .disableSwipe(this.isFullScreen)
42 } 45 }
43 .height('100%') 46 .height('100%')
44 .width('100%') 47 .width('100%')
45 } 48 }
  49 + dealShowClearButton(index:number, currentOffset: number) {
  50 + this.swiperIndex = index
  51 + if (index == 0) {
  52 + this.showClearButton = currentOffset >= 0;
  53 + }else if (index == 1) {
  54 + this.showClearButton = false
  55 + }
  56 + }
46 } 57 }