Showing
7 changed files
with
83 additions
and
354 deletions
| @@ -20,4 +20,5 @@ export interface Params { | @@ -20,4 +20,5 @@ export interface Params { | ||
| 20 | // 17.多图(图集)详情页 | 20 | // 17.多图(图集)详情页 |
| 21 | detailPageType?: number; // 详情页类型 | 21 | detailPageType?: number; // 详情页类型 |
| 22 | liveStyle?: number; // 直播类型:0横屏,1竖屏 | 22 | liveStyle?: number; // 直播类型:0横屏,1竖屏 |
| 23 | + creatorId?: string; //号主id | ||
| 23 | } | 24 | } |
| @@ -18,12 +18,15 @@ export struct BottomNavigationComponent { | @@ -18,12 +18,15 @@ export struct BottomNavigationComponent { | ||
| 18 | @Provide bottomRectHeight: number = 0 | 18 | @Provide bottomRectHeight: number = 0 |
| 19 | @Provide topRectHeight: number = 0 | 19 | @Provide topRectHeight: number = 0 |
| 20 | @Provide isLayoutFullScreen: boolean = false | 20 | @Provide isLayoutFullScreen: boolean = false |
| 21 | + @Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229 | ||
| 22 | + @Provide isNight: boolean = false // 是否开启夜间模式 | ||
| 21 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 23 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 22 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 24 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 23 | // 底导/顶导全部数据 | 25 | // 底导/顶导全部数据 |
| 24 | @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] | 26 | @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] |
| 25 | // 底导当前选中/焦点下标 | 27 | // 底导当前选中/焦点下标 |
| 26 | @State currentNavIndex: number = BottomNavi.NEWS; | 28 | @State currentNavIndex: number = BottomNavi.NEWS; |
| 29 | + // @State currentTopNavSelectedIndex: number = 0; // | ||
| 27 | @State barBackgroundColor: Color = Color.Transparent | 30 | @State barBackgroundColor: Color = Color.Transparent |
| 28 | // 底导TabsController | 31 | // 底导TabsController |
| 29 | private navController: TabsController = new TabsController(); | 32 | private navController: TabsController = new TabsController(); |
| @@ -151,36 +151,25 @@ export struct TopNavigationComponent { | @@ -151,36 +151,25 @@ export struct TopNavigationComponent { | ||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | indexChange() { | 153 | indexChange() { |
| 154 | - if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex === 0 && this.changeBarBackgroundColor) { | ||
| 155 | - this.barBackgroundColor = Color.Black | ||
| 156 | - this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 157 | - } else { | ||
| 158 | - this.barBackgroundColor = Color.Transparent | ||
| 159 | - this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 160 | - } | ||
| 161 | 154 | ||
| 155 | + // 判断视频频道待处理 | ||
| 162 | if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex == 0) { | 156 | if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex == 0) { |
| 163 | - if (!this.isLayoutFullScreen) { | ||
| 164 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 165 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 166 | - windowClass.setWindowLayoutFullScreen(true).then(() => { | ||
| 167 | - this.isLayoutFullScreen = true | ||
| 168 | - this.bottomRectHeight = this.bottomSafeHeight | ||
| 169 | - this.topRectHeight = this.topSafeHeight | ||
| 170 | - }) | ||
| 171 | - } | 157 | + this.barBackgroundColor = Color.Black |
| 158 | + this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 159 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 160 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 161 | + this.isLayoutFullScreen = true | ||
| 162 | + this.bottomRectHeight = this.bottomSafeHeight | ||
| 163 | + this.topRectHeight = this.topSafeHeight | ||
| 172 | 164 | ||
| 173 | } else { | 165 | } else { |
| 174 | - if (this.isLayoutFullScreen) { | ||
| 175 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 176 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 177 | - windowClass.setWindowLayoutFullScreen(false).then(() => { | ||
| 178 | - this.isLayoutFullScreen = false | ||
| 179 | - this.bottomRectHeight = 0 | ||
| 180 | - this.topRectHeight = 0 | ||
| 181 | - console.error(' this.isLayoutFullScreen ', this.isLayoutFullScreen) | ||
| 182 | - }) | ||
| 183 | - } | 166 | + this.barBackgroundColor = Color.Transparent |
| 167 | + this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 168 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 169 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 170 | + this.isLayoutFullScreen = false | ||
| 171 | + this.bottomRectHeight = 0 | ||
| 172 | + this.topRectHeight = 0 | ||
| 184 | } | 173 | } |
| 185 | } | 174 | } |
| 186 | 175 |
| 1 | -import { window } from '@kit.ArkUI' | ||
| 2 | -import { NumberFormatterUtils, WindowModel } from 'wdKit/Index' | ||
| 3 | - | ||
| 4 | -import { devicePLSensorManager } from 'wdDetailPlayApi/Index' | ||
| 5 | -import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' | ||
| 6 | -import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | ||
| 7 | - | ||
| 8 | -@Entry | ||
| 9 | -@Component | ||
| 10 | -export struct PlayVUIComponent { | ||
| 11 | - playerController: WDPlayerController = new WDPlayerController(); | ||
| 12 | - //菜单键是否可见 | ||
| 13 | - @State isMenuVisible: boolean = true | ||
| 14 | - @State isFullScreen: boolean = false | ||
| 15 | - @Consume liveDetailsBean: LiveDetailsBean | ||
| 16 | - @Consume liveRoomDataBean: LiveRoomDataBean | ||
| 17 | - @State currentTime: string = '' | ||
| 18 | - @State totalTime: string = '' | ||
| 19 | - @State progressVal: number = 0; | ||
| 20 | - //是否处于播放状态中 | ||
| 21 | - @State isPlayStatus: boolean = true | ||
| 22 | - | ||
| 23 | - aboutToAppear(): void { | ||
| 24 | - //播放进度监听 | ||
| 25 | - this.playerController.onTimeUpdate = (position: number, duration: number) => { | ||
| 26 | - this.currentTime = DateFormatUtil.secondToTime(Math.floor(position / 1000)); | ||
| 27 | - this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000)); | ||
| 28 | - this.progressVal = Math.floor(position * 100 / duration); | ||
| 29 | - } | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - build() { | ||
| 33 | - Column() { | ||
| 34 | - this.getTopUIComponent() | ||
| 35 | - this.getMiddleUIComponent() | ||
| 36 | - this.getBottomUIComponent() | ||
| 37 | - } | ||
| 38 | - .width('100%') | ||
| 39 | - .height('100%') | ||
| 40 | - .alignItems(HorizontalAlign.Start) | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - @Builder | ||
| 44 | - getTopUIComponent() { | ||
| 45 | - Column() { | ||
| 46 | - Row() { | ||
| 47 | - Image($r('app.media.icon_arrow_left_white')) | ||
| 48 | - .width(24) | ||
| 49 | - .aspectRatio(1) | ||
| 50 | - .visibility(Visibility.None) | ||
| 51 | - .margin({ | ||
| 52 | - right: 10 | ||
| 53 | - }) | ||
| 54 | - if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { | ||
| 55 | - Text(this.liveDetailsBean.newsTitle) | ||
| 56 | - .maxLines(1) | ||
| 57 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 58 | - .fontSize('16fp') | ||
| 59 | - .fontWeight(500) | ||
| 60 | - .fontColor(Color.White) | ||
| 61 | - .textAlign(TextAlign.Start) | ||
| 62 | - .layoutWeight(1) | ||
| 63 | - } else { | ||
| 64 | - Blank() | ||
| 65 | - } | ||
| 66 | - Image($r('app.media.icon_share')) | ||
| 67 | - .width(24) | ||
| 68 | - .aspectRatio(1) | ||
| 69 | - .visibility(Visibility.None) | ||
| 70 | - } | ||
| 71 | - .width('100%') | ||
| 72 | - .alignItems(VerticalAlign.Center) | ||
| 73 | - .margin({ | ||
| 74 | - bottom: 10 | ||
| 75 | - }) | ||
| 76 | - | ||
| 77 | - this.getLiveStatusView() | ||
| 78 | - }.width('100%') | ||
| 79 | - .padding({ | ||
| 80 | - top: 20, | ||
| 81 | - bottom: 6, | ||
| 82 | - left: 10, | ||
| 83 | - right: 10 | ||
| 84 | - }) | ||
| 85 | - .alignItems(HorizontalAlign.Start) | ||
| 86 | - .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - @Builder | ||
| 90 | - getLiveStatusView() { | ||
| 91 | - // 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 92 | - // 预约 | ||
| 93 | - if (this.liveDetailsBean.liveInfo?.liveState == 'wait') { | ||
| 94 | - Row() { | ||
| 95 | - Image($r('app.media.icon_live_status_wait')) | ||
| 96 | - .width(22) | ||
| 97 | - .height(18) | ||
| 98 | - Text('预约') | ||
| 99 | - .fontSize('11fp') | ||
| 100 | - .fontWeight(400) | ||
| 101 | - .fontColor(Color.White) | ||
| 102 | - } | ||
| 103 | - .backgroundColor('#4D000000') | ||
| 104 | - .padding({ | ||
| 105 | - top: 1, | ||
| 106 | - right: 4, | ||
| 107 | - bottom: 1 | ||
| 108 | - }) | ||
| 109 | - } | ||
| 110 | - // 直播中 | ||
| 111 | - else if (this.liveDetailsBean.liveInfo?.liveState == 'running') { | ||
| 112 | - Row() { | ||
| 113 | - Image($r('app.media.icon_live_status_running')) | ||
| 114 | - .width(22) | ||
| 115 | - .height(18) | ||
| 116 | - Text('直播中') | ||
| 117 | - .fontSize('11fp') | ||
| 118 | - .fontWeight(400) | ||
| 119 | - .fontColor(Color.White) | ||
| 120 | - Image($r('app.media.icon_live_player_status_end')) | ||
| 121 | - .width(12) | ||
| 122 | - .height(12) | ||
| 123 | - Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | ||
| 124 | - .fontSize('11fp') | ||
| 125 | - .fontWeight(400) | ||
| 126 | - .fontColor(Color.White) | ||
| 127 | - } | ||
| 128 | - .backgroundColor('#4D000000') | ||
| 129 | - .padding({ | ||
| 130 | - top: 1, | ||
| 131 | - right: 4, | ||
| 132 | - bottom: 1 | ||
| 133 | - }) | ||
| 134 | - } | ||
| 135 | - //回看 | ||
| 136 | - else if (this.liveDetailsBean.liveInfo?.liveState == 'end') { | ||
| 137 | - Row() { | ||
| 138 | - Text('回看') | ||
| 139 | - .fontSize('11fp') | ||
| 140 | - .fontWeight(400) | ||
| 141 | - .fontColor(Color.White) | ||
| 142 | - Image($r('app.media.icon_live_player_status_end')) | ||
| 143 | - .width(12) | ||
| 144 | - .height(12) | ||
| 145 | - Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | ||
| 146 | - .fontSize('11fp') | ||
| 147 | - .fontWeight(400) | ||
| 148 | - .fontColor(Color.White) | ||
| 149 | - } | ||
| 150 | - .backgroundColor('#4D000000') | ||
| 151 | - .padding({ | ||
| 152 | - left: 4, | ||
| 153 | - top: 1, | ||
| 154 | - right: 4, | ||
| 155 | - bottom: 1 | ||
| 156 | - }) | ||
| 157 | - } | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - @Builder | ||
| 161 | - getMiddleUIComponent() { | ||
| 162 | - Stack() | ||
| 163 | - .layoutWeight(1) | ||
| 164 | - .width('100%') | ||
| 165 | - .onClick(() => { | ||
| 166 | - this.isMenuVisible = !this.isMenuVisible | ||
| 167 | - }) | ||
| 168 | - } | ||
| 169 | - | ||
| 170 | - @Builder | ||
| 171 | - getBottomUIComponent() { | ||
| 172 | - Row() { | ||
| 173 | - if (this.liveDetailsBean?.liveInfo?.liveState == 'end') { | ||
| 174 | - this.playOrPauseBtn() | ||
| 175 | - Text(this.currentTime) | ||
| 176 | - .fontColor(Color.White) | ||
| 177 | - .fontWeight(600) | ||
| 178 | - .fontSize('12fp') | ||
| 179 | - .margin({ | ||
| 180 | - left: 16 | ||
| 181 | - }) | ||
| 182 | - | ||
| 183 | - this.playProgressView() | ||
| 184 | - | ||
| 185 | - Text(this.totalTime) | ||
| 186 | - .fontColor(Color.White) | ||
| 187 | - .fontWeight(600) | ||
| 188 | - .fontSize('12fp') | ||
| 189 | - .margin({ | ||
| 190 | - right: 16 | ||
| 191 | - }) | ||
| 192 | - } else { | ||
| 193 | - Blank() | ||
| 194 | - } | ||
| 195 | - Image($r('app.media.icon_live_player_full_screen')) | ||
| 196 | - .width(24) | ||
| 197 | - .height(24) | ||
| 198 | - .onClick(() => { | ||
| 199 | - this.isFullScreen = !this.isFullScreen | ||
| 200 | - WindowModel.shared.setPreferredOrientation(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 201 | - devicePLSensorManager.devicePLSensorOn(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 202 | - }) | ||
| 203 | - } | ||
| 204 | - .alignItems(VerticalAlign.Center) | ||
| 205 | - .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | ||
| 206 | - .width('100%') | ||
| 207 | - .padding({ | ||
| 208 | - left: 10, | ||
| 209 | - right: 10, | ||
| 210 | - top: 15, | ||
| 211 | - bottom: 15 | ||
| 212 | - }) | ||
| 213 | - .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) | ||
| 214 | - } | ||
| 215 | - | ||
| 216 | - @Builder | ||
| 217 | - playOrPauseBtn() { | ||
| 218 | - //暂停、播放 | ||
| 219 | - Image(this.isPlayStatus ? $r('app.media.icon_live_player_pause') : $r('app.media.player_play_ic')) | ||
| 220 | - .width(24) | ||
| 221 | - .height(24) | ||
| 222 | - .onClick(() => { | ||
| 223 | - if (this.isPlayStatus) { | ||
| 224 | - this.isPlayStatus = false | ||
| 225 | - this.playerController.pause() | ||
| 226 | - } else { | ||
| 227 | - this.isPlayStatus = true | ||
| 228 | - this.playerController.play() | ||
| 229 | - } | ||
| 230 | - }) | ||
| 231 | - } | ||
| 232 | - | ||
| 233 | - @Builder | ||
| 234 | - playProgressView() { | ||
| 235 | - Slider({ | ||
| 236 | - value: this.progressVal, | ||
| 237 | - step: 1, | ||
| 238 | - style: SliderStyle.OutSet | ||
| 239 | - }) | ||
| 240 | - .blockSize({ | ||
| 241 | - width: 18, | ||
| 242 | - height: 12 | ||
| 243 | - })// .blockStyle({ | ||
| 244 | - // type: SliderBlockType.IMAGE, | ||
| 245 | - // image: $r('app.media.ic_player_block') | ||
| 246 | - // }) | ||
| 247 | - .blockColor(Color.White) | ||
| 248 | - .trackColor('#4DFFFFFF') | ||
| 249 | - .selectedColor('#FFED2800') | ||
| 250 | - .height(14) | ||
| 251 | - .trackThickness(1) | ||
| 252 | - .layoutWeight(1) | ||
| 253 | - .margin({ | ||
| 254 | - left: 8, | ||
| 255 | - right: 8 | ||
| 256 | - }) | ||
| 257 | - .onChange((value: number, mode: SliderChangeMode) => { | ||
| 258 | - this.playerController?.setSeekTime(value, mode); | ||
| 259 | - }) | ||
| 260 | - } | ||
| 261 | -} |
| @@ -15,14 +15,19 @@ export struct PlayerUIComponent { | @@ -15,14 +15,19 @@ export struct PlayerUIComponent { | ||
| 15 | // // 全屏按钮 | 15 | // // 全屏按钮 |
| 16 | // }.layoutWeight(1) | 16 | // }.layoutWeight(1) |
| 17 | 17 | ||
| 18 | - Row() { | ||
| 19 | - PlayerCommentComponent() | ||
| 20 | - PlayerVideoControlComponent({ playerController: this.playerController }) | ||
| 21 | - .visibility(this.isShowControl ? Visibility.Visible : Visibility.Hidden) | ||
| 22 | - .animation({ duration: 500 }) | ||
| 23 | - } | ||
| 24 | - .position({ y: '100%' }) | ||
| 25 | - .markAnchor({ y: '100%' }) | 18 | + |
| 19 | + PlayerCommentComponent() | ||
| 20 | + .visibility(this.isShowControl ? Visibility.Hidden : Visibility.Visible) | ||
| 21 | + .animation({ duration: 500 }) | ||
| 22 | + .position({ y: '100%' }) | ||
| 23 | + .markAnchor({ y: '100%' }) | ||
| 24 | + | ||
| 25 | + PlayerVideoControlComponent({ playerController: this.playerController }) | ||
| 26 | + .visibility(this.isShowControl ? Visibility.Visible : Visibility.Hidden) | ||
| 27 | + .animation({ duration: 500 }) | ||
| 28 | + .position({ y: '100%' }) | ||
| 29 | + .markAnchor({ y: '100%' }) | ||
| 30 | + | ||
| 26 | } | 31 | } |
| 27 | .height('100%') | 32 | .height('100%') |
| 28 | .width('100%') | 33 | .width('100%') |
| @@ -4,7 +4,6 @@ import { ResponseDTO } from 'wdNetwork/Index'; | @@ -4,7 +4,6 @@ import { ResponseDTO } from 'wdNetwork/Index'; | ||
| 4 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' | 4 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' |
| 5 | import router from '@ohos.router'; | 5 | import router from '@ohos.router'; |
| 6 | import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 6 | import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 7 | -import window from '@ohos.window'; | ||
| 8 | import { WindowModel } from 'wdKit'; | 7 | import { WindowModel } from 'wdKit'; |
| 9 | 8 | ||
| 10 | const storage = LocalStorage.getShared(); | 9 | const storage = LocalStorage.getShared(); |
| @@ -31,16 +30,16 @@ export struct DetailVideoListPage { | @@ -31,16 +30,16 @@ export struct DetailVideoListPage { | ||
| 31 | /** | 30 | /** |
| 32 | * 开启沉浸式并设置状态栏颜色 | 31 | * 开启沉浸式并设置状态栏颜色 |
| 33 | */ | 32 | */ |
| 34 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 35 | - const windowClass: window.Window = windowStage.getMainWindowSync(); | ||
| 36 | - windowClass.setWindowLayoutFullScreen(true) | ||
| 37 | - this.isFullScreen = true | ||
| 38 | - windowClass.setWindowSystemBarProperties({ | ||
| 39 | - statusBarContentColor: '#ffffff', | ||
| 40 | - }) | 33 | + // const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage |
| 34 | + // const windowClass: window.Window = windowStage.getMainWindowSync(); | ||
| 35 | + // windowClass.setWindowLayoutFullScreen(true) | ||
| 36 | + // this.isFullScreen = true | ||
| 37 | + // windowClass.setWindowSystemBarProperties({ | ||
| 38 | + // statusBarContentColor: '#ffffff', | ||
| 39 | + // }) | ||
| 41 | 40 | ||
| 42 | 41 | ||
| 43 | - let data: ContentDetailDTO[] = [] | 42 | + // let data: ContentDetailDTO[] = [] |
| 44 | let action: Action = router.getParams() as Action | 43 | let action: Action = router.getParams() as Action |
| 45 | if (action) { | 44 | if (action) { |
| 46 | this.contentId = action.params?.contentID || '' | 45 | this.contentId = action.params?.contentID || '' |
| @@ -63,17 +62,6 @@ export struct DetailVideoListPage { | @@ -63,17 +62,6 @@ export struct DetailVideoListPage { | ||
| 63 | 62 | ||
| 64 | await this.queryVideoList() | 63 | await this.queryVideoList() |
| 65 | 64 | ||
| 66 | - // await ContentDetailRequest.postRecommendVideoList({ | ||
| 67 | - // pageSize: 5, | ||
| 68 | - // refreshCnt: 1 | ||
| 69 | - // }).then(res => { | ||
| 70 | - // if (res.data) { | ||
| 71 | - // data = data.concat(res.data) | ||
| 72 | - // } | ||
| 73 | - // console.log('res1===', JSON.stringify(res)) | ||
| 74 | - // console.log('res==' + this.data) | ||
| 75 | - // }) | ||
| 76 | - | ||
| 77 | 65 | ||
| 78 | if (this.data.length > 0) { | 66 | if (this.data.length > 0) { |
| 79 | const params: contentListParams = { | 67 | const params: contentListParams = { |
| @@ -103,37 +91,18 @@ export struct DetailVideoListPage { | @@ -103,37 +91,18 @@ export struct DetailVideoListPage { | ||
| 103 | } | 91 | } |
| 104 | 92 | ||
| 105 | aboutToDisappear(): void { | 93 | aboutToDisappear(): void { |
| 106 | - | ||
| 107 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 108 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 109 | - windowClass.setWindowLayoutFullScreen(false) | ||
| 110 | - this.isFullScreen = false | ||
| 111 | - windowClass.setWindowSystemBarProperties({ statusBarContentColor: '#000000' }) | ||
| 112 | - | 94 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) |
| 95 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 113 | } | 96 | } |
| 114 | 97 | ||
| 115 | onPageShow(): void { | 98 | onPageShow(): void { |
| 116 | - if (!this.isFullScreen) { | ||
| 117 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 118 | - const windowClass: window.Window = windowStage.getMainWindowSync(); | ||
| 119 | - windowClass.setWindowLayoutFullScreen(true) | ||
| 120 | - this.isFullScreen = true | ||
| 121 | - windowClass.setWindowSystemBarProperties({ | ||
| 122 | - statusBarContentColor: '#ffffff', | ||
| 123 | - }) | ||
| 124 | - | ||
| 125 | - } | 99 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) |
| 100 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 126 | } | 101 | } |
| 127 | 102 | ||
| 128 | onPageHide(): void { | 103 | onPageHide(): void { |
| 129 | - if (this.isFullScreen) { | ||
| 130 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 131 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 132 | - windowClass.setWindowLayoutFullScreen(false) | ||
| 133 | - this.isFullScreen = false | ||
| 134 | - windowClass.setWindowSystemBarProperties({ statusBarContentColor: '#000000' }) | ||
| 135 | - } | ||
| 136 | - | 104 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) |
| 105 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 137 | } | 106 | } |
| 138 | 107 | ||
| 139 | /** | 108 | /** |
| @@ -166,7 +135,7 @@ export struct DetailVideoListPage { | @@ -166,7 +135,7 @@ export struct DetailVideoListPage { | ||
| 166 | }) | 135 | }) |
| 167 | }.width('100%') | 136 | }.width('100%') |
| 168 | .height('100%') | 137 | .height('100%') |
| 169 | - | 138 | + |
| 170 | }, (item: ContentDetailDTO) => item.newsId + '') | 139 | }, (item: ContentDetailDTO) => item.newsId + '') |
| 171 | } | 140 | } |
| 172 | .clip(false) | 141 | .clip(false) |
| 1 | -import { ContentDetailDTO, InteractDataDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index'; | 1 | +import { ContentDetailDTO, InteractDataDTO, Params, RmhInfoDTO, UserInfoDTO } from 'wdBean/Index'; |
| 2 | import { | 2 | import { |
| 3 | batchLikeAndCollectParams, | 3 | batchLikeAndCollectParams, |
| 4 | batchLikeAndCollectResult, | 4 | batchLikeAndCollectResult, |
| @@ -8,10 +8,11 @@ import { | @@ -8,10 +8,11 @@ import { | ||
| 8 | postExecuteLikeParams, | 8 | postExecuteLikeParams, |
| 9 | postInteractAccentionOperateParams | 9 | postInteractAccentionOperateParams |
| 10 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 10 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 11 | -import { ToastUtils } from 'wdKit'; | 11 | +import { SPHelper, ToastUtils } from 'wdKit'; |
| 12 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 12 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 13 | import { WDPlayerController } from 'wdPlayer/Index'; | 13 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 14 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 14 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 15 | +import { SpConstants } from 'wdConstant/Index' | ||
| 15 | 16 | ||
| 16 | export interface OperationItem { | 17 | export interface OperationItem { |
| 17 | icon: Resource; | 18 | icon: Resource; |
| @@ -64,9 +65,10 @@ export struct OperationListView { | @@ -64,9 +65,10 @@ export struct OperationListView { | ||
| 64 | /** | 65 | /** |
| 65 | * 点赞、取消点赞 | 66 | * 点赞、取消点赞 |
| 66 | */ | 67 | */ |
| 67 | - toggleLikeStatus() { | 68 | + async toggleLikeStatus() { |
| 68 | // 未登录,跳转登录 | 69 | // 未登录,跳转登录 |
| 69 | - if (!HttpUrlUtils.getUserId()) { | 70 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 71 | + if (!user_id) { | ||
| 70 | this.playerController?.pause() | 72 | this.playerController?.pause() |
| 71 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 73 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 72 | return | 74 | return |
| @@ -77,10 +79,16 @@ export struct OperationListView { | @@ -77,10 +79,16 @@ export struct OperationListView { | ||
| 77 | contentType: this.contentDetailData?.newsType + '', | 79 | contentType: this.contentDetailData?.newsType + '', |
| 78 | } | 80 | } |
| 79 | ContentDetailRequest.postExecuteLike(params).then(res => { | 81 | ContentDetailRequest.postExecuteLike(params).then(res => { |
| 80 | - console.log('toggleLikeStatus==',) | 82 | + |
| 81 | if (this.newsStatusOfUser) { | 83 | if (this.newsStatusOfUser) { |
| 82 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1' | 84 | this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1' |
| 83 | - this.queryContentInteractCount() | 85 | + if (this.newsStatusOfUser.likeStatus === '1') { |
| 86 | + this.interactData.likeNum = Number(this.interactData.likeNum) + 1 | ||
| 87 | + } else { | ||
| 88 | + this.interactData.likeNum = Number(this.interactData.likeNum) - 1 | ||
| 89 | + } | ||
| 90 | + console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) | ||
| 91 | + // this.queryContentInteractCount() | ||
| 84 | } | 92 | } |
| 85 | 93 | ||
| 86 | }) | 94 | }) |
| @@ -89,9 +97,10 @@ export struct OperationListView { | @@ -89,9 +97,10 @@ export struct OperationListView { | ||
| 89 | /** | 97 | /** |
| 90 | * 收藏、取消收藏 | 98 | * 收藏、取消收藏 |
| 91 | */ | 99 | */ |
| 92 | - toggleCollectStatus() { | 100 | + async toggleCollectStatus() { |
| 93 | // 未登录,跳转登录 | 101 | // 未登录,跳转登录 |
| 94 | - if (!HttpUrlUtils.getUserId()) { | 102 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 103 | + if (!user_id) { | ||
| 95 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 104 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 96 | return | 105 | return |
| 97 | } | 106 | } |
| @@ -104,10 +113,15 @@ export struct OperationListView { | @@ -104,10 +113,15 @@ export struct OperationListView { | ||
| 104 | 113 | ||
| 105 | } | 114 | } |
| 106 | ContentDetailRequest.postExecuteCollectRecord(params).then(res => { | 115 | ContentDetailRequest.postExecuteCollectRecord(params).then(res => { |
| 107 | - console.log('toggleLikeStatus==',) | ||
| 108 | if (this.newsStatusOfUser) { | 116 | if (this.newsStatusOfUser) { |
| 109 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 | 117 | this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 |
| 110 | - this.queryContentInteractCount() | 118 | + // this.queryContentInteractCount() |
| 119 | + if (this.newsStatusOfUser.collectStatus === 1) { | ||
| 120 | + this.interactData.collectNum = Number(this.interactData.collectNum) + 1 | ||
| 121 | + } else { | ||
| 122 | + this.interactData.collectNum = Number(this.interactData.collectNum) - 1 | ||
| 123 | + } | ||
| 124 | + console.log('收藏、取消收藏==', this.newsStatusOfUser?.collectStatus, this.interactData?.collectNum) | ||
| 111 | } | 125 | } |
| 112 | }) | 126 | }) |
| 113 | 127 | ||
| @@ -140,9 +154,10 @@ export struct OperationListView { | @@ -140,9 +154,10 @@ export struct OperationListView { | ||
| 140 | /** | 154 | /** |
| 141 | * 关注号主 | 155 | * 关注号主 |
| 142 | */ | 156 | */ |
| 143 | - handleAccention() { | 157 | + async handleAccention() { |
| 144 | // 未登录,跳转登录 | 158 | // 未登录,跳转登录 |
| 145 | - if (!HttpUrlUtils.getUserId()) { | 159 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 160 | + if (!user_id) { | ||
| 146 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 161 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 147 | return | 162 | return |
| 148 | } | 163 | } |
| @@ -181,7 +196,15 @@ export struct OperationListView { | @@ -181,7 +196,15 @@ export struct OperationListView { | ||
| 181 | }) | 196 | }) |
| 182 | .id("row1") | 197 | .id("row1") |
| 183 | .onClick(() => { | 198 | .onClick(() => { |
| 184 | - // 号主页 | 199 | + if (this.contentDetailData.rmhInfo?.cnMainControl === 1) { |
| 200 | + // 号主页 | ||
| 201 | + const params: Params = { | ||
| 202 | + creatorId: this.contentDetailData.rmhInfo.rmhId, | ||
| 203 | + pageID: '' | ||
| 204 | + } | ||
| 205 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 206 | + } | ||
| 207 | + | ||
| 185 | }) | 208 | }) |
| 186 | if (this.followStatus == '0') { | 209 | if (this.followStatus == '0') { |
| 187 | Image($r('app.media.ic_add')) | 210 | Image($r('app.media.ic_add')) |
-
Please register or login to post a comment