zhenghy

修复直播频道切换问题

@@ -121,35 +121,6 @@ export struct LiveHorizontalCardComponent { @@ -121,35 +121,6 @@ export struct LiveHorizontalCardComponent {
121 } 121 }
122 122
123 async gotoLive(content: ContentDTO) { 123 async gotoLive(content: ContentDTO) {
124 - const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')  
125 - if (content && content.objectType) {  
126 - if (content.objectType === ContentConstants.TYPE_LIVE) {  
127 - if (liveDetail && liveDetail[0] && liveDetail[0].liveInfo) {  
128 - const liveStyle = liveDetail[0].liveInfo.liveStyle  
129 - const liveState = liveDetail[0].liveInfo.liveState  
130 -  
131 - console.error('liveDetail===', liveDetail)  
132 -  
133 - let taskAction: Action = {  
134 - type: 'JUMP_DETAIL_PAGE',  
135 - params: {  
136 - detailPageType: 2,  
137 - contentID: content?.objectId,  
138 - liveStyle: liveState === 'wait' ? 0 : liveStyle,  
139 - extra: {  
140 - relType: content?.relType,  
141 - relId: content?.relId,  
142 - } as ExtraDTO  
143 - } as Params,  
144 - };  
145 - WDRouterRule.jumpWithAction(taskAction)  
146 - // Logger.debug(TAG, `gotoLive, ${content.objectId}`);  
147 - }  
148 - } else if (content.objectType === ContentConstants.TYPE_TELETEXT) {  
149 - ProcessUtils.processPage(content)  
150 - }  
151 - }  
152 -  
153 - 124 + ProcessUtils.processPage(content)
154 } 125 }
155 } 126 }
@@ -32,19 +32,32 @@ export struct DetailPlayShortVideoPage { @@ -32,19 +32,32 @@ export struct DetailPlayShortVideoPage {
32 @Provide followStatus: string = '0' // 关注状态 32 @Provide followStatus: string = '0' // 关注状态
33 @Provide isOpenDetail: boolean = false // 查看详情按钮点击 33 @Provide isOpenDetail: boolean = false // 查看详情按钮点击
34 @Provide isDragging: boolean = false // 拖动时间进度条 34 @Provide isDragging: boolean = false // 拖动时间进度条
  35 + @Consume @Watch('videoStatusChange') switchVideoStatus: boolean
35 @Consume @Watch('pageShowChange') pageShow: number 36 @Consume @Watch('pageShowChange') pageShow: number
36 - @Consume @Watch('pageHideChange') pageHide: number  
37 37
  38 + /**
  39 + * 页面显示重查用户关注、点赞等信息
  40 + */
38 pageShowChange() { 41 pageShowChange() {
39 - if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_PAUSE) {  
40 - this.playerController.play() 42 + if (this.currentIndex === this.index) {
41 this.queryNewsInfoOfUser() 43 this.queryNewsInfoOfUser()
  44 + if (this.switchVideoStatus) {
  45 + this.playerController.play()
  46 + }
42 } 47 }
43 } 48 }
44 49
45 - pageHideChange() {  
46 - if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_START) {  
47 - this.playerController.pause() 50 + /**
  51 + * 频道切换视频暂停、播放
  52 + * 页面显隐视频暂停、播放
  53 + */
  54 + videoStatusChange() {
  55 + if (this.currentIndex === this.index) {
  56 + if (this.switchVideoStatus) {
  57 + this.playerController.play()
  58 + } else {
  59 + this.playerController.pause()
  60 + }
48 } 61 }
49 } 62 }
50 63
@@ -22,12 +22,12 @@ export struct DetailVideoListPage { @@ -22,12 +22,12 @@ export struct DetailVideoListPage {
22 @Provide showComment: boolean = true 22 @Provide showComment: boolean = true
23 @Provide pageShow: number = -1 23 @Provide pageShow: number = -1
24 @Provide pageHide: number = -1 24 @Provide pageHide: number = -1
  25 + @Provide switchVideoStatus: boolean = false
25 @State data: ContentDetailDTO[] = [] 26 @State data: ContentDetailDTO[] = []
26 @State testData: string[] = ['111', '222', '333'] 27 @State testData: string[] = ['111', '222', '333']
27 @State currentIndex: number = 0 28 @State currentIndex: number = 0
28 @State interactDataList: InteractDataDTO[] = [] 29 @State interactDataList: InteractDataDTO[] = []
29 @State isFullScreen: boolean = false 30 @State isFullScreen: boolean = false
30 - @State switchVideoStatus: boolean = false  
31 31
32 async aboutToAppear(): Promise<void> { 32 async aboutToAppear(): Promise<void> {
33 this.openFullScreen() 33 this.openFullScreen()
@@ -57,13 +57,14 @@ export struct DetailVideoListPage { @@ -57,13 +57,14 @@ export struct DetailVideoListPage {
57 onPageShow(): void { 57 onPageShow(): void {
58 console.log(TAG, 'onPageShow') 58 console.log(TAG, 'onPageShow')
59 this.pageShow = Math.random() 59 this.pageShow = Math.random()
  60 + this.switchVideoStatus = true
60 this.openFullScreen() 61 this.openFullScreen()
61 62
62 } 63 }
63 64
64 onPageHide(): void { 65 onPageHide(): void {
65 console.log(TAG, 'onPageHide') 66 console.log(TAG, 'onPageHide')
66 - this.pageHide = Math.random() 67 + this.switchVideoStatus = false
67 this.closeFullScreen() 68 this.closeFullScreen()
68 } 69 }
69 70
@@ -46,37 +46,43 @@ export struct VideoChannelDetail { @@ -46,37 +46,43 @@ export struct VideoChannelDetail {
46 private swiperController: SwiperController = new SwiperController() 46 private swiperController: SwiperController = new SwiperController()
47 @Provide showComment: boolean = false 47 @Provide showComment: boolean = false
48 @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0 48 @Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
49 - @Consume pageShow: number  
50 - @Consume pageHide: number 49 + @Consume @Watch('pageShowChange') pageShow: number
  50 + @Consume @Watch('pageHideChange') pageHide: number
  51 + @Provide switchVideoStatus: boolean = false
51 @State data: ContentDetailDTO[] = [] 52 @State data: ContentDetailDTO[] = []
52 @State currentIndex: number = 0 53 @State currentIndex: number = 0
53 @State interactDataList: InteractDataDTO[] = [] 54 @State interactDataList: InteractDataDTO[] = []
54 @State totalCount: number = 0 55 @State totalCount: number = 0
55 @State isMouted: boolean = false 56 @State isMouted: boolean = false
56 57
  58 + pageShowChange() {
  59 + if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
  60 + this.barBackgroundColor = Color.Black
  61 + this.switchVideoStatus = true
  62 + this.openFullScreen()
  63 + }
  64 + }
  65 +
  66 + pageHideChange() {
  67 + this.barBackgroundColor = Color.Transparent
  68 + this.switchVideoStatus = false
  69 + this.closeFullScreen()
  70 + }
  71 +
57 /** 72 /**
58 * 监听视频频道激活或失活 73 * 监听视频频道激活或失活
59 */ 74 */
60 navIndexChange() { 75 navIndexChange() {
61 - // if (timer) clearTimeout(timer)  
62 console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex) 76 console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex)
63 - // timer = setTimeout(() => {  
64 -  
65 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { 77 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
66 - // 如果视频在暂停则播放视频  
67 this.barBackgroundColor = Color.Black 78 this.barBackgroundColor = Color.Black
68 - this.pageShow = Math.random() 79 + this.switchVideoStatus = true
69 this.openFullScreen() 80 this.openFullScreen()
70 } else { 81 } else {
71 - // 如果视频在播放则暂停视频  
72 this.barBackgroundColor = Color.Transparent 82 this.barBackgroundColor = Color.Transparent
73 - this.pageHide = Math.random() 83 + this.switchVideoStatus = false
74 this.closeFullScreen() 84 this.closeFullScreen()
75 } 85 }
76 - // timer = -1  
77 - // }, 100)  
78 -  
79 -  
80 } 86 }
81 87
82 aboutToAppear() { 88 aboutToAppear() {
@@ -91,16 +97,6 @@ export struct VideoChannelDetail { @@ -91,16 +97,6 @@ export struct VideoChannelDetail {
91 Logger.info(TAG, 'aboutToDisappear'); 97 Logger.info(TAG, 'aboutToDisappear');
92 } 98 }
93 99
94 - onPageShow(): void {  
95 - this.openFullScreen()  
96 - Logger.info(TAG, 'onPageShow');  
97 - }  
98 -  
99 - onPageHide(): void {  
100 - this.closeFullScreen()  
101 - Logger.info(TAG, 'onPageHide');  
102 - }  
103 -  
104 /** 100 /**
105 * 开启沉浸式 101 * 开启沉浸式
106 * TODO:颜色待根据业务接口修改 102 * TODO:颜色待根据业务接口修改