liujian1_wd

图文详情页面

... ... @@ -3,6 +3,8 @@ import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
import { Logger } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { WDRouterRule } from 'wdRouter';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG: string = 'CardView';
... ... @@ -71,22 +73,7 @@ export struct CarouselLayout01CardView {
.hoverEffect(HoverEffect.Scale)
.onClick((event: ClickEvent) => {
Logger.info(TAG, `BannerComponent onClick event index: ${this.index}`);
// let taskAction: Action = {
// type: 'JUMP_H5_BY_WEB_VIEW',
// params: {
// url: ConfigConstants.DETAIL_URL
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 7, // 沉浸式竖屏详情页
contentID: '863556812'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
ProcessUtils.processPage(this.item)
})
}
}
... ...
import { CompDTO } from 'wdBean';
import { Action, CompDTO, Params } from 'wdBean';
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { WDRouterRule } from 'wdRouter';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG = 'SingleImageCardComponent';
... ...
... ... @@ -30,7 +30,7 @@ export class ProcessUtils {
break;
case ContentConstants.TYPE_VOD:
Logger.debug(TAG, "processPage, nonsupport!!!");
// TODO 待对接更多页面
ProcessUtils.gotoVod(content)
break;
case ContentConstants.TYPE_TELETEXT:
// 图文详情,跳转h5
... ... @@ -67,4 +67,20 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}
private static gotoVod(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 7,
contentID: content?.objectId,
extra:{
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoVod, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
import { Logger, ResourcesUtils } from 'wdKit';
import { ResponseDTO, WDHttp } from 'wdNetwork'
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'
import { ContentDetailDTO } from 'wdBean'
import HashMap from '@ohos.util.HashMap';
const TAG = 'ContentDetailRequest';
... ... @@ -40,6 +41,7 @@ export class ContentDetailRequest {
return ContentDetailRequest.getContentDetailDataMock(getContext());
}
let url = ContentDetailRequest.getContentDetailUrl(params.contentId, params.relId, params.relType)
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url, headers)
}
}
\ No newline at end of file
... ...
... ... @@ -19,6 +19,8 @@ const TAG = 'DetailPlayShortVideoPage';
@Component
export struct DetailPlayShortVideoPage {
private contentId?: string = undefined
private relId?:string = undefined
private relType?:string = undefined
private playerController: WDPlayerController = new WDPlayerController();
@Watch("urlChanged") @State url?: string = undefined
@Watch('changeContinue') @Provide nextContId?: string = '';
... ... @@ -44,7 +46,12 @@ export struct DetailPlayShortVideoPage {
let action: Action = router.getParams() as Action
if (action) {
this.contentId = action.params?.contentID
if (action.params && action.params.extra){
this.relId = action.params.extra.relId
this.relType = action.params.extra.relType
}
}
// 设置播放地址
// this.url = 'https://media.w3.org/2010/05/sintel/trailer.mp4'
let listener = mediaquery.matchMediaSync('(orientation: landscape)');
... ... @@ -77,7 +84,9 @@ export struct DetailPlayShortVideoPage {
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
this.playVM.playWithContentId(this.contentId ?? "846899373")
// this.playVM.playWithContentId(this.contentId ?? "846899373")
this.playVM.playWithIds(this.contentId ?? "846899373",
this.relId ?? "500000301942", this.relType ?? "1")
}
})
.height('100%')
... ...
... ... @@ -31,6 +31,13 @@ export class PlayViewModel {
this.getContentDetailData() // 包括播放地址PlayUrl
}
playWithIds(contentId: string, relId: string, relType: string) {
this.contentId = contentId;
this.relId = relId;
this.relType = relType;
this.getContentDetailData() // 包括播放地址PlayUrl
}
getContentDetailData() {
ContentDetailRequest.getContentDetail({
contentId: this.contentId,
... ...