陈剑华

Merge remote-tracking branch 'origin/main'

1 import window from '@ohos.window'; 1 import window from '@ohos.window';
2 -import { BusinessError } from '@ohos.base'; 2 +import { AsyncCallback, BusinessError } from '@ohos.base';
3 import deviceInfo from '@ohos.deviceInfo' 3 import deviceInfo from '@ohos.deviceInfo'
4 import display from '@ohos.display'; 4 import display from '@ohos.display';
5 5
  6 +
  7 +interface SystemBarProperties {
  8 + statusBarColor?: string;
  9 + isStatusBarLightIcon?: boolean;
  10 + statusBarContentColor?: string;
  11 + navigationBarColor?: string;
  12 + isNavigationBarLightIcon?: boolean;
  13 + navigationBarContentColor?: string;
  14 +}
  15 +
6 export class Size { 16 export class Size {
7 width: number = 0 17 width: number = 0
8 height: number = 0 18 height: number = 0
@@ -15,17 +25,23 @@ export class Size { @@ -15,17 +25,23 @@ export class Size {
15 25
16 export class WindowModel { 26 export class WindowModel {
17 private windowStage?: window.WindowStage; 27 private windowStage?: window.WindowStage;
  28 + private windowClass?: window.Window;
18 static shared: WindowModel = new WindowModel() 29 static shared: WindowModel = new WindowModel()
19 static TAG = "WindowModel"; 30 static TAG = "WindowModel";
20 31
21 setWindowStage(windowStage: window.WindowStage) { 32 setWindowStage(windowStage: window.WindowStage) {
22 this.windowStage = windowStage; 33 this.windowStage = windowStage;
  34 + this.windowClass = windowStage.getMainWindowSync();
23 } 35 }
24 36
25 getWindowStage(): window.WindowStage { 37 getWindowStage(): window.WindowStage {
26 return this.windowStage as window.WindowStage 38 return this.windowStage as window.WindowStage
27 } 39 }
28 40
  41 + getWindowClass(): window.Window {
  42 + return this.windowClass as window.Window
  43 + }
  44 +
29 setMainWindowFullScreen(fullScreen: boolean) { 45 setMainWindowFullScreen(fullScreen: boolean) {
30 if (deviceInfo.deviceType != "phone") { 46 if (deviceInfo.deviceType != "phone") {
31 return 47 return
@@ -103,5 +119,17 @@ export class WindowModel { @@ -103,5 +119,17 @@ export class WindowModel {
103 }); 119 });
104 }) 120 })
105 } 121 }
  122 +
  123 + /**
  124 + * 设置窗口全屏模式时窗口内导航栏、状态栏的属性,使用callback异步回调。
  125 + * @param systemBarProperties
  126 + * @param callback
  127 + */
  128 + setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback?: AsyncCallback<void>): void {
  129 + this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => {
  130 + callback && callback(err)
  131 + })
  132 +
  133 + }
106 } 134 }
107 135
@@ -46,6 +46,10 @@ export class HttpUrlUtils { @@ -46,6 +46,10 @@ export class HttpUrlUtils {
46 * 批查接口,查询互动相关数据,如收藏数、评论数等 46 * 批查接口,查询互动相关数据,如收藏数、评论数等
47 */ 47 */
48 static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData"; 48 static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData";
  49 + /**
  50 + * 查询视频频道推荐楼层
  51 + */
  52 + static readonly DISPLAY_REC_COMPINFO: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo";
49 // 多图(图集)详情页 53 // 多图(图集)详情页
50 /** 54 /**
51 * 批量查询内容当前用户点赞、收藏状态 55 * 批量查询内容当前用户点赞、收藏状态
@@ -196,7 +200,6 @@ export class HttpUrlUtils { @@ -196,7 +200,6 @@ export class HttpUrlUtils {
196 * 搜索联想词 200 * 搜索联想词
197 */ 201 */
198 static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/"; 202 static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/";
199 -  
200 /** 203 /**
201 * 直播详情 204 * 直播详情
202 */ 205 */
@@ -205,7 +208,6 @@ export class HttpUrlUtils { @@ -205,7 +208,6 @@ export class HttpUrlUtils {
205 * 直播详情-直播间列表 208 * 直播详情-直播间列表
206 */ 209 */
207 static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list"; 210 static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list";
208 -  
209 /** 211 /**
210 * 直播详情-大家聊列表 212 * 直播详情-大家聊列表
211 */ 213 */
@@ -215,7 +217,6 @@ export class HttpUrlUtils { @@ -215,7 +217,6 @@ export class HttpUrlUtils {
215 * 搜索结果 显示tab 数 217 * 搜索结果 显示tab 数
216 */ 218 */
217 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword="; 219 static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword=";
218 -  
219 /** 220 /**
220 * 搜索结果 显示list 详情 221 * 搜索结果 显示list 详情
221 */ 222 */
@@ -71,6 +71,6 @@ export interface ContentDTO { @@ -71,6 +71,6 @@ export interface ContentDTO {
71 photoNum: number; 71 photoNum: number;
72 corner: string; 72 corner: string;
73 rmhPlatform: number; 73 rmhPlatform: number;
74 - newTags: string  
75 - 74 + newTags: string;
  75 + isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
76 } 76 }
@@ -28,16 +28,23 @@ export struct CardSourceInfo { @@ -28,16 +28,23 @@ export struct CardSourceInfo {
28 .fontColor($r("app.color.color_B0B0B0")) 28 .fontColor($r("app.color.color_B0B0B0"))
29 .maxLines(1) 29 .maxLines(1)
30 .textOverflow({overflow: TextOverflow.Ellipsis}) 30 .textOverflow({overflow: TextOverflow.Ellipsis})
  31 + }
  32 + // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
  33 + if(this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
  34 + (Number
  35 + .parseFloat(this
  36 + .contentDTO.publishTime))
  37 + .indexOf
  38 + ('-') === -1) {
31 Image($r("app.media.point")) 39 Image($r("app.media.point"))
32 .width(16) 40 .width(16)
33 .height(16) 41 .height(16)
  42 + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
  43 + .fontSize($r("app.float.font_size_12"))
  44 + .fontColor($r("app.color.color_B0B0B0"))
  45 + .margin({ right: 6 })
  46 + .flexShrink(0)
34 } 47 }
35 - // TODO 这里还有个判断需要完善,依赖外部,新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间  
36 - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))  
37 - .fontSize($r("app.float.font_size_12"))  
38 - .fontColor($r("app.color.color_B0B0B0"))  
39 - .margin({ right: 6 })  
40 - .flexShrink(0)  
41 if(this.contentDTO?.interactData?.commentNum) { 48 if(this.contentDTO?.interactData?.commentNum) {
42 Text(`${this.contentDTO.interactData.commentNum}评`) 49 Text(`${this.contentDTO.interactData.commentNum}评`)
43 .fontSize($r("app.float.font_size_12")) 50 .fontSize($r("app.float.font_size_12"))
@@ -60,6 +60,7 @@ export struct BottomNavigationComponent { @@ -60,6 +60,7 @@ export struct BottomNavigationComponent {
60 MinePageComponent() 60 MinePageComponent()
61 } else { 61 } else {
62 TopNavigationComponent({ 62 TopNavigationComponent({
  63 + groupId: navItem.id,
63 topNavList: navItem.topNavChannelList, 64 topNavList: navItem.topNavChannelList,
64 _currentNavIndex: this.currentNavIndex, 65 _currentNavIndex: this.currentNavIndex,
65 changeBarBackgroundColor: (color: Color) => { 66 changeBarBackgroundColor: (color: Color) => {
@@ -12,7 +12,6 @@ import LoadMoreLayout from './LoadMoreLayout'; @@ -12,7 +12,6 @@ import LoadMoreLayout from './LoadMoreLayout';
12 import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; 12 import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
13 import { CompParser } from '../CompParser'; 13 import { CompParser } from '../CompParser';
14 import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO'; 14 import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
15 -import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';  
16 import { CompDTO, LiveReviewDTO, PageDTO, PageInfoBean } from 'wdBean'; 15 import { CompDTO, LiveReviewDTO, PageDTO, PageInfoBean } from 'wdBean';
17 16
18 17
@@ -40,7 +39,6 @@ export struct PageComponent { @@ -40,7 +39,6 @@ export struct PageComponent {
40 totalCount: 0, 39 totalCount: 0,
41 list: [] 40 list: []
42 }; 41 };
43 - name: string = "";  
44 @Link @Watch('onChange') currentTopNavSelectedIndex: number 42 @Link @Watch('onChange') currentTopNavSelectedIndex: number
45 43
46 build() { 44 build() {
@@ -71,42 +69,35 @@ export struct PageComponent { @@ -71,42 +69,35 @@ export struct PageComponent {
71 @Builder 69 @Builder
72 ListLayout() { 70 ListLayout() {
73 List() { 71 List() {
74 - if (this.name !== '视频') {  
75 - // 下拉刷新  
76 - ListItem() {  
77 - RefreshLayout({  
78 - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,  
79 - this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)  
80 - })  
81 - }  
82 - }  
83 72
84 - if (this.name === '视频') {  
85 - VideoChannelDetail()  
86 - } else {  
87 - LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {  
88 - ListItem() {  
89 - Column() {  
90 - CompParser({ compDTO: compDTO, compIndex: compIndex });  
91 - }  
92 - }  
93 - },  
94 - (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp  
95 - ) 73 + // 下拉刷新
  74 + ListItem() {
  75 + RefreshLayout({
  76 + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
  77 + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
  78 + })
96 } 79 }
97 80
98 - if (this.name !== '视频') {  
99 - // 加载更多 81 + LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
100 ListItem() { 82 ListItem() {
101 - if (this.pageModel.hasMore) {  
102 - LoadMoreLayout({  
103 - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,  
104 - this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)  
105 - })  
106 - } else {  
107 - NoMoreLayout() 83 + Column() {
  84 + CompParser({ compDTO: compDTO, compIndex: compIndex });
108 } 85 }
109 } 86 }
  87 + },
  88 + (compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
  89 + )
  90 +
  91 + // 加载更多
  92 + ListItem() {
  93 + if (this.pageModel.hasMore) {
  94 + LoadMoreLayout({
  95 + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
  96 + this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
  97 + })
  98 + } else {
  99 + NoMoreLayout()
  100 + }
110 } 101 }
111 102
112 } 103 }
@@ -6,6 +6,7 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; @@ -6,6 +6,7 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent'; 6 import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
7 import window from '@ohos.window'; 7 import window from '@ohos.window';
8 import { WindowModel } from 'wdKit'; 8 import { WindowModel } from 'wdKit';
  9 +import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
9 10
10 const TAG = 'TopNavigationComponent'; 11 const TAG = 'TopNavigationComponent';
11 12
@@ -20,6 +21,7 @@ const storage = LocalStorage.getShared(); @@ -20,6 +21,7 @@ const storage = LocalStorage.getShared();
20 @Entry(storage) 21 @Entry(storage)
21 @Component 22 @Component
22 export struct TopNavigationComponent { 23 export struct TopNavigationComponent {
  24 + private groupId: number = 0
23 private tabsController: TabsController = new TabsController() 25 private tabsController: TabsController = new TabsController()
24 private changeBarBackgroundColor: (color: Color) => void = () => { 26 private changeBarBackgroundColor: (color: Color) => void = () => {
25 } 27 }
@@ -236,15 +238,23 @@ export struct TopNavigationComponent { @@ -236,15 +238,23 @@ export struct TopNavigationComponent {
236 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { 238 Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
237 ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => { 239 ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
238 TabContent() { 240 TabContent() {
239 - if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {  
240 - PageComponent({  
241 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
242 - navIndex: index, 241 + if (this._currentNavIndex === 2 && navItem.name === '视频') {
  242 + VideoChannelDetail({
  243 + bottomNavIndex: this._currentNavIndex,
  244 + topNavIndex: this.currentTopNavSelectedIndex,
  245 + groupId: this.groupId + '',
243 pageId: navItem.pageId + '', 246 pageId: navItem.pageId + '',
244 channelId: navItem.channelId + '', 247 channelId: navItem.channelId + '',
245 - name: navItem.name  
246 }) 248 })
247 - } 249 + } else
  250 + if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
  251 + PageComponent({
  252 + currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
  253 + navIndex: index,
  254 + pageId: navItem.pageId + '',
  255 + channelId: navItem.channelId + '',
  256 + })
  257 + }
248 } 258 }
249 .tabBar(this.tabBarBuilder(navItem, index)) 259 .tabBar(this.tabBarBuilder(navItem, index))
250 260
@@ -158,7 +158,8 @@ export struct SearchResultContentComponent{ @@ -158,7 +158,8 @@ export struct SearchResultContentComponent{
158 interactData: {} as InteractDataDTO, 158 interactData: {} as InteractDataDTO,
159 corner: '', 159 corner: '',
160 rmhPlatform: 0, 160 rmhPlatform: 0,
161 - newTags: '' 161 + newTags: '',
  162 + isSearch: true
162 } 163 }
163 164
164 this.data.push(contentDTO) 165 this.data.push(contentDTO)
@@ -52,8 +52,7 @@ export struct BannerComponent { @@ -52,8 +52,7 @@ export struct BannerComponent {
52 .borderRadius($r('app.float.image_border_radius')) 52 .borderRadius($r('app.float.image_border_radius'))
53 .displayCount(this.buildDisplayCount()) // 仅展示1个图片 53 .displayCount(this.buildDisplayCount()) // 仅展示1个图片
54 .cachedCount(2) 54 .cachedCount(2)
55 - .index(1) // The default index of Swiper.  
56 - .autoPlay(true) 55 + .index(0) // The default index of Swiper.
57 .indicator(Indicator.dot() 56 .indicator(Indicator.dot()
58 .right(5) 57 .right(5)
59 .itemWidth(4) 58 .itemWidth(4)
@@ -2,6 +2,7 @@ import { Logger, ResourcesUtils } from 'wdKit'; @@ -2,6 +2,7 @@ import { Logger, ResourcesUtils } from 'wdKit';
2 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; 2 import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
3 import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; 3 import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
4 import HashMap from '@ohos.util.HashMap'; 4 import HashMap from '@ohos.util.HashMap';
  5 +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
5 6
6 const TAG = 'ContentDetailRequest'; 7 const TAG = 'ContentDetailRequest';
7 8
@@ -13,6 +14,18 @@ export interface ContentDetailRequestParams { @@ -13,6 +14,18 @@ export interface ContentDetailRequestParams {
13 relType: string 14 relType: string
14 } 15 }
15 16
  17 +export interface contentsItem {
  18 + contentId: string;
  19 + contentRelId: string;
  20 + contentType: number;
  21 + relId: string;
  22 + relType: string;
  23 +}
  24 +
  25 +export interface batchContentDetailParams {
  26 + contents: contentsItem[]
  27 +}
  28 +
16 export interface recommentVideoListParams { 29 export interface recommentVideoListParams {
17 pageSize: number; 30 pageSize: number;
18 refreshCnt: number; 31 refreshCnt: number;
@@ -27,6 +40,47 @@ export interface contentListParams { @@ -27,6 +40,47 @@ export interface contentListParams {
27 contentList: contentListItem[]; 40 contentList: contentListItem[];
28 } 41 }
29 42
  43 +export interface getRecCompInfoParams {
  44 + groupId: string;
  45 + pageId: string;
  46 + channelId: string;
  47 + loadStrategy: string;
  48 + channelStrategy: string;
  49 + pageNum: number;
  50 + pageSize: number;
  51 + refreshTime: number;
  52 +}
  53 +
  54 +
  55 +// 为空的值不声明,需要时再加
  56 +export interface operDataListItem {
  57 + objectId: string;
  58 + objectType: string;
  59 + relId: string;
  60 + relType: string;
  61 + channelId: string;
  62 +}
  63 +
  64 +export interface compListItem {
  65 + compStyle: string;
  66 + compType: string;
  67 + hasMore: number;
  68 + recommend: number;
  69 + operDataList: operDataListItem[];
  70 +}
  71 +
  72 +export interface getRecCompInfoResult {
  73 + blockDesc: string;
  74 + id: number;
  75 + name: string;
  76 + pageId: string;
  77 + pageNum: number;
  78 + pageSize: number;
  79 + recommend: number;
  80 + totalCount: number;
  81 + compList: compListItem[]
  82 +}
  83 +
30 export interface IStatusContentList { 84 export interface IStatusContentList {
31 contentId: string; 85 contentId: string;
32 86
@@ -159,7 +213,33 @@ export class ContentDetailRequest { @@ -159,7 +213,33 @@ export class ContentDetailRequest {
159 } 213 }
160 214
161 /** 215 /**
162 - * 216 + * 查询沉浸式视频频道推荐楼层数据
  217 + * @returns
  218 + */
  219 + static getRecCompInfo(params: getRecCompInfoParams): Promise<ResponseDTO<getRecCompInfoResult>> {
  220 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.DISPLAY_REC_COMPINFO
  221 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  222 + return WDHttp.request({ url, method: 'GET', params, headers: HttpRequest.buildHeaderWithGlobalHeader(headers) })
  223 + }
  224 +
  225 + /**
  226 + * 批量查询沉浸式视频详情
  227 + * @returns
  228 + */
  229 + static batchContentDetail(params: batchContentDetailParams): Promise<ResponseDTO<ContentDetailDTO[]>> {
  230 + let url = HttpUrlUtils.getHost() + HttpUrlUtils.DETAIL_PATH
  231 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  232 + return WDHttp.request({
  233 + url,
  234 + method: 'POST',
  235 + data: params,
  236 + headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
  237 + })
  238 + }
  239 +
  240 +
  241 + /**
  242 + * 批量查询作品点赞、收藏、分享、阅读、评论数量
163 * @returns 243 * @returns
164 */ 244 */
165 static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> { 245 static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> {
@@ -5,104 +5,164 @@ import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' @@ -5,104 +5,164 @@ import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
5 import { Test } from './Test' 5 import { Test } from './Test'
6 import router from '@ohos.router'; 6 import router from '@ohos.router';
7 import window from '@ohos.window'; 7 import window from '@ohos.window';
8 -import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; 8 +import {
  9 + batchContentDetailParams,
  10 + compListItem,
  11 + contentListParams,
  12 + contentsItem,
  13 + getRecCompInfoParams
  14 +} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
  15 +import { WindowModel } from 'wdKit/Index';
  16 +import { BusinessError } from '@kit.BasicServicesKit';
  17 +
  18 +interface loadMoreData {
  19 + pageNum: number;
  20 + refreshTime: number;
  21 + loadStrategy: string;
  22 +}
9 23
10 @Entry 24 @Entry
11 @Component 25 @Component
12 export struct VideoChannelDetail { 26 export struct VideoChannelDetail {
13 - private contentId: string = ''  
14 - private relId: string = ''  
15 - private relType: string = '' 27 + private groupId: string = '' // 楼层id
  28 + private pageId: string = '' //页面id
  29 + private pageNum: number = 1
  30 + private pageSize: number = 10
  31 + private loadStrategy: string = 'first_load' // 首次加载: first_load, 上推刷新: push_up, 下拉刷新: pull_down
  32 + private refreshTime: number = new Date().getTime() // 第一页刷新时间,用于频道分页排序时过滤,查询时携带【首刷、下拉取当前最新时间;其他的都使用首刷的时间】
  33 + private channelId: string = '' // 频道id
  34 + private channelStrategy: string = '1' // 频道策略 1-推荐;2-时间线
  35 + // private topicId?: string = '' // 专题id
  36 + // private recommend?: string = '' // 0.非推荐,1.推荐;
  37 + @State @Watch('navIndexChange') bottomNavIndex: number = 0
  38 + @State @Watch('navIndexChange') topNavIndex: number = 0
16 private swiperController: SwiperController = new SwiperController() 39 private swiperController: SwiperController = new SwiperController()
17 @Provide showComment: boolean = false 40 @Provide showComment: boolean = false
18 @State data: ContentDetailDTO[] = [] 41 @State data: ContentDetailDTO[] = []
19 @State currentIndex: number = 0 42 @State currentIndex: number = 0
20 @State interactDataList: InteractDataDTO[] = [] 43 @State interactDataList: InteractDataDTO[] = []
  44 + @State totalCount: number = 0
21 45
22 - async aboutToAppear(): Promise<void> {  
23 - // let data: ContentDetailDTO[] = []  
24 - // let action: Action = router.getParams() as Action  
25 - // if (action) {  
26 - // this.contentId = action.params?.contentID || ''  
27 - // if (action.params && action.params.extra) {  
28 - // this.relId = action.params.extra.relId || ''  
29 - // this.relType = action.params.extra.relType || ''  
30 - // }  
31 - // await ContentDetailRequest.getContentDetail({  
32 - // contentId: this.contentId,  
33 - // relId: this.relId,  
34 - // relType: this.relType  
35 - // }).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {  
36 - // console.error('resDTO==', JSON.stringify(resDTO.data))  
37 - // if (resDTO.data) {  
38 - // this.data.push(resDTO.data[0])  
39 - // }  
40 - //  
41 - // })  
42 - // }  
43 -  
44 - await this.queryVideoList()  
45 -  
46 - // await ContentDetailRequest.postRecommendVideoList({  
47 - // pageSize: 5,  
48 - // refreshCnt: 1  
49 - // }).then(res => {  
50 - // if (res.data) {  
51 - // data = data.concat(res.data)  
52 - // }  
53 - // console.log('res1===', JSON.stringify(res))  
54 - // console.log('res==' + this.data)  
55 - // })  
56 -  
57 -  
58 - if (this.data.length > 0) {  
59 - const params: contentListParams = {  
60 - contentList: []  
61 - }  
62 - this.data.map(item => {  
63 - params.contentList.push({  
64 - contentId: item.newsId + '',  
65 - contentType: item.newsType  
66 - })  
67 - })  
68 - // 批量查询内容当前用户点赞、收藏状态  
69 - await ContentDetailRequest.getContentInteract(params).then(res => {  
70 - if (res.data) {  
71 - this.interactDataList = res.data || []  
72 - }  
73 - console.log('获取互动点赞等数据===', JSON.stringify(res))  
74 - })  
75 - // 查询各类型内容动态数据接口V2  
76 - 46 + /**
  47 + * 监听视频频道激活或失活
  48 + */
  49 + navIndexChange() {
  50 + if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
  51 + // 如果视频在暂停则播放视频
  52 + } else {
  53 + // 如果视频在播放则暂停视频
77 } 54 }
  55 + }
78 56
79 - // this.data = data  
80 - console.error('aboutToAppear===', this.data.length) 57 + async aboutToAppear(): Promise<void> {
  58 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  59 + const windowClass: window.Window = windowStage.getMainWindowSync();
  60 + windowClass.setWindowSystemBarProperties({
  61 + statusBarContentColor: '#ffffff',
  62 + })
  63 + console.error('aboutToAppear groupId', this.groupId)
  64 + console.error('aboutToAppear pageId', this.pageId)
  65 + console.error('aboutToAppear channelId', this.channelId)
  66 + // 根据视频频道传参查询视频楼层信息
  67 + this.getRecCompInfo()
  68 + }
81 69
  70 + aboutToDisappear(): void {
  71 + const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
  72 + const windowClass: window.Window = windowStage.getMainWindowSync();
  73 + windowClass.setWindowSystemBarProperties({
  74 + statusBarContentColor: '#000000',
  75 + })
  76 + console.error('aboutToDisappear videoChanel')
  77 + }
82 78
  79 + onPageHide(): void {
  80 + console.error('onPageHide videoChanel')
  81 + }
  82 +
  83 + onPageShow(): void {
  84 + console.error('onPageShow videoChanel')
83 } 85 }
84 86
85 /** 87 /**
86 - * 查询视频列表用于翻页 88 + * 根据视频频道传参查询视频楼层信息
87 */ 89 */
88 - async queryVideoList() {  
89 - await ContentDetailRequest.postRecommendVideoList({  
90 - pageSize: 5,  
91 - refreshCnt: 1  
92 - }).then(res => {  
93 - if (res.data) {  
94 - this.data = this.data.concat(res.data) 90 + async getRecCompInfo() {
  91 + if (this.data.length > 0 && this.data.length === this.totalCount) {
  92 + AlertDialog.show({ message: '没有更多视频了~' })
  93 + return
  94 + }
  95 +
  96 + const params: getRecCompInfoParams = {
  97 + groupId: this.groupId,
  98 + pageId: this.pageId,
  99 + channelId: this.channelId,
  100 + loadStrategy: this.loadStrategy,
  101 + channelStrategy: this.channelStrategy,
  102 + pageNum: this.pageNum,
  103 + pageSize: this.pageSize,
  104 + refreshTime: this.refreshTime,
  105 + }
  106 +
  107 + await ContentDetailRequest.getRecCompInfo(params).then(res => {
  108 + console.log('根据视频频道传参查询视频楼层信息', res.data?.totalCount)
  109 + console.log('根据视频频道传参查询视频楼层信息', JSON.stringify(res.data?.compList))
  110 +
  111 + this.totalCount = res.data?.totalCount || 0
  112 + const list1: batchContentDetailParams = {
  113 + contents: []
  114 + }
  115 + const list2: contentListParams = {
  116 + contentList: []
95 } 117 }
96 - console.log('queryVideoList===', JSON.stringify(this.data))  
97 - })  
98 - }  
99 118
100 - aboutToDisappear(): void { 119 + if (res.data?.compList.length) {
  120 + res.data?.compList.map((item: compListItem) => {
  121 + list1.contents.push({
  122 + contentId: item.operDataList[0].objectId,
  123 + contentRelId: item.operDataList[0].relId,
  124 + contentType: Number(item.operDataList[0].objectType),
  125 + relId: item.operDataList[0].relId,
  126 + relType: item.operDataList[0].relType,
  127 + })
  128 +
  129 + list2.contentList.push({
  130 + contentId: item.operDataList[0].objectId,
  131 + contentType: Number(item.operDataList[0].objectType),
  132 + })
  133 + })
  134 + }
  135 +
  136 + this.batchContentDetail(list1)
  137 + this.getContentInteract(list2)
101 138
  139 + }).catch((e: BusinessError) => {
  140 + console.error('eeeeeeeeeeeeee', e)
  141 + })
102 } 142 }
103 143
104 - onPageHide(): void { 144 + /**
  145 + * 根据视频楼层信息批量查询视频列表
  146 + */
  147 + async batchContentDetail(list: batchContentDetailParams) {
  148 + if (list.contents.length > 0) {
  149 + await ContentDetailRequest.batchContentDetail(list).then(res => {
  150 + console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
  151 + this.data = this.data.concat(res.data as [])
  152 + })
  153 + }
  154 + }
105 155
  156 + /**
  157 + * 根据视频信息批量查询点赞、收藏状态
  158 + */
  159 + async getContentInteract(list: contentListParams) {
  160 + if (list.contentList.length > 0) {
  161 + await ContentDetailRequest.getContentInteract(list).then(res => {
  162 + this.interactDataList = res.data || []
  163 + console.log('根据视频信息批量查询点赞、收藏状态', JSON.stringify(res))
  164 + })
  165 + }
106 } 166 }
107 167
108 build() { 168 build() {
@@ -133,7 +193,10 @@ export struct VideoChannelDetail { @@ -133,7 +193,10 @@ export struct VideoChannelDetail {
133 console.info('onChange==', index.toString()) 193 console.info('onChange==', index.toString())
134 194
135 if (this.currentIndex === this.data.length - 1) { 195 if (this.currentIndex === this.data.length - 1) {
136 - this.queryVideoList() 196 + this.pageNum++
  197 + this.refreshTime = new Date().getTime()
  198 + this.loadStrategy = 'push_up'
  199 + this.getRecCompInfo()
137 } 200 }
138 }) 201 })
139 202
@@ -144,7 +144,7 @@ export struct PlayerTitleComment { @@ -144,7 +144,7 @@ export struct PlayerTitleComment {
144 Column() { 144 Column() {
145 Slider({ 145 Slider({
146 value: this.progressVal, 146 value: this.progressVal,
147 - step: 1, 147 + step: 0.01,
148 // style: SliderStyle.OutSet 148 // style: SliderStyle.OutSet
149 }) 149 })
150 .blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent : $r('app.color.play_block_color')) 150 .blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent : $r('app.color.play_block_color'))
@@ -159,7 +159,7 @@ export struct PlayerTitleComment { @@ -159,7 +159,7 @@ export struct PlayerTitleComment {
159 .width('100%') 159 .width('100%')
160 .height(19) 160 .height(19)
161 .onChange((value: number, mode: SliderChangeMode) => { 161 .onChange((value: number, mode: SliderChangeMode) => {
162 - this.playerController?.setSeekTime(value, mode); 162 + this.playerController?.setSeekTime(Math.floor(value), mode);
163 }) 163 })
164 164
165 if (this.showComment) { 165 if (this.showComment) {
@@ -120,6 +120,9 @@ export class WDPlayerController { @@ -120,6 +120,9 @@ export class WDPlayerController {
120 this.avPlayer?.on(Events.ERROR, (error) => { 120 this.avPlayer?.on(Events.ERROR, (error) => {
121 this.playError(error.message); 121 this.playError(error.message);
122 }) 122 })
  123 + this.avPlayer?.on('seekDone', (time: number) => {
  124 + this.initProgress(time);
  125 + })
123 this.avPlayer?.on(Events.VIDEO_SIZE_CHANGE, (width: number, height: number) => { 126 this.avPlayer?.on(Events.VIDEO_SIZE_CHANGE, (width: number, height: number) => {
124 if (this.onVideoSizeChange) { 127 if (this.onVideoSizeChange) {
125 this.onVideoSizeChange(width, height); 128 this.onVideoSizeChange(width, height);
@@ -248,8 +251,8 @@ export class WDPlayerController { @@ -248,8 +251,8 @@ export class WDPlayerController {
248 // 100 / 1000)); 251 // 100 / 1000));
249 } 252 }
250 if (mode === SliderChangeMode.End) { 253 if (mode === SliderChangeMode.End) {
251 - this.seekTime = value * this.duration;  
252 - this.avPlayer?.seek(this.seekTime, media.SeekMode.SEEK_PREV_SYNC); 254 + this.seekTime = Math.floor(value * this.duration / 100);
  255 + this.avPlayer?.seek(this.seekTime);
253 } 256 }
254 } 257 }
255 258
@@ -269,7 +272,7 @@ export class WDPlayerController { @@ -269,7 +272,7 @@ export class WDPlayerController {
269 let nowSeconds = Math.floor(time / 1000); 272 let nowSeconds = Math.floor(time / 1000);
270 let totalSeconds = Math.floor(this.duration / 1000); 273 let totalSeconds = Math.floor(this.duration / 1000);
271 if (this.onTimeUpdate) { 274 if (this.onTimeUpdate) {
272 - this.onTimeUpdate(nowSeconds, totalSeconds); 275 + this.onTimeUpdate(time, this.duration);
273 } 276 }
274 } 277 }
275 278