Showing
11 changed files
with
275 additions
and
50 deletions
| @@ -26,7 +26,6 @@ export class HttpUrlUtils { | @@ -26,7 +26,6 @@ export class HttpUrlUtils { | ||
| 26 | * 启动接口(底导接口) | 26 | * 启动接口(底导接口) |
| 27 | */ | 27 | */ |
| 28 | static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup"; | 28 | static readonly BOTTOM_NAV_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup"; |
| 29 | - | ||
| 30 | /** | 29 | /** |
| 31 | * 展现pageInfo接口 | 30 | * 展现pageInfo接口 |
| 32 | */ | 31 | */ |
| @@ -42,24 +41,24 @@ export class HttpUrlUtils { | @@ -42,24 +41,24 @@ export class HttpUrlUtils { | ||
| 42 | /** | 41 | /** |
| 43 | * 批查接口,查询互动相关数据,如收藏数、评论数等 | 42 | * 批查接口,查询互动相关数据,如收藏数、评论数等 |
| 44 | */ | 43 | */ |
| 45 | - static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData"; | ||
| 46 | - | 44 | + static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/v2/content/interactData"; |
| 47 | // 多图(图集)详情页 | 45 | // 多图(图集)详情页 |
| 48 | /** | 46 | /** |
| 49 | * 批量查询内容当前用户点赞、收藏状态 | 47 | * 批量查询内容当前用户点赞、收藏状态 |
| 50 | */ | 48 | */ |
| 51 | static readonly INTERACT_DATA_STATUS: string = "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status"; | 49 | static readonly INTERACT_DATA_STATUS: string = "/api/rmrb-interact/interact/zh/c/batchLikeAndCollect/status"; |
| 52 | - | 50 | + /** |
| 51 | + * 沉浸式視頻批量查詢20條數據 | ||
| 52 | + */ | ||
| 53 | + static readonly RECOMMEND_VIDEOLIST: string = "/api/rmrb-bff-display-zh/recommend/zh/c/videoList"; | ||
| 53 | /** | 54 | /** |
| 54 | * 浏览历史新增、删除接口 | 55 | * 浏览历史新增、删除接口 |
| 55 | */ | 56 | */ |
| 56 | static readonly INTERACT_BROWS_OPERATE: string = "/api/rmrb-interact/interact/zh/c/brows/operate"; | 57 | static readonly INTERACT_BROWS_OPERATE: string = "/api/rmrb-interact/interact/zh/c/brows/operate"; |
| 57 | - | ||
| 58 | /** | 58 | /** |
| 59 | * 电子报信息 | 59 | * 电子报信息 |
| 60 | */ | 60 | */ |
| 61 | static readonly E_NEWSPAPER_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/paperApi/paperTime"; | 61 | static readonly E_NEWSPAPER_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/paperApi/paperTime"; |
| 62 | - | ||
| 63 | /** | 62 | /** |
| 64 | * 电子报列表 | 63 | * 电子报列表 |
| 65 | */ | 64 | */ |
| @@ -97,22 +96,18 @@ export class HttpUrlUtils { | @@ -97,22 +96,18 @@ export class HttpUrlUtils { | ||
| 97 | * 我的收藏 | 96 | * 我的收藏 |
| 98 | */ | 97 | */ |
| 99 | static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; | 98 | static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; |
| 100 | - | ||
| 101 | /** | 99 | /** |
| 102 | * 个人中心 我的评论列表 | 100 | * 个人中心 我的评论列表 |
| 103 | */ | 101 | */ |
| 104 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; | 102 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; |
| 105 | - | ||
| 106 | /** | 103 | /** |
| 107 | * 个人中心 APP获取用户等级 | 104 | * 个人中心 APP获取用户等级 |
| 108 | */ | 105 | */ |
| 109 | static readonly MINE_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/queryUserLevel"; | 106 | static readonly MINE_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/queryUserLevel"; |
| 110 | - | ||
| 111 | /** | 107 | /** |
| 112 | * 个人中心 APP获取其他用户等级 | 108 | * 个人中心 APP获取其他用户等级 |
| 113 | */ | 109 | */ |
| 114 | static readonly OTHER_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/batchUser"; | 110 | static readonly OTHER_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/batchUser"; |
| 115 | - | ||
| 116 | /** | 111 | /** |
| 117 | * 个人中心 (号主/普通用户)我的基本信息 | 112 | * 个人中心 (号主/普通用户)我的基本信息 |
| 118 | */ | 113 | */ |
| @@ -139,13 +134,11 @@ export class HttpUrlUtils { | @@ -139,13 +134,11 @@ export class HttpUrlUtils { | ||
| 139 | * pageSize=20&pageNum=1&topicId=10000009445 | 134 | * pageSize=20&pageNum=1&topicId=10000009445 |
| 140 | * */ | 135 | * */ |
| 141 | static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; | 136 | static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; |
| 142 | - | ||
| 143 | static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; | 137 | static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; |
| 144 | - | ||
| 145 | private static hostUrl: string = HttpUrlUtils.HOST_PRODUCT; | 138 | private static hostUrl: string = HttpUrlUtils.HOST_PRODUCT; |
| 146 | - private static userId='' | ||
| 147 | - private static userType='' | ||
| 148 | - private static token='' | 139 | + private static userId = '' |
| 140 | + private static userType = '' | ||
| 141 | + private static token = '' | ||
| 149 | 142 | ||
| 150 | static getCommonHeaders(): HashMap<string, string> { | 143 | static getCommonHeaders(): HashMap<string, string> { |
| 151 | let headers: HashMap<string, string> = new HashMap<string, string>() | 144 | let headers: HashMap<string, string> = new HashMap<string, string>() |
| @@ -158,8 +151,8 @@ export class HttpUrlUtils { | @@ -158,8 +151,8 @@ export class HttpUrlUtils { | ||
| 158 | headers.set('timestamp', HttpUrlUtils.getTimestamp()) | 151 | headers.set('timestamp', HttpUrlUtils.getTimestamp()) |
| 159 | headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken()) | 152 | headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken()) |
| 160 | headers.set('device_id', HttpUrlUtils.getDeviceId()) | 153 | headers.set('device_id', HttpUrlUtils.getDeviceId()) |
| 161 | - if(HttpUrlUtils.token!=''){ | ||
| 162 | - headers.set('cookie', 'RMRB-X-TOKEN='+HttpUrlUtils.token) | 154 | + if (HttpUrlUtils.token != '') { |
| 155 | + headers.set('cookie', 'RMRB-X-TOKEN=' + HttpUrlUtils.token) | ||
| 163 | } | 156 | } |
| 164 | headers.set('build_version', HttpUrlUtils.getVersion()) | 157 | headers.set('build_version', HttpUrlUtils.getVersion()) |
| 165 | headers.set('adcode', HttpUrlUtils.getAdCode()) | 158 | headers.set('adcode', HttpUrlUtils.getAdCode()) |
| @@ -343,7 +336,7 @@ export class HttpUrlUtils { | @@ -343,7 +336,7 @@ export class HttpUrlUtils { | ||
| 343 | return url; | 336 | return url; |
| 344 | } | 337 | } |
| 345 | 338 | ||
| 346 | - static getAppLoginUrl() :string{ | 339 | + static getAppLoginUrl(): string { |
| 347 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/appLogin"; | 340 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/appLogin"; |
| 348 | return url; | 341 | return url; |
| 349 | } | 342 | } |
| @@ -424,7 +417,6 @@ export class HttpUrlUtils { | @@ -424,7 +417,6 @@ export class HttpUrlUtils { | ||
| 424 | } | 417 | } |
| 425 | 418 | ||
| 426 | 419 | ||
| 427 | - | ||
| 428 | static getYcgCommonHeaders(): HashMap<string, string> { | 420 | static getYcgCommonHeaders(): HashMap<string, string> { |
| 429 | let headers: HashMap<string, string> = new HashMap<string, string>() | 421 | let headers: HashMap<string, string> = new HashMap<string, string>() |
| 430 | 422 | ||
| @@ -463,16 +455,15 @@ export class HttpUrlUtils { | @@ -463,16 +455,15 @@ export class HttpUrlUtils { | ||
| 463 | return headers; | 455 | return headers; |
| 464 | } | 456 | } |
| 465 | 457 | ||
| 466 | - public static setUserId(userId:string){ | ||
| 467 | - HttpUrlUtils.userId=userId; | 458 | + public static setUserId(userId: string) { |
| 459 | + HttpUrlUtils.userId = userId; | ||
| 468 | } | 460 | } |
| 469 | 461 | ||
| 470 | - public static setUserType(userType:string){ | ||
| 471 | - HttpUrlUtils.userType=userType; | 462 | + public static setUserType(userType: string) { |
| 463 | + HttpUrlUtils.userType = userType; | ||
| 472 | } | 464 | } |
| 473 | 465 | ||
| 474 | - public static setUserToken(token:string){ | ||
| 475 | - HttpUrlUtils.token=token; | 466 | + public static setUserToken(token: string) { |
| 467 | + HttpUrlUtils.token = token; | ||
| 476 | } | 468 | } |
| 477 | - | ||
| 478 | } | 469 | } |
| @@ -53,8 +53,8 @@ export function registerRouter() { | @@ -53,8 +53,8 @@ export function registerRouter() { | ||
| 53 | // return WDRouterPage.detailPlayLivePage | 53 | // return WDRouterPage.detailPlayLivePage |
| 54 | // } | 54 | // } |
| 55 | if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { | 55 | if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { |
| 56 | - return WDRouterPage.detailPlayShortVideoPage | ||
| 57 | - } else if (action.params?.detailPageType == 9 ) { | 56 | + return WDRouterPage.detailVideoListPage |
| 57 | + } else if (action.params?.detailPageType == 9) { | ||
| 58 | return WDRouterPage.multiPictureDetailPage | 58 | return WDRouterPage.multiPictureDetailPage |
| 59 | } | 59 | } |
| 60 | return WDRouterPage.detailPlayVodPage | 60 | return WDRouterPage.detailPlayVodPage |
| @@ -67,9 +67,9 @@ export function registerRouter() { | @@ -67,9 +67,9 @@ export function registerRouter() { | ||
| 67 | Action2Page.register("JUMP_INNER_NEW_PAGE", (action) => { | 67 | Action2Page.register("JUMP_INNER_NEW_PAGE", (action) => { |
| 68 | if (action.params?.pageID == "E_NEWSPAPER") { | 68 | if (action.params?.pageID == "E_NEWSPAPER") { |
| 69 | return WDRouterPage.eNewspaper | 69 | return WDRouterPage.eNewspaper |
| 70 | - } else if (action.params?.pageID == "MorningEveningPaper"){ | 70 | + } else if (action.params?.pageID == "MorningEveningPaper") { |
| 71 | return WDRouterPage.morningEveningPaperPage | 71 | return WDRouterPage.morningEveningPaperPage |
| 72 | - } else if (action.params?.pageID == "IMAGE_TEXT_DETAIL"){ | 72 | + } else if (action.params?.pageID == "IMAGE_TEXT_DETAIL") { |
| 73 | return WDRouterPage.imageTextDetailPage | 73 | return WDRouterPage.imageTextDetailPage |
| 74 | } | 74 | } |
| 75 | return undefined | 75 | return undefined |
| @@ -27,6 +27,7 @@ export class WDRouterPage { | @@ -27,6 +27,7 @@ export class WDRouterPage { | ||
| 27 | // 图文详情页 | 27 | // 图文详情页 |
| 28 | static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); | 28 | static imageTextDetailPage = new WDRouterPage("phone", "ets/pages/ImageAndTextDetailPage"); |
| 29 | // 短视频详情页 | 29 | // 短视频详情页 |
| 30 | + static detailVideoListPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailVideoListPage"); | ||
| 30 | static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); | 31 | static detailPlayShortVideoPage = new WDRouterPage("wdDetailPlayShortVideo", "ets/pages/DetailPlayShortVideoPage"); |
| 31 | // 点播详情页 | 32 | // 点播详情页 |
| 32 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); | 33 | static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); |
| @@ -34,9 +35,7 @@ export class WDRouterPage { | @@ -34,9 +35,7 @@ export class WDRouterPage { | ||
| 34 | static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); | 35 | static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); |
| 35 | // 多图(图集)详情页 | 36 | // 多图(图集)详情页 |
| 36 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); | 37 | static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); |
| 37 | - | ||
| 38 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | 38 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); |
| 39 | - | ||
| 40 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | 39 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); |
| 41 | //我的 预约 | 40 | //我的 预约 |
| 42 | static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); | 41 | static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); |
| @@ -63,9 +62,7 @@ export class WDRouterPage { | @@ -63,9 +62,7 @@ export class WDRouterPage { | ||
| 63 | static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); | 62 | static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); |
| 64 | // 设置密码页、设置手机号页等等 (需要传参) | 63 | // 设置密码页、设置手机号页等等 (需要传参) |
| 65 | static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage"); | 64 | static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage"); |
| 66 | - | ||
| 67 | //其他普通用户 主页 | 65 | //其他普通用户 主页 |
| 68 | static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); | 66 | static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); |
| 69 | - | ||
| 70 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); | 67 | // static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview"); |
| 71 | } | 68 | } |
| @@ -13,6 +13,12 @@ export interface ContentDetailRequestParams { | @@ -13,6 +13,12 @@ export interface ContentDetailRequestParams { | ||
| 13 | relType: string | 13 | relType: string |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | +export interface recommentVideoListParame { | ||
| 17 | + pageSize: number; | ||
| 18 | + refreshCnt: number; | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | + | ||
| 16 | export class ContentDetailRequest { | 22 | export class ContentDetailRequest { |
| 17 | static getContentDetailDataMock(context: Context): Promise<ResponseDTO<ContentDetailDTO[]>> { | 23 | static getContentDetailDataMock(context: Context): Promise<ResponseDTO<ContentDetailDTO[]>> { |
| 18 | Logger.info(TAG, `getContentDetailDataMock start`); | 24 | Logger.info(TAG, `getContentDetailDataMock start`); |
| @@ -26,10 +32,10 @@ export class ContentDetailRequest { | @@ -26,10 +32,10 @@ export class ContentDetailRequest { | ||
| 26 | /** | 32 | /** |
| 27 | * 新闻内容详情【get】接口 | 33 | * 新闻内容详情【get】接口 |
| 28 | */ | 34 | */ |
| 29 | - static readonly CONTENT_DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; | 35 | + // static readonly CONTENT_DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail"; |
| 30 | 36 | ||
| 31 | static getContentDetailUrl(contentId: string, relId: string, relType: string) { | 37 | static getContentDetailUrl(contentId: string, relId: string, relType: string) { |
| 32 | - let url = HttpUrlUtils.getHost() + ContentDetailRequest.CONTENT_DETAIL_PATH | 38 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.DETAIL_PATH |
| 33 | url = url + "?&contentId=" + contentId | 39 | url = url + "?&contentId=" + contentId |
| 34 | + "&relId=" + relId | 40 | + "&relId=" + relId |
| 35 | + "&relType=" + relType; | 41 | + "&relType=" + relType; |
| @@ -44,4 +50,46 @@ export class ContentDetailRequest { | @@ -44,4 +50,46 @@ export class ContentDetailRequest { | ||
| 44 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 50 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 45 | return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url, headers) | 51 | return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url, headers) |
| 46 | } | 52 | } |
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * | ||
| 56 | + * @returns | ||
| 57 | + */ | ||
| 58 | + static getContentInteract() { | ||
| 59 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH | ||
| 60 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 61 | + return WDHttp.get(url, headers) | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + /** | ||
| 65 | + * | ||
| 66 | + * @returns | ||
| 67 | + */ | ||
| 68 | + static postBatchLikeAndCollectStatus() { | ||
| 69 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_STATUS | ||
| 70 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 71 | + return WDHttp.post(url, headers) | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * | ||
| 76 | + * @returns | ||
| 77 | + */ | ||
| 78 | + static postBatchAttentionStatus() { | ||
| 79 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH | ||
| 80 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 81 | + return WDHttp.post(url, headers) | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 沉浸式視頻查詢近20条数据 | ||
| 87 | + * @returns | ||
| 88 | + */ | ||
| 89 | + | ||
| 90 | + static postRecommendVideoList(params: recommentVideoListParame): Promise<ResponseDTO<ContentDetailDTO[]>> { | ||
| 91 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.RECOMMEND_VIDEOLIST | ||
| 92 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 93 | + return WDHttp.post0(url, params, headers) | ||
| 94 | + } | ||
| 47 | } | 95 | } |
| 1 | import router from '@ohos.router'; | 1 | import router from '@ohos.router'; |
| 2 | import mediaquery from '@ohos.mediaquery'; | 2 | import mediaquery from '@ohos.mediaquery'; |
| 3 | import window from '@ohos.window'; | 3 | import window from '@ohos.window'; |
| 4 | -import { Action, RmhInfoDTO, UserInfoDTO } from 'wdBean'; | 4 | +import { Action, ContentDetailDTO, RmhInfoDTO, UserInfoDTO } from 'wdBean'; |
| 5 | import { Logger, SPHelper, WindowModel } from 'wdKit'; | 5 | import { Logger, SPHelper, WindowModel } from 'wdKit'; |
| 6 | import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; | 6 | import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; |
| 7 | import { devicePLSensorManager } from 'wdDetailPlayApi'; | 7 | import { devicePLSensorManager } from 'wdDetailPlayApi'; |
| @@ -15,12 +15,15 @@ const TAG = 'DetailPlayShortVideoPage'; | @@ -15,12 +15,15 @@ const TAG = 'DetailPlayShortVideoPage'; | ||
| 15 | /** | 15 | /** |
| 16 | * 详情&短视频播放页面 | 16 | * 详情&短视频播放页面 |
| 17 | */ | 17 | */ |
| 18 | -@Entry | 18 | + |
| 19 | @Component | 19 | @Component |
| 20 | export struct DetailPlayShortVideoPage { | 20 | export struct DetailPlayShortVideoPage { |
| 21 | private contentId?: string = undefined | 21 | private contentId?: string = undefined |
| 22 | private relId?: string = undefined | 22 | private relId?: string = undefined |
| 23 | private relType?: string = undefined | 23 | private relType?: string = undefined |
| 24 | + private contentDetailData: ContentDetailDTO | undefined = undefined | ||
| 25 | + @Prop @Watch('currentIndexChange') currentIndex: number = 0 | ||
| 26 | + private index: number = 0 | ||
| 24 | private playerController: WDPlayerController = new WDPlayerController(); | 27 | private playerController: WDPlayerController = new WDPlayerController(); |
| 25 | @Watch("urlChanged") @State url?: string = undefined | 28 | @Watch("urlChanged") @State url?: string = undefined |
| 26 | @Watch('changeContinue') @Provide nextContId?: string = ''; | 29 | @Watch('changeContinue') @Provide nextContId?: string = ''; |
| @@ -55,7 +58,21 @@ export struct DetailPlayShortVideoPage { | @@ -55,7 +58,21 @@ export struct DetailPlayShortVideoPage { | ||
| 55 | this.userInfo = this.playVM.userInfo | 58 | this.userInfo = this.playVM.userInfo |
| 56 | } | 59 | } |
| 57 | 60 | ||
| 61 | + currentIndexChange() { | ||
| 62 | + console.log('currentIndexChange====', this.currentIndex) | ||
| 63 | + if (this.currentIndex != this.index) { | ||
| 64 | + this.playerController.pause() | ||
| 65 | + } else { | ||
| 66 | + console.log('currentIndexChange====1', this.playerController) | ||
| 67 | + this.playerController.switchPlayOrPause() | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + | ||
| 58 | aboutToAppear() { | 71 | aboutToAppear() { |
| 72 | + console.log('开始设置setContentDetailData', JSON.stringify(this.contentDetailData)) | ||
| 73 | + | ||
| 74 | + this.playVM.setContentDetailData(this.contentDetailData) | ||
| 75 | + | ||
| 59 | let action: Action = router.getParams() as Action | 76 | let action: Action = router.getParams() as Action |
| 60 | Logger.info(TAG, "action", JSON.stringify(action)) | 77 | Logger.info(TAG, "action", JSON.stringify(action)) |
| 61 | if (action) { | 78 | if (action) { |
| @@ -79,12 +96,23 @@ export struct DetailPlayShortVideoPage { | @@ -79,12 +96,23 @@ export struct DetailPlayShortVideoPage { | ||
| 79 | } | 96 | } |
| 80 | WindowModel.shared.setMainWindowFullScreen(this.isFullScreen) | 97 | WindowModel.shared.setMainWindowFullScreen(this.isFullScreen) |
| 81 | }) | 98 | }) |
| 99 | + console.error('111,', this.index, this.currentIndex) | ||
| 100 | + if (this.index == 0 && this.currentIndex === this.index) { | ||
| 101 | + setTimeout(() => { | ||
| 102 | + this.playerController.play() | ||
| 103 | + }, 2000) | ||
| 104 | + | ||
| 105 | + } | ||
| 82 | } | 106 | } |
| 83 | 107 | ||
| 84 | onPageShow() { | 108 | onPageShow() { |
| 85 | WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); | 109 | WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); |
| 86 | } | 110 | } |
| 87 | 111 | ||
| 112 | + aboutToDisappear(): void { | ||
| 113 | + this.playerController?.pause(); | ||
| 114 | + } | ||
| 115 | + | ||
| 88 | onPageHide() { | 116 | onPageHide() { |
| 89 | WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT); | 117 | WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT); |
| 90 | devicePLSensorManager.devicePLSensorOff(); | 118 | devicePLSensorManager.devicePLSensorOff(); |
| @@ -100,12 +128,16 @@ export struct DetailPlayShortVideoPage { | @@ -100,12 +128,16 @@ export struct DetailPlayShortVideoPage { | ||
| 100 | onLoad: async () => { | 128 | onLoad: async () => { |
| 101 | console.log('onload==', this.contentId, this.relId, this.relType) | 129 | console.log('onload==', this.contentId, this.relId, this.relType) |
| 102 | // this.playVM.playWithContentId(this.contentId ?? "846899373") | 130 | // this.playVM.playWithContentId(this.contentId ?? "846899373") |
| 103 | - this.playVM.playWithIds(this.contentId ?? "846899373", | ||
| 104 | - this.relId ?? "500000301942", this.relType ?? "1") | 131 | + this.playVM.playWithIds(this.contentId, |
| 132 | + this.relId, this.relType) | ||
| 105 | } | 133 | } |
| 106 | }) | 134 | }) |
| 107 | .height('100%') | 135 | .height('100%') |
| 108 | .width('100%') | 136 | .width('100%') |
| 137 | + .onClick(() => { | ||
| 138 | + console.error('WDPlayerRenderView=== onClick') | ||
| 139 | + this.playerController?.switchPlayOrPause(); | ||
| 140 | + }) | ||
| 109 | } | 141 | } |
| 110 | 142 | ||
| 111 | @Builder | 143 | @Builder |
| @@ -130,16 +162,21 @@ export struct DetailPlayShortVideoPage { | @@ -130,16 +162,21 @@ export struct DetailPlayShortVideoPage { | ||
| 130 | playerView: () => { | 162 | playerView: () => { |
| 131 | this.playerViewContainerBuilder() | 163 | this.playerViewContainerBuilder() |
| 132 | }, playControlView: () => { | 164 | }, playControlView: () => { |
| 133 | - this.playControlViewContainerBuilder() | 165 | + // this.playControlViewContainerBuilder() |
| 134 | }, detailView: () => { | 166 | }, detailView: () => { |
| 135 | this.detailContainerBuilder() | 167 | this.detailContainerBuilder() |
| 136 | } | 168 | } |
| 137 | }) | 169 | }) |
| 138 | .height('100%') | 170 | .height('100%') |
| 139 | .width('100%') | 171 | .width('100%') |
| 172 | + .onClick(() => { | ||
| 173 | + console.error('PlayerDetailContainer=== onClick') | ||
| 174 | + this.playerController?.switchPlayOrPause(); | ||
| 175 | + }) | ||
| 140 | } | 176 | } |
| 141 | .height('100%') | 177 | .height('100%') |
| 142 | .width('100%') | 178 | .width('100%') |
| 179 | + | ||
| 143 | .backgroundColor(Color.Black) | 180 | .backgroundColor(Color.Black) |
| 144 | } | 181 | } |
| 145 | 182 |
| 1 | +import { Action, ContentDetailDTO } from 'wdBean/Index'; | ||
| 2 | +import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | ||
| 3 | +import { ResponseDTO } from 'wdNetwork/Index'; | ||
| 4 | +import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' | ||
| 5 | +import { Test } from './Test' | ||
| 6 | +import router from '@ohos.router'; | ||
| 7 | + | ||
| 8 | +@Entry | ||
| 9 | +@Component | ||
| 10 | +export struct DetailVideoListPage { | ||
| 11 | + private contentId: string = '' | ||
| 12 | + private relId: string = '' | ||
| 13 | + private relType: string = '' | ||
| 14 | + private swiperController: SwiperController = new SwiperController() | ||
| 15 | + @State data: ContentDetailDTO[] = [] | ||
| 16 | + @State testData: string[] = ['111', '222', '333'] | ||
| 17 | + @State currentIndex: number = 0 | ||
| 18 | + | ||
| 19 | + async aboutToAppear(): Promise<void> { | ||
| 20 | + let data: ContentDetailDTO[] = [] | ||
| 21 | + let action: Action = router.getParams() as Action | ||
| 22 | + if (action) { | ||
| 23 | + this.contentId = action.params?.contentID || '' | ||
| 24 | + if (action.params && action.params.extra) { | ||
| 25 | + this.relId = action.params.extra.relId || '' | ||
| 26 | + this.relType = action.params.extra.relType || '' | ||
| 27 | + } | ||
| 28 | + await ContentDetailRequest.getContentDetail({ | ||
| 29 | + contentId: this.contentId, | ||
| 30 | + relId: this.relId, | ||
| 31 | + relType: this.relType | ||
| 32 | + }).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { | ||
| 33 | + console.error('resDTO==', JSON.stringify(resDTO.data)) | ||
| 34 | + if (resDTO.data) { | ||
| 35 | + data.push(resDTO.data[0]) | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + }) | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + await ContentDetailRequest.postRecommendVideoList({ | ||
| 42 | + pageSize: 10, | ||
| 43 | + refreshCnt: 1 | ||
| 44 | + }).then(res => { | ||
| 45 | + if (res.data) { | ||
| 46 | + data = data.concat(res.data) | ||
| 47 | + } | ||
| 48 | + // this.data = res.data || [] | ||
| 49 | + console.log('res1===', JSON.stringify(res)) | ||
| 50 | + console.log('res==' + this.data) | ||
| 51 | + }) | ||
| 52 | + | ||
| 53 | + this.data = data | ||
| 54 | + console.error('aboutToAppear===', this.data.length) | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + build() { | ||
| 60 | + Column() { | ||
| 61 | + Swiper(this.swiperController) { | ||
| 62 | + | ||
| 63 | + ForEach(this.data, (item: ContentDetailDTO, index: number) => { | ||
| 64 | + Column() { | ||
| 65 | + DetailPlayShortVideoPage({ | ||
| 66 | + contentDetailData: item, | ||
| 67 | + currentIndex: this.currentIndex, | ||
| 68 | + index: index | ||
| 69 | + }) | ||
| 70 | + }.width('100%') | ||
| 71 | + .height('100%') | ||
| 72 | + }, (item: ContentDetailDTO) => item.newsId + '') | ||
| 73 | + | ||
| 74 | + // ForEach(this.testData, (item: string, index: number) => { | ||
| 75 | + // Column() { | ||
| 76 | + // Test({ currentItem: item, currentIndex: this.currentIndex, index: index }) | ||
| 77 | + // } | ||
| 78 | + // .width('100%') | ||
| 79 | + // .height('100%') | ||
| 80 | + // }, (item: string) => item) | ||
| 81 | + | ||
| 82 | + } | ||
| 83 | + .cachedCount(2) | ||
| 84 | + .indicator(false) | ||
| 85 | + .vertical(true) | ||
| 86 | + .width('100%') | ||
| 87 | + .height('100%') | ||
| 88 | + | ||
| 89 | + .onChange((index: number) => { | ||
| 90 | + this.currentIndex = index | ||
| 91 | + console.info('onChange==', index.toString()) | ||
| 92 | + }) | ||
| 93 | + | ||
| 94 | + }.width('100%').height('100%') | ||
| 95 | + } | ||
| 96 | +} |
| 1 | +@Entry | ||
| 2 | +@Component | ||
| 3 | +export struct Test { | ||
| 4 | + @Prop currentItem: string = ''; | ||
| 5 | + @Prop @Watch('currentIndexChange') currentIndex: number = 0; | ||
| 6 | + @Prop index: number = 0; | ||
| 7 | + | ||
| 8 | + currentIndexChange() { | ||
| 9 | + console.log('currentIndexChange====', this.currentIndex); | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + build() { | ||
| 13 | + Row() { | ||
| 14 | + Column() { | ||
| 15 | + Text('currentItem: ' + this.currentItem).fontSize(30) | ||
| 16 | + Text('currentIndex: ' + this.currentIndex).fontSize(30) | ||
| 17 | + Text('index: ' + this.index).fontSize(30) | ||
| 18 | + } | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | +} |
| 1 | /** | 1 | /** |
| 2 | * 详情view&播放器view的容器布局组件 | 2 | * 详情view&播放器view的容器布局组件 |
| 3 | */ | 3 | */ |
| 4 | -@Entry | 4 | + |
| 5 | @Component | 5 | @Component |
| 6 | export struct PlayerDetailContainer { | 6 | export struct PlayerDetailContainer { |
| 7 | @BuilderParam playerView: () => void | 7 | @BuilderParam playerView: () => void |
| @@ -102,5 +102,6 @@ export struct PlayerDetailContainer { | @@ -102,5 +102,6 @@ export struct PlayerDetailContainer { | ||
| 102 | } | 102 | } |
| 103 | .width('100%') | 103 | .width('100%') |
| 104 | .height('100%') | 104 | .height('100%') |
| 105 | + | ||
| 105 | } | 106 | } |
| 106 | } | 107 | } |
| @@ -26,25 +26,48 @@ export class PlayViewModel { | @@ -26,25 +26,48 @@ export class PlayViewModel { | ||
| 26 | canStart?: boolean | 26 | canStart?: boolean |
| 27 | message?: string | 27 | message?: string |
| 28 | 28 | ||
| 29 | - constructor() { | 29 | + constructor(contentId: string = '', relId: string = '', relType: string = '') { |
| 30 | // todo: | 30 | // todo: |
| 31 | - this.contentId = '30013266075' | ||
| 32 | - this.relId = '500000301942' | ||
| 33 | - this.relType = '1' | 31 | + this.contentId = contentId // '30013266075' |
| 32 | + this.relId = relId // '500000301942' | ||
| 33 | + this.relType = relType // '1' | ||
| 34 | 34 | ||
| 35 | // this.getGlobalInfo(); | 35 | // this.getGlobalInfo(); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | playWithContentId(contentId: string) { | 38 | playWithContentId(contentId: string) { |
| 39 | this.contentId = contentId; | 39 | this.contentId = contentId; |
| 40 | - this.getContentDetailData() // 包括播放地址PlayUrl | 40 | + // this.getContentDetailData() // 包括播放地址PlayUrl |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | playWithIds(contentId: string, relId: string, relType: string) { | 43 | playWithIds(contentId: string, relId: string, relType: string) { |
| 44 | this.contentId = contentId; | 44 | this.contentId = contentId; |
| 45 | this.relId = relId; | 45 | this.relId = relId; |
| 46 | this.relType = relType; | 46 | this.relType = relType; |
| 47 | - this.getContentDetailData() // 包括播放地址PlayUrl | 47 | + // this.getContentDetailData() // 包括播放地址PlayUrl |
| 48 | + } | ||
| 49 | + | ||
| 50 | + setContentDetailData(data: ContentDetailDTO | undefined) { | ||
| 51 | + if (!data) { | ||
| 52 | + Logger.error(TAG, 'setContentDetailData is empty'); | ||
| 53 | + return | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + Logger.info(TAG, JSON.stringify(data)) | ||
| 57 | + this.newsTitle = data.newsTitle | ||
| 58 | + this.editorName = data.editorName | ||
| 59 | + this.newsSummary = data.newsSummary | ||
| 60 | + this.userInfo = data.userInfo | ||
| 61 | + this.rmhInfo = data.rmhInfo | ||
| 62 | + if (data.videoInfo?.length > 0) { | ||
| 63 | + this.url = data.videoInfo[0].videoUrl | ||
| 64 | + this.videoLandScape = data.videoInfo[0].videoLandScape | ||
| 65 | + } | ||
| 66 | + if (data.authorList?.length > 0) { | ||
| 67 | + this.newsSourceName = data.authorList[0].authorName | ||
| 68 | + } | ||
| 69 | + this.canStart = true; | ||
| 70 | + this.message = ''; | ||
| 48 | } | 71 | } |
| 49 | 72 | ||
| 50 | getContentDetailData() { | 73 | getContentDetailData() { |
| @@ -72,7 +72,7 @@ export class WDPlayerController { | @@ -72,7 +72,7 @@ export class WDPlayerController { | ||
| 72 | if (this.startTime) { | 72 | if (this.startTime) { |
| 73 | this.setSeekTime(this.startTime, SliderChangeMode.Begin); | 73 | this.setSeekTime(this.startTime, SliderChangeMode.Begin); |
| 74 | } | 74 | } |
| 75 | - this.avPlayer.play(); | 75 | + // this.avPlayer.play(); |
| 76 | this.duration = this.avPlayer.duration; | 76 | this.duration = this.avPlayer.duration; |
| 77 | break; | 77 | break; |
| 78 | case AVPlayerStatus.PLAYING: | 78 | case AVPlayerStatus.PLAYING: |
| @@ -162,6 +162,16 @@ export class WDPlayerController { | @@ -162,6 +162,16 @@ export class WDPlayerController { | ||
| 162 | this.avPlayer.pause(); | 162 | this.avPlayer.pause(); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | + async play() { | ||
| 166 | + if (this.avPlayer == null) { | ||
| 167 | + await this.initPromise; | ||
| 168 | + } | ||
| 169 | + if (this.avPlayer == null) { | ||
| 170 | + return | ||
| 171 | + } | ||
| 172 | + this.avPlayer.play(); | ||
| 173 | + } | ||
| 174 | + | ||
| 165 | async stop() { | 175 | async stop() { |
| 166 | if (this.avPlayer == null) { | 176 | if (this.avPlayer == null) { |
| 167 | await this.initPromise; | 177 | await this.initPromise; |
-
Please register or login to post a comment