chenjun3_wd

早晚报头版数据及非头版列表数据

... ... @@ -78,7 +78,7 @@ export class HttpUrlUtils {
static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo";
private static hostUrl: string = HttpUrlUtils.HOST_UAT;
private static hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
private static userId=''
private static userType=''
private static token=''
... ...
... ... @@ -70,3 +70,19 @@ export { ResponseBean } from './src/main/ets/bean/h5/ResponseBean';
export { MorningEveningPaperDTO } from './src/main/ets/bean/component/MorningEveningPaperDTO';
export { FrontLinkObject } from './src/main/ets/bean/component/FrontLinkObject';
export { PageInfoBean } from './src/main/ets/bean/morningevening/PageInfoBean';
export { Group } from './src/main/ets/bean/morningevening/Group';
export { TopicInfo } from './src/main/ets/bean/morningevening/TopicInfo';
export { CompInfoBean } from './src/main/ets/bean/morningevening/CompInfoBean';
export { CompList } from './src/main/ets/bean/morningevening/CompList';
export { OperDataList } from './src/main/ets/bean/morningevening/OperDataList';
export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo';
... ...
import { CompList } from './CompList';
export interface CompInfoBean {
blockDesc: string;
// compAdList: any[];
compList: CompList[];
id: number;
name: string;
pageId: string;
pageNum: number;
pageSize: number;
recommend: number;
totalCount: number;
}
\ No newline at end of file
... ...
import { OperDataList } from './OperDataList';
export interface CompList {
// audioDataList: any[];
backgroundImgUrl: string;
// bottomNavId?: any;
cardItemId: string;
// cardUpdateStrategy?: any;
compStyle: string;
compType: string;
dataSourceType: string;
expIds: string;
extraData: string;
// fullColumnImgUrls: any[];
hasMore: number;
id: number;
// imageScale?: any;
imgSize: string;
itemId: string;
itemType: string;
itemTypeCode: string;
linkUrl: string;
// localGovernance?: any;
name: string;
objectId: string;
objectLevel: string;
objectSummary: string;
objectTitle: string;
objectType: string;
// openComment?: any;
// openLikes?: any;
operDataList: OperDataList[];
pageId: string;
// position?: any;
posterSize: string;
posterUrl: string;
// questionSection?: any;
recommend: number;
relId: number;
sceneId: string;
sortValue: number;
subSceneId: string;
summaryName: string;
// tabOperDataList: any[];
titleShowPolicy: number;
// topicTemplate?: any;
traceId: string;
traceInfo: string;
viewTime: string;
// viewTimeBlurred?: any;
}
\ No newline at end of file
... ...
export interface Group {
blockDesc: string;
groupStrategy: number;
id: number;
showType: number;
sortValue: number;
}
\ No newline at end of file
... ...
import { ShareInfo } from './ShareInfo';
export interface OperDataList {
// activityExt?: any;
appStyle: string;
// askInfo?: any;
axisColor: string;
// bestNoticer?: any;
// bottomNavId?: any;
cardItemId: string;
channelId: number;
// commentInfo?: any;
corner: string;
coverSize: string;
coverType: number;
coverUrl: string;
expIds: string;
extra: string;
// fullColumnImgUrls: any[];
// hasMore?: any;
itemId: string;
itemType: string;
itemTypeCode: string;
keyArticle: number;
// landscape?: any;
// likeStyle?: any;
linkUrl: string;
// liveInfo?: any;
menuShow: number;
newTags: string;
newsAuthor: string;
newsSubTitle: string;
newsSummary: string;
newsTitle: string;
newsTitleColor: string;
objectId: string;
objectLevel: string;
objectType: string;
// openComment?: any;
// openLikes?: any;
pageId: string;
// photoNum?: any;
// position?: any;
publishTime: string;
// pushTime?: any;
// pushUnqueId?: any;
readFlag: number;
// recommend?: any;
relId: number;
relObjectId: string;
relType: number;
// rmhInfo?: any;
rmhPlatform: number;
sceneId: string;
shareInfo: ShareInfo;
// slideShows: any[];
sortValue: number;
source: string;
subSceneId: string;
// tagIds: any[];
// tagWord?: any;
// titleShow?: any;
// titleShowPolicy?: any;
// topicTemplate?: any;
traceId: string;
traceInfo: string;
// userInfo?: any;
// videoInfo?: any;
visitorComment: number;
// voiceInfo?: any;
}
\ No newline at end of file
... ...
// export interface Group {
// blockDesc: string;
// groupStrategy: number;
// id: number;
// itemNum?: any;
// showType: number;
// sortValue: number;
// }
//
// export interface TopicInfo {
// axisColor: string;
// channelId?: any;
// commentFlag: number;
// commentPreviewFlag: number;
// commentShowFlag: number;
// frontFlag?: any;
// frontLinkObject?: any;
// posterFlag: number;
// posterUrl: string;
// relId?: any;
// relObjectId?: any;
// relType?: any;
// shareCoverUrl: string;
// shareOpen: number;
// sharePosterCoverUrl: string;
// sharePosterOpen?: any;
// shareSummary: string;
// shareTitle: string;
// shareUrl: string;
// slideColor: string;
// summary: string;
// title: string;
// titleShow: number;
// topicDate: string;
// topicId: string;
// topicPattern: number;
// topicTemplate?: any;
// topicType: number;
// transluceImgUrl: string;
// visitorComment: number;
// voteInfo?: any;
// }
//
// export interface PageInfoBean {
// backIconUrl: string;
// backgroundColor: string;
// backgroundImgUrl: string;
// baselineColor: string;
// baselineCopywriting: string;
// baselineShow: number;
// description: string;
// groups: Group[];
// hasAdInfo: number;
// hasPopUp: number;
// id: number;
// mainLogoImgUrl: string;
// name: string;
// pageTopParams?: any;
// pageTopType: number;
// pageType: number;
// popUps: any[];
// pushupLogoImgUrl: string;
// shareCoverUrl: string;
// shareIconUrl: string;
// shareName: string;
// shareSummary: string;
// shareUrl: string;
// statusBarColor: string;
// templateType: number;
// titleColor: string;
// topicInfo: TopicInfo;
// }
//
// export interface Meta {
// md5: string;
// }
//
// export interface RootObject {
// code: string;
// data: Data;
// message: string;
// meta: Meta;
// requestId: string;
// success: boolean;
// timestamp: number;
// }
\ No newline at end of file
import { Group } from './Group';
import { TopicInfo } from './TopicInfo';
export interface PageInfoBean {
backIconUrl: string;
backgroundColor: string;
backgroundImgUrl: string;
baselineColor: string;
baselineCopywriting: string;
baselineShow: number;
description: string;
groups: Group[];
hasAdInfo: number;
hasPopUp: number;
id: number;
mainLogoImgUrl: string;
name: string;
pageTopType: number;
pageType: number;
pushupLogoImgUrl: string;
shareCoverUrl: string;
shareIconUrl: string;
shareName: string;
shareSummary: string;
shareUrl: string;
statusBarColor: string;
templateType: number;
titleColor: string;
topicInfo: TopicInfo;
}
... ...
export interface ShareInfo {
shareCoverUrl: string;
shareOpen: number;
sharePosterCoverUrl: string;
sharePosterOpen: number;
shareSummary: string;
shareTitle: string;
shareUrl: string;
}
\ No newline at end of file
... ...
export interface TopicInfo {
axisColor: string;
commentFlag: number;
commentPreviewFlag: number;
commentShowFlag: number;
posterFlag: number;
posterUrl: string;
shareCoverUrl: string;
shareOpen: number;
sharePosterCoverUrl: string;
shareSummary: string;
shareTitle: string;
shareUrl: string;
slideColor: string;
summary: string;
title: string;
titleShow: number;
topicDate: string;
topicId: string;
topicPattern: number;
topicType: number;
transluceImgUrl: string;
visitorComment: number;
}
\ No newline at end of file
... ...
import { MorningEveningPaperDTO } from 'wdBean'
import { MorningEveningPaperDTO, PageInfoBean } from 'wdBean'
import { Logger } from 'wdKit/Index';
import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils';
import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel';
import { AudioBarView } from './AudioBarView';
import { PaperTitleComponent } from './PaperTitleComponent';
import { SingleColumn999Component } from './SingleColumn999Component';
... ... @@ -12,6 +14,8 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包
@Entry
@Component
export struct MorningEveningPaperComponent {
@State pageInfoBean: PageInfoBean = {} as PageInfoBean
@State morningEveningPaperDTO: MorningEveningPaperDTO = {
name: "新闻夜读",
topicInfo: {
... ... @@ -30,10 +34,19 @@ export struct MorningEveningPaperComponent {
} as MorningEveningPaperDTO
@State subTitle: string = ''
aboutToAppear() {
async aboutToAppear() {
console.info(TAG, `aboutToAppear`);
let dateTime = DateTimeUtils.parseDate(this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN);
this.subTitle = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
try {
let listBean = await MorningEveningViewModel.getMorningEveningPageInfo("28927")
Logger.info(TAG,"listBean title = "+listBean.topicInfo.title)
Logger.info(TAG,"listBean topicDate = "+listBean.topicInfo.topicDate)
this.pageInfoBean = listBean;
} catch (exception) {
}
}
build() {
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { DateTimeUtils } from 'wdKit';
import { DateTimeUtils, Logger } from 'wdKit';
import { ContentDetailDTO, NavigationBodyDTO, PageDTO,InteractDataDTO, MorningEveningPaperDTO,
NewspaperTimeInfoBean,
NewspaperListBean
NewspaperListBean,
PageInfoBean,
CompInfoBean
} from 'wdBean';
const TAG = 'HttpRequest';
export class PageRepository {
static getBottomNavGroupUrl() {
// https: //pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup
... ... @@ -22,6 +24,7 @@ export class PageRepository {
+ "&refreshTime=" + DateTimeUtils.getTimeStamp()
+ "&pageId=" + pageId
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
Logger.info(TAG,"getPageInfoUrl url = "+url)
return url;
}
... ... @@ -39,6 +42,7 @@ export class PageRepository {
+ "&pageSize=" + pageSize
+ "&pageNum=" + currentPage;
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
Logger.info(TAG,"getCompInfoUrl url = "+url)
return url;
}
... ... @@ -48,16 +52,19 @@ export class PageRepository {
+ "&contentId=" + contentId
+ "&relType=" + relType;
// Logger.debug("TAG", 'getCompInfoUrl url: '+url);
Logger.info(TAG,"getDetailInfoUrl url = "+url)
return url;
}
static getInteractDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH;
Logger.info(TAG,"getInteractDataUrl url = "+url)
return url;
}
static getNewspaperInfoUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_INFO_PATH;
Logger.info(TAG,"getNewspaperInfoUrl url = "+url)
return url;
}
... ... @@ -65,6 +72,27 @@ export class PageRepository {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_LIST_PATH;
url = url + "?date=" + date
+ "&pagesSize=" + pageSize;
Logger.info(TAG,"getNewspaperListUrl url = "+url)
return url;
}
/**
* 早晚报pageInfo请求
* */
static getMorningEveningPageInfoUrl(pageId: string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_PAGE_INFO_PATH;
url = url + "?pageId=" + pageId;
Logger.info(TAG,"getMorningEveningPageInfoUrl url = "+url)
return url;
}
/**
* 早晚报compInfo请求
* */
static getMorningEveningCompInfoUrl(pageId: string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
url = url + "?pageId=" + pageId;
Logger.info(TAG,"getMorningEveningCompInfoUrl url = "+url)
return url;
}
... ... @@ -118,4 +146,22 @@ export class PageRepository {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<NewspaperListBean>>(url, headers)
};
/**
* 获取早晚报pageInfo
* */
static fetchMorningEveningPageInfo(pageId: string) {
let url = PageRepository.getMorningEveningPageInfoUrl(pageId)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers)
};
/**
* 获取早晚报compInfo
* */
static fetchMorningEveningCompInfo(pageId: string) {
let url = PageRepository.getMorningEveningCompInfoUrl(pageId)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers)
};
}
\ No newline at end of file
... ...
import { CompInfoBean, PageInfoBean } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { ResponseDTO } from 'wdNetwork/Index';
import { PageRepository } from '../repository/PageRepository';
const TAG = 'MorningEveningViewModel'
export class MorningEveningViewModel {
static async getNewspaperList(date: string, pageSize: string): Promise<NewspaperListBean> {
return new Promise<NewspaperListBean>((success, error) => {
Logger.info(TAG, `getNavData start`);
PageRepository.fetchNewspaperList(date, pageSize).then((resDTO: ResponseDTO<NewspaperListBean>) => {
static async getMorningEveningPageInfo(pageId: string): Promise<PageInfoBean> {
return new Promise<PageInfoBean>((success, error) => {
Logger.info(TAG, `getMorningEveningPageInfo pageInfo start`);
PageRepository.fetchMorningEveningPageInfo(pageId).then((resDTO: ResponseDTO<PageInfoBean>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getMorningEveningPageInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getMorningEveningPageInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getMorningEveningPageInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `getMorningEveningPageInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
static async getMorningEveningCompInfo(pageId: string): Promise<CompInfoBean> {
return new Promise<CompInfoBean>((success, error) => {
Logger.info(TAG, `getMorningEveningCompInfo pageInfo start`);
PageRepository.fetchMorningEveningCompInfo(pageId).then((resDTO: ResponseDTO<CompInfoBean>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getNewspaperList then navResDTO is empty');
Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getNewspaperList then code:${resDTO.code}, message:${resDTO.message}`);
Logger.error(TAG, `getMorningEveningCompInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getNewspaperList then,navResDTO.timestamp:" + resDTO.timestamp);
Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `getNewspaperList catch, error.name : ${err.name}, error.message:${err.message}`);
Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
... ...