Showing
11 changed files
with
274 additions
and
47 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 | */ |
| @@ -77,7 +76,7 @@ export class HttpUrlUtils { | @@ -77,7 +76,7 @@ export class HttpUrlUtils { | ||
| 77 | */ | 76 | */ |
| 78 | static readonly APPOINTMENT_QueryUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/queryUserDetail"; | 77 | static readonly APPOINTMENT_QueryUserDetail_PATH: string = "/api/rmrb-user-center/user/zh/c/queryUserDetail"; |
| 79 | /** | 78 | /** |
| 80 | - /** | 79 | + /** |
| 81 | * 个人中心 关注列表详情 | 80 | * 个人中心 关注列表详情 |
| 82 | */ | 81 | */ |
| 83 | static readonly FOLLOW_LIST_DETAIL_DATA_PATH: string = "/api/rmrb-creator-user/c/creatorDirectory/getContactMasterDetaiPage"; | 82 | static readonly FOLLOW_LIST_DETAIL_DATA_PATH: string = "/api/rmrb-creator-user/c/creatorDirectory/getContactMasterDetaiPage"; |
| @@ -101,22 +100,18 @@ export class HttpUrlUtils { | @@ -101,22 +100,18 @@ export class HttpUrlUtils { | ||
| 101 | * 我的收藏 | 100 | * 我的收藏 |
| 102 | */ | 101 | */ |
| 103 | static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; | 102 | static readonly APPOINTMENT_MyCollectionList_PATH: string = "/api/rmrb-interact/content/zh/c/interact"; |
| 104 | - | ||
| 105 | /** | 103 | /** |
| 106 | * 个人中心 我的评论列表 | 104 | * 个人中心 我的评论列表 |
| 107 | */ | 105 | */ |
| 108 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; | 106 | static readonly MINE_COMMENT_LIST_DATA_PATH: string = "/api/rmrb-comment/comment/zh/c/myCommentList"; |
| 109 | - | ||
| 110 | /** | 107 | /** |
| 111 | * 个人中心 APP获取用户等级 | 108 | * 个人中心 APP获取用户等级 |
| 112 | */ | 109 | */ |
| 113 | static readonly MINE_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/queryUserLevel"; | 110 | static readonly MINE_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/queryUserLevel"; |
| 114 | - | ||
| 115 | /** | 111 | /** |
| 116 | * 个人中心 APP获取其他用户等级 | 112 | * 个人中心 APP获取其他用户等级 |
| 117 | */ | 113 | */ |
| 118 | static readonly OTHER_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/batchUser"; | 114 | static readonly OTHER_USER_LEVEL_DATA_PATH: string = "/api/rmrb-user-point/auth/level/zh/c/batchUser"; |
| 119 | - | ||
| 120 | /** | 115 | /** |
| 121 | * 个人中心 (号主/普通用户)我的基本信息 | 116 | * 个人中心 (号主/普通用户)我的基本信息 |
| 122 | */ | 117 | */ |
| @@ -157,13 +152,11 @@ export class HttpUrlUtils { | @@ -157,13 +152,11 @@ export class HttpUrlUtils { | ||
| 157 | * pageSize=20&pageNum=1&topicId=10000009445 | 152 | * pageSize=20&pageNum=1&topicId=10000009445 |
| 158 | * */ | 153 | * */ |
| 159 | static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; | 154 | static readonly MORNING_EVENING_PAGE_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/pageInfo"; |
| 160 | - | ||
| 161 | static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; | 155 | static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; |
| 162 | - | ||
| 163 | private static hostUrl: string = HttpUrlUtils.HOST_PRODUCT; | 156 | private static hostUrl: string = HttpUrlUtils.HOST_PRODUCT; |
| 164 | - private static userId='' | ||
| 165 | - private static userType='' | ||
| 166 | - private static token='' | 157 | + private static userId = '' |
| 158 | + private static userType = '' | ||
| 159 | + private static token = '' | ||
| 167 | 160 | ||
| 168 | static getCommonHeaders(): HashMap<string, string> { | 161 | static getCommonHeaders(): HashMap<string, string> { |
| 169 | let headers: HashMap<string, string> = new HashMap<string, string>() | 162 | let headers: HashMap<string, string> = new HashMap<string, string>() |
| @@ -330,7 +323,7 @@ export class HttpUrlUtils { | @@ -330,7 +323,7 @@ export class HttpUrlUtils { | ||
| 330 | return HttpUrlUtils.userId | 323 | return HttpUrlUtils.userId |
| 331 | } | 324 | } |
| 332 | HttpUrlUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID,"") as string | 325 | HttpUrlUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID,"") as string |
| 333 | - return HttpUrlUtils.userId; | 326 | + return HttpUrlUtils.userId; |
| 334 | } | 327 | } |
| 335 | 328 | ||
| 336 | public static getUserType() { | 329 | public static getUserType() { |
| @@ -372,7 +365,7 @@ export class HttpUrlUtils { | @@ -372,7 +365,7 @@ export class HttpUrlUtils { | ||
| 372 | return url; | 365 | return url; |
| 373 | } | 366 | } |
| 374 | 367 | ||
| 375 | - static getAppLoginUrl() :string{ | 368 | + static getAppLoginUrl(): string { |
| 376 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/appLogin"; | 369 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/appLogin"; |
| 377 | return url; | 370 | return url; |
| 378 | } | 371 | } |
| @@ -511,16 +504,15 @@ export class HttpUrlUtils { | @@ -511,16 +504,15 @@ export class HttpUrlUtils { | ||
| 511 | // return headers; | 504 | // return headers; |
| 512 | // } | 505 | // } |
| 513 | 506 | ||
| 514 | - public static setUserId(userId:string){ | ||
| 515 | - HttpUrlUtils.userId=userId; | 507 | + public static setUserId(userId: string) { |
| 508 | + HttpUrlUtils.userId = userId; | ||
| 516 | } | 509 | } |
| 517 | 510 | ||
| 518 | - public static setUserType(userType:string){ | ||
| 519 | - HttpUrlUtils.userType=userType; | 511 | + public static setUserType(userType: string) { |
| 512 | + HttpUrlUtils.userType = userType; | ||
| 520 | } | 513 | } |
| 521 | 514 | ||
| 522 | - public static setUserToken(token:string){ | ||
| 523 | - HttpUrlUtils.token=token; | 515 | + public static setUserToken(token: string) { |
| 516 | + HttpUrlUtils.token = token; | ||
| 524 | } | 517 | } |
| 525 | - | ||
| 526 | } | 518 | } |
| @@ -69,9 +69,9 @@ export function registerRouter() { | @@ -69,9 +69,9 @@ export function registerRouter() { | ||
| 69 | Action2Page.register("JUMP_INNER_NEW_PAGE", (action) => { | 69 | Action2Page.register("JUMP_INNER_NEW_PAGE", (action) => { |
| 70 | if (action.params?.pageID == "E_NEWSPAPER") { | 70 | if (action.params?.pageID == "E_NEWSPAPER") { |
| 71 | return WDRouterPage.eNewspaper | 71 | return WDRouterPage.eNewspaper |
| 72 | - } else if (action.params?.pageID == "MorningEveningPaper"){ | 72 | + } else if (action.params?.pageID == "MorningEveningPaper") { |
| 73 | return WDRouterPage.morningEveningPaperPage | 73 | return WDRouterPage.morningEveningPaperPage |
| 74 | - } else if (action.params?.pageID == "IMAGE_TEXT_DETAIL"){ | 74 | + } else if (action.params?.pageID == "IMAGE_TEXT_DETAIL") { |
| 75 | return WDRouterPage.imageTextDetailPage | 75 | return WDRouterPage.imageTextDetailPage |
| 76 | } | 76 | } |
| 77 | return undefined | 77 | 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"); |
| @@ -37,7 +38,6 @@ export class WDRouterPage { | @@ -37,7 +38,6 @@ export class WDRouterPage { | ||
| 37 | // 音乐详情页 | 38 | // 音乐详情页 |
| 38 | static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail"); | 39 | static audioDetail = new WDRouterPage("phone", "ets/pages/detail/AudioDetail"); |
| 39 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); | 40 | static loginPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginPage"); |
| 40 | - | ||
| 41 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); | 41 | static forgetPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/ForgetPasswordPage"); |
| 42 | //我的 预约 | 42 | //我的 预约 |
| 43 | static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); | 43 | static appointmentListPage = new WDRouterPage("wdComponent", "ets/components/page/AppointmentListPage"); |
| @@ -64,10 +64,8 @@ export class WDRouterPage { | @@ -64,10 +64,8 @@ export class WDRouterPage { | ||
| 64 | static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); | 64 | static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); |
| 65 | // 设置密码页、设置手机号页等等 (需要传参) | 65 | // 设置密码页、设置手机号页等等 (需要传参) |
| 66 | static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage"); | 66 | static settingPasswordPage = new WDRouterPage("wdLogin", "ets/pages/login/SettingPasswordPage"); |
| 67 | - | ||
| 68 | //其他普通用户 主页 | 67 | //其他普通用户 主页 |
| 69 | static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); | 68 | static otherNormalUserHomePagePage = new WDRouterPage("wdComponent", "ets/pages/OtherNormalUserHomePage"); |
| 70 | - | ||
| 71 | static guidePage = new WDRouterPage("wdLogin", "ets/pages/guide/GuidePages"); | 69 | static guidePage = new WDRouterPage("wdLogin", "ets/pages/guide/GuidePages"); |
| 72 | 70 | ||
| 73 | //隐私政策页面 | 71 | //隐私政策页面 |
| @@ -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