liujian1_wd

图文详情页面

@@ -3,6 +3,8 @@ import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; @@ -3,6 +3,8 @@ import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { CompUtils } from '../../utils/CompUtils'; 4 import { CompUtils } from '../../utils/CompUtils';
5 import { WDRouterRule } from 'wdRouter'; 5 import { WDRouterRule } from 'wdRouter';
  6 +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
  7 +import { ProcessUtils } from '../../utils/ProcessUtils';
6 8
7 const TAG: string = 'CardView'; 9 const TAG: string = 'CardView';
8 10
@@ -71,22 +73,7 @@ export struct CarouselLayout01CardView { @@ -71,22 +73,7 @@ export struct CarouselLayout01CardView {
71 .hoverEffect(HoverEffect.Scale) 73 .hoverEffect(HoverEffect.Scale)
72 .onClick((event: ClickEvent) => { 74 .onClick((event: ClickEvent) => {
73 Logger.info(TAG, `BannerComponent onClick event index: ${this.index}`); 75 Logger.info(TAG, `BannerComponent onClick event index: ${this.index}`);
74 - // let taskAction: Action = {  
75 - // type: 'JUMP_H5_BY_WEB_VIEW',  
76 - // params: {  
77 - // url: ConfigConstants.DETAIL_URL  
78 - // } as Params,  
79 - // };  
80 - // WDRouterRule.jumpWithAction(taskAction)  
81 -  
82 - let taskAction: Action = {  
83 - type: 'JUMP_DETAIL_PAGE',  
84 - params: {  
85 - detailPageType: 7, // 沉浸式竖屏详情页  
86 - contentID: '863556812'  
87 - } as Params,  
88 - };  
89 - WDRouterRule.jumpWithAction(taskAction) 76 + ProcessUtils.processPage(this.item)
90 }) 77 })
91 } 78 }
92 } 79 }
1 -import { CompDTO } from 'wdBean'; 1 +import { Action, CompDTO, Params } from 'wdBean';
  2 +import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
  3 +import { WDRouterRule } from 'wdRouter';
2 import { ProcessUtils } from '../../utils/ProcessUtils'; 4 import { ProcessUtils } from '../../utils/ProcessUtils';
3 5
4 const TAG = 'SingleImageCardComponent'; 6 const TAG = 'SingleImageCardComponent';
@@ -30,7 +30,7 @@ export class ProcessUtils { @@ -30,7 +30,7 @@ export class ProcessUtils {
30 break; 30 break;
31 case ContentConstants.TYPE_VOD: 31 case ContentConstants.TYPE_VOD:
32 Logger.debug(TAG, "processPage, nonsupport!!!"); 32 Logger.debug(TAG, "processPage, nonsupport!!!");
33 - // TODO 待对接更多页面 33 + ProcessUtils.gotoVod(content)
34 break; 34 break;
35 case ContentConstants.TYPE_TELETEXT: 35 case ContentConstants.TYPE_TELETEXT:
36 // 图文详情,跳转h5 36 // 图文详情,跳转h5
@@ -67,4 +67,20 @@ export class ProcessUtils { @@ -67,4 +67,20 @@ export class ProcessUtils {
67 WDRouterRule.jumpWithAction(taskAction) 67 WDRouterRule.jumpWithAction(taskAction)
68 Logger.debug(TAG, `gotoWeb, ${content.objectId}`); 68 Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
69 } 69 }
  70 +
  71 + private static gotoVod(content: ContentDTO) {
  72 + let taskAction: Action = {
  73 + type: 'JUMP_DETAIL_PAGE',
  74 + params: {
  75 + detailPageType: 7,
  76 + contentID: content?.objectId,
  77 + extra:{
  78 + relType: content?.relType,
  79 + relId: content?.relId,
  80 + } as ExtraDTO
  81 + } as Params,
  82 + };
  83 + WDRouterRule.jumpWithAction(taskAction)
  84 + Logger.debug(TAG, `gotoVod, ${content.objectId}`);
  85 + }
70 } 86 }
1 import { Logger, ResourcesUtils } from 'wdKit'; 1 import { Logger, ResourcesUtils } from 'wdKit';
2 -import { ResponseDTO, WDHttp } from 'wdNetwork' 2 +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'
3 import { ContentDetailDTO } from 'wdBean' 3 import { ContentDetailDTO } from 'wdBean'
  4 +import HashMap from '@ohos.util.HashMap';
4 5
5 const TAG = 'ContentDetailRequest'; 6 const TAG = 'ContentDetailRequest';
6 7
@@ -40,6 +41,7 @@ export class ContentDetailRequest { @@ -40,6 +41,7 @@ export class ContentDetailRequest {
40 return ContentDetailRequest.getContentDetailDataMock(getContext()); 41 return ContentDetailRequest.getContentDetailDataMock(getContext());
41 } 42 }
42 let url = ContentDetailRequest.getContentDetailUrl(params.contentId, params.relId, params.relType) 43 let url = ContentDetailRequest.getContentDetailUrl(params.contentId, params.relId, params.relType)
43 - return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url) 44 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  45 + return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url, headers)
44 } 46 }
45 } 47 }
@@ -19,6 +19,8 @@ const TAG = 'DetailPlayShortVideoPage'; @@ -19,6 +19,8 @@ const TAG = 'DetailPlayShortVideoPage';
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
  23 + private relType?:string = undefined
22 private playerController: WDPlayerController = new WDPlayerController(); 24 private playerController: WDPlayerController = new WDPlayerController();
23 @Watch("urlChanged") @State url?: string = undefined 25 @Watch("urlChanged") @State url?: string = undefined
24 @Watch('changeContinue') @Provide nextContId?: string = ''; 26 @Watch('changeContinue') @Provide nextContId?: string = '';
@@ -44,7 +46,12 @@ export struct DetailPlayShortVideoPage { @@ -44,7 +46,12 @@ export struct DetailPlayShortVideoPage {
44 let action: Action = router.getParams() as Action 46 let action: Action = router.getParams() as Action
45 if (action) { 47 if (action) {
46 this.contentId = action.params?.contentID 48 this.contentId = action.params?.contentID
  49 + if (action.params && action.params.extra){
  50 + this.relId = action.params.extra.relId
  51 + this.relType = action.params.extra.relType
47 } 52 }
  53 + }
  54 +
48 // 设置播放地址 55 // 设置播放地址
49 // this.url = 'https://media.w3.org/2010/05/sintel/trailer.mp4' 56 // this.url = 'https://media.w3.org/2010/05/sintel/trailer.mp4'
50 let listener = mediaquery.matchMediaSync('(orientation: landscape)'); 57 let listener = mediaquery.matchMediaSync('(orientation: landscape)');
@@ -77,7 +84,9 @@ export struct DetailPlayShortVideoPage { @@ -77,7 +84,9 @@ export struct DetailPlayShortVideoPage {
77 WDPlayerRenderView({ 84 WDPlayerRenderView({
78 playerController: this.playerController, 85 playerController: this.playerController,
79 onLoad: async () => { 86 onLoad: async () => {
80 - this.playVM.playWithContentId(this.contentId ?? "846899373") 87 + // this.playVM.playWithContentId(this.contentId ?? "846899373")
  88 + this.playVM.playWithIds(this.contentId ?? "846899373",
  89 + this.relId ?? "500000301942", this.relType ?? "1")
81 } 90 }
82 }) 91 })
83 .height('100%') 92 .height('100%')
@@ -31,6 +31,13 @@ export class PlayViewModel { @@ -31,6 +31,13 @@ export class PlayViewModel {
31 this.getContentDetailData() // 包括播放地址PlayUrl 31 this.getContentDetailData() // 包括播放地址PlayUrl
32 } 32 }
33 33
  34 + playWithIds(contentId: string, relId: string, relType: string) {
  35 + this.contentId = contentId;
  36 + this.relId = relId;
  37 + this.relType = relType;
  38 + this.getContentDetailData() // 包括播放地址PlayUrl
  39 + }
  40 +
34 getContentDetailData() { 41 getContentDetailData() {
35 ContentDetailRequest.getContentDetail({ 42 ContentDetailRequest.getContentDetail({
36 contentId: this.contentId, 43 contentId: this.contentId,