Showing
12 changed files
with
326 additions
and
101 deletions
| @@ -78,7 +78,7 @@ export class HttpUrlUtils { | @@ -78,7 +78,7 @@ export class HttpUrlUtils { | ||
| 78 | 78 | ||
| 79 | static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; | 79 | static readonly MORNING_EVENING_COMP_INFO_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/compInfo"; |
| 80 | 80 | ||
| 81 | - private static hostUrl: string = HttpUrlUtils.HOST_UAT; | 81 | + private static hostUrl: string = HttpUrlUtils.HOST_PRODUCT; |
| 82 | private static userId='' | 82 | private static userId='' |
| 83 | private static userType='' | 83 | private static userType='' |
| 84 | private static token='' | 84 | private static token='' |
| @@ -70,3 +70,19 @@ export { ResponseBean } from './src/main/ets/bean/h5/ResponseBean'; | @@ -70,3 +70,19 @@ export { ResponseBean } from './src/main/ets/bean/h5/ResponseBean'; | ||
| 70 | export { MorningEveningPaperDTO } from './src/main/ets/bean/component/MorningEveningPaperDTO'; | 70 | export { MorningEveningPaperDTO } from './src/main/ets/bean/component/MorningEveningPaperDTO'; |
| 71 | 71 | ||
| 72 | export { FrontLinkObject } from './src/main/ets/bean/component/FrontLinkObject'; | 72 | export { FrontLinkObject } from './src/main/ets/bean/component/FrontLinkObject'; |
| 73 | + | ||
| 74 | +export { PageInfoBean } from './src/main/ets/bean/morningevening/PageInfoBean'; | ||
| 75 | + | ||
| 76 | +export { Group } from './src/main/ets/bean/morningevening/Group'; | ||
| 77 | + | ||
| 78 | +export { TopicInfo } from './src/main/ets/bean/morningevening/TopicInfo'; | ||
| 79 | + | ||
| 80 | +export { CompInfoBean } from './src/main/ets/bean/morningevening/CompInfoBean'; | ||
| 81 | + | ||
| 82 | +export { CompList } from './src/main/ets/bean/morningevening/CompList'; | ||
| 83 | + | ||
| 84 | +export { OperDataList } from './src/main/ets/bean/morningevening/OperDataList'; | ||
| 85 | + | ||
| 86 | +export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; | ||
| 87 | + | ||
| 88 | + |
| 1 | +import { CompList } from './CompList'; | ||
| 2 | + | ||
| 3 | +export interface CompInfoBean { | ||
| 4 | + blockDesc: string; | ||
| 5 | + // compAdList: any[]; | ||
| 6 | + compList: CompList[]; | ||
| 7 | + id: number; | ||
| 8 | + name: string; | ||
| 9 | + pageId: string; | ||
| 10 | + pageNum: number; | ||
| 11 | + pageSize: number; | ||
| 12 | + recommend: number; | ||
| 13 | + totalCount: number; | ||
| 14 | +} |
| 1 | +import { OperDataList } from './OperDataList'; | ||
| 2 | + | ||
| 3 | +export interface CompList { | ||
| 4 | + // audioDataList: any[]; | ||
| 5 | + backgroundImgUrl: string; | ||
| 6 | + // bottomNavId?: any; | ||
| 7 | + cardItemId: string; | ||
| 8 | + // cardUpdateStrategy?: any; | ||
| 9 | + compStyle: string; | ||
| 10 | + compType: string; | ||
| 11 | + dataSourceType: string; | ||
| 12 | + expIds: string; | ||
| 13 | + extraData: string; | ||
| 14 | + // fullColumnImgUrls: any[]; | ||
| 15 | + hasMore: number; | ||
| 16 | + id: number; | ||
| 17 | + // imageScale?: any; | ||
| 18 | + imgSize: string; | ||
| 19 | + itemId: string; | ||
| 20 | + itemType: string; | ||
| 21 | + itemTypeCode: string; | ||
| 22 | + linkUrl: string; | ||
| 23 | + // localGovernance?: any; | ||
| 24 | + name: string; | ||
| 25 | + objectId: string; | ||
| 26 | + objectLevel: string; | ||
| 27 | + objectSummary: string; | ||
| 28 | + objectTitle: string; | ||
| 29 | + objectType: string; | ||
| 30 | + // openComment?: any; | ||
| 31 | + // openLikes?: any; | ||
| 32 | + operDataList: OperDataList[]; | ||
| 33 | + pageId: string; | ||
| 34 | + // position?: any; | ||
| 35 | + posterSize: string; | ||
| 36 | + posterUrl: string; | ||
| 37 | + // questionSection?: any; | ||
| 38 | + recommend: number; | ||
| 39 | + relId: number; | ||
| 40 | + sceneId: string; | ||
| 41 | + sortValue: number; | ||
| 42 | + subSceneId: string; | ||
| 43 | + summaryName: string; | ||
| 44 | + // tabOperDataList: any[]; | ||
| 45 | + titleShowPolicy: number; | ||
| 46 | + // topicTemplate?: any; | ||
| 47 | + traceId: string; | ||
| 48 | + traceInfo: string; | ||
| 49 | + viewTime: string; | ||
| 50 | + // viewTimeBlurred?: any; | ||
| 51 | +} |
| 1 | +import { ShareInfo } from './ShareInfo'; | ||
| 2 | + | ||
| 3 | +export interface OperDataList { | ||
| 4 | + // activityExt?: any; | ||
| 5 | + appStyle: string; | ||
| 6 | + // askInfo?: any; | ||
| 7 | + axisColor: string; | ||
| 8 | + // bestNoticer?: any; | ||
| 9 | + // bottomNavId?: any; | ||
| 10 | + cardItemId: string; | ||
| 11 | + channelId: number; | ||
| 12 | + // commentInfo?: any; | ||
| 13 | + corner: string; | ||
| 14 | + coverSize: string; | ||
| 15 | + coverType: number; | ||
| 16 | + coverUrl: string; | ||
| 17 | + expIds: string; | ||
| 18 | + extra: string; | ||
| 19 | + // fullColumnImgUrls: any[]; | ||
| 20 | + // hasMore?: any; | ||
| 21 | + itemId: string; | ||
| 22 | + itemType: string; | ||
| 23 | + itemTypeCode: string; | ||
| 24 | + keyArticle: number; | ||
| 25 | + // landscape?: any; | ||
| 26 | + // likeStyle?: any; | ||
| 27 | + linkUrl: string; | ||
| 28 | + // liveInfo?: any; | ||
| 29 | + menuShow: number; | ||
| 30 | + newTags: string; | ||
| 31 | + newsAuthor: string; | ||
| 32 | + newsSubTitle: string; | ||
| 33 | + newsSummary: string; | ||
| 34 | + newsTitle: string; | ||
| 35 | + newsTitleColor: string; | ||
| 36 | + objectId: string; | ||
| 37 | + objectLevel: string; | ||
| 38 | + objectType: string; | ||
| 39 | + // openComment?: any; | ||
| 40 | + // openLikes?: any; | ||
| 41 | + pageId: string; | ||
| 42 | + // photoNum?: any; | ||
| 43 | + // position?: any; | ||
| 44 | + publishTime: string; | ||
| 45 | + // pushTime?: any; | ||
| 46 | + // pushUnqueId?: any; | ||
| 47 | + readFlag: number; | ||
| 48 | + // recommend?: any; | ||
| 49 | + relId: number; | ||
| 50 | + relObjectId: string; | ||
| 51 | + relType: number; | ||
| 52 | + // rmhInfo?: any; | ||
| 53 | + rmhPlatform: number; | ||
| 54 | + sceneId: string; | ||
| 55 | + shareInfo: ShareInfo; | ||
| 56 | + // slideShows: any[]; | ||
| 57 | + sortValue: number; | ||
| 58 | + source: string; | ||
| 59 | + subSceneId: string; | ||
| 60 | + // tagIds: any[]; | ||
| 61 | + // tagWord?: any; | ||
| 62 | + // titleShow?: any; | ||
| 63 | + // titleShowPolicy?: any; | ||
| 64 | + // topicTemplate?: any; | ||
| 65 | + traceId: string; | ||
| 66 | + traceInfo: string; | ||
| 67 | + // userInfo?: any; | ||
| 68 | + // videoInfo?: any; | ||
| 69 | + visitorComment: number; | ||
| 70 | + // voiceInfo?: any; | ||
| 71 | +} |
| 1 | -// export interface Group { | ||
| 2 | -// blockDesc: string; | ||
| 3 | -// groupStrategy: number; | ||
| 4 | -// id: number; | ||
| 5 | -// itemNum?: any; | ||
| 6 | -// showType: number; | ||
| 7 | -// sortValue: number; | ||
| 8 | -// } | ||
| 9 | -// | ||
| 10 | -// export interface TopicInfo { | ||
| 11 | -// axisColor: string; | ||
| 12 | -// channelId?: any; | ||
| 13 | -// commentFlag: number; | ||
| 14 | -// commentPreviewFlag: number; | ||
| 15 | -// commentShowFlag: number; | ||
| 16 | -// frontFlag?: any; | ||
| 17 | -// frontLinkObject?: any; | ||
| 18 | -// posterFlag: number; | ||
| 19 | -// posterUrl: string; | ||
| 20 | -// relId?: any; | ||
| 21 | -// relObjectId?: any; | ||
| 22 | -// relType?: any; | ||
| 23 | -// shareCoverUrl: string; | ||
| 24 | -// shareOpen: number; | ||
| 25 | -// sharePosterCoverUrl: string; | ||
| 26 | -// sharePosterOpen?: any; | ||
| 27 | -// shareSummary: string; | ||
| 28 | -// shareTitle: string; | ||
| 29 | -// shareUrl: string; | ||
| 30 | -// slideColor: string; | ||
| 31 | -// summary: string; | ||
| 32 | -// title: string; | ||
| 33 | -// titleShow: number; | ||
| 34 | -// topicDate: string; | ||
| 35 | -// topicId: string; | ||
| 36 | -// topicPattern: number; | ||
| 37 | -// topicTemplate?: any; | ||
| 38 | -// topicType: number; | ||
| 39 | -// transluceImgUrl: string; | ||
| 40 | -// visitorComment: number; | ||
| 41 | -// voteInfo?: any; | ||
| 42 | -// } | ||
| 43 | -// | ||
| 44 | -// export interface PageInfoBean { | ||
| 45 | -// backIconUrl: string; | ||
| 46 | -// backgroundColor: string; | ||
| 47 | -// backgroundImgUrl: string; | ||
| 48 | -// baselineColor: string; | ||
| 49 | -// baselineCopywriting: string; | ||
| 50 | -// baselineShow: number; | ||
| 51 | -// description: string; | ||
| 52 | -// groups: Group[]; | ||
| 53 | -// hasAdInfo: number; | ||
| 54 | -// hasPopUp: number; | ||
| 55 | -// id: number; | ||
| 56 | -// mainLogoImgUrl: string; | ||
| 57 | -// name: string; | ||
| 58 | -// pageTopParams?: any; | ||
| 59 | -// pageTopType: number; | ||
| 60 | -// pageType: number; | ||
| 61 | -// popUps: any[]; | ||
| 62 | -// pushupLogoImgUrl: string; | ||
| 63 | -// shareCoverUrl: string; | ||
| 64 | -// shareIconUrl: string; | ||
| 65 | -// shareName: string; | ||
| 66 | -// shareSummary: string; | ||
| 67 | -// shareUrl: string; | ||
| 68 | -// statusBarColor: string; | ||
| 69 | -// templateType: number; | ||
| 70 | -// titleColor: string; | ||
| 71 | -// topicInfo: TopicInfo; | ||
| 72 | -// } | ||
| 73 | -// | ||
| 74 | -// export interface Meta { | ||
| 75 | -// md5: string; | ||
| 76 | -// } | ||
| 77 | -// | ||
| 78 | -// export interface RootObject { | ||
| 79 | -// code: string; | ||
| 80 | -// data: Data; | ||
| 81 | -// message: string; | ||
| 82 | -// meta: Meta; | ||
| 83 | -// requestId: string; | ||
| 84 | -// success: boolean; | ||
| 85 | -// timestamp: number; | ||
| 86 | -// } | ||
| 1 | +import { Group } from './Group'; | ||
| 2 | +import { TopicInfo } from './TopicInfo'; | ||
| 3 | + | ||
| 4 | +export interface PageInfoBean { | ||
| 5 | + backIconUrl: string; | ||
| 6 | + backgroundColor: string; | ||
| 7 | + backgroundImgUrl: string; | ||
| 8 | + baselineColor: string; | ||
| 9 | + baselineCopywriting: string; | ||
| 10 | + baselineShow: number; | ||
| 11 | + description: string; | ||
| 12 | + groups: Group[]; | ||
| 13 | + hasAdInfo: number; | ||
| 14 | + hasPopUp: number; | ||
| 15 | + id: number; | ||
| 16 | + mainLogoImgUrl: string; | ||
| 17 | + name: string; | ||
| 18 | + pageTopType: number; | ||
| 19 | + pageType: number; | ||
| 20 | + pushupLogoImgUrl: string; | ||
| 21 | + shareCoverUrl: string; | ||
| 22 | + shareIconUrl: string; | ||
| 23 | + shareName: string; | ||
| 24 | + shareSummary: string; | ||
| 25 | + shareUrl: string; | ||
| 26 | + statusBarColor: string; | ||
| 27 | + templateType: number; | ||
| 28 | + titleColor: string; | ||
| 29 | + topicInfo: TopicInfo; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + |
| 1 | +export interface TopicInfo { | ||
| 2 | + axisColor: string; | ||
| 3 | + commentFlag: number; | ||
| 4 | + commentPreviewFlag: number; | ||
| 5 | + commentShowFlag: number; | ||
| 6 | + posterFlag: number; | ||
| 7 | + posterUrl: string; | ||
| 8 | + shareCoverUrl: string; | ||
| 9 | + shareOpen: number; | ||
| 10 | + sharePosterCoverUrl: string; | ||
| 11 | + shareSummary: string; | ||
| 12 | + shareTitle: string; | ||
| 13 | + shareUrl: string; | ||
| 14 | + slideColor: string; | ||
| 15 | + summary: string; | ||
| 16 | + title: string; | ||
| 17 | + titleShow: number; | ||
| 18 | + topicDate: string; | ||
| 19 | + topicId: string; | ||
| 20 | + topicPattern: number; | ||
| 21 | + topicType: number; | ||
| 22 | + transluceImgUrl: string; | ||
| 23 | + visitorComment: number; | ||
| 24 | +} |
| 1 | -import { MorningEveningPaperDTO } from 'wdBean' | 1 | +import { MorningEveningPaperDTO, PageInfoBean } from 'wdBean' |
| 2 | +import { Logger } from 'wdKit/Index'; | ||
| 2 | import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'; | 3 | import { DateTimeUtils } from 'wdKit/src/main/ets/utils/DateTimeUtils'; |
| 4 | +import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; | ||
| 3 | import { AudioBarView } from './AudioBarView'; | 5 | import { AudioBarView } from './AudioBarView'; |
| 4 | import { PaperTitleComponent } from './PaperTitleComponent'; | 6 | import { PaperTitleComponent } from './PaperTitleComponent'; |
| 5 | import { SingleColumn999Component } from './SingleColumn999Component'; | 7 | import { SingleColumn999Component } from './SingleColumn999Component'; |
| @@ -12,6 +14,8 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包 | @@ -12,6 +14,8 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包 | ||
| 12 | @Entry | 14 | @Entry |
| 13 | @Component | 15 | @Component |
| 14 | export struct MorningEveningPaperComponent { | 16 | export struct MorningEveningPaperComponent { |
| 17 | + @State pageInfoBean: PageInfoBean = {} as PageInfoBean | ||
| 18 | + | ||
| 15 | @State morningEveningPaperDTO: MorningEveningPaperDTO = { | 19 | @State morningEveningPaperDTO: MorningEveningPaperDTO = { |
| 16 | name: "新闻夜读", | 20 | name: "新闻夜读", |
| 17 | topicInfo: { | 21 | topicInfo: { |
| @@ -30,10 +34,19 @@ export struct MorningEveningPaperComponent { | @@ -30,10 +34,19 @@ export struct MorningEveningPaperComponent { | ||
| 30 | } as MorningEveningPaperDTO | 34 | } as MorningEveningPaperDTO |
| 31 | @State subTitle: string = '' | 35 | @State subTitle: string = '' |
| 32 | 36 | ||
| 33 | - aboutToAppear() { | 37 | + async aboutToAppear() { |
| 34 | console.info(TAG, `aboutToAppear`); | 38 | console.info(TAG, `aboutToAppear`); |
| 35 | let dateTime = DateTimeUtils.parseDate(this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN); | 39 | let dateTime = DateTimeUtils.parseDate(this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN); |
| 36 | this.subTitle = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) | 40 | this.subTitle = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN) |
| 41 | + | ||
| 42 | + try { | ||
| 43 | + let listBean = await MorningEveningViewModel.getMorningEveningPageInfo("28927") | ||
| 44 | + Logger.info(TAG,"listBean title = "+listBean.topicInfo.title) | ||
| 45 | + Logger.info(TAG,"listBean topicDate = "+listBean.topicInfo.topicDate) | ||
| 46 | + this.pageInfoBean = listBean; | ||
| 47 | + } catch (exception) { | ||
| 48 | + | ||
| 49 | + } | ||
| 37 | } | 50 | } |
| 38 | 51 | ||
| 39 | build() { | 52 | build() { |
| 1 | import HashMap from '@ohos.util.HashMap'; | 1 | import HashMap from '@ohos.util.HashMap'; |
| 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 3 | -import { DateTimeUtils } from 'wdKit'; | 3 | +import { DateTimeUtils, Logger } from 'wdKit'; |
| 4 | import { ContentDetailDTO, NavigationBodyDTO, PageDTO,InteractDataDTO, MorningEveningPaperDTO, | 4 | import { ContentDetailDTO, NavigationBodyDTO, PageDTO,InteractDataDTO, MorningEveningPaperDTO, |
| 5 | NewspaperTimeInfoBean, | 5 | NewspaperTimeInfoBean, |
| 6 | - NewspaperListBean | 6 | + NewspaperListBean, |
| 7 | + PageInfoBean, | ||
| 8 | + CompInfoBean | ||
| 7 | } from 'wdBean'; | 9 | } from 'wdBean'; |
| 8 | - | 10 | +const TAG = 'HttpRequest'; |
| 9 | export class PageRepository { | 11 | export class PageRepository { |
| 10 | static getBottomNavGroupUrl() { | 12 | static getBottomNavGroupUrl() { |
| 11 | // https: //pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup | 13 | // https: //pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup |
| @@ -22,6 +24,7 @@ export class PageRepository { | @@ -22,6 +24,7 @@ export class PageRepository { | ||
| 22 | + "&refreshTime=" + DateTimeUtils.getTimeStamp() | 24 | + "&refreshTime=" + DateTimeUtils.getTimeStamp() |
| 23 | + "&pageId=" + pageId | 25 | + "&pageId=" + pageId |
| 24 | // Logger.debug("TAG", 'getCompInfoUrl url: '+url); | 26 | // Logger.debug("TAG", 'getCompInfoUrl url: '+url); |
| 27 | + Logger.info(TAG,"getPageInfoUrl url = "+url) | ||
| 25 | return url; | 28 | return url; |
| 26 | } | 29 | } |
| 27 | 30 | ||
| @@ -39,6 +42,7 @@ export class PageRepository { | @@ -39,6 +42,7 @@ export class PageRepository { | ||
| 39 | + "&pageSize=" + pageSize | 42 | + "&pageSize=" + pageSize |
| 40 | + "&pageNum=" + currentPage; | 43 | + "&pageNum=" + currentPage; |
| 41 | // Logger.debug("TAG", 'getCompInfoUrl url: '+url); | 44 | // Logger.debug("TAG", 'getCompInfoUrl url: '+url); |
| 45 | + Logger.info(TAG,"getCompInfoUrl url = "+url) | ||
| 42 | return url; | 46 | return url; |
| 43 | } | 47 | } |
| 44 | 48 | ||
| @@ -48,16 +52,19 @@ export class PageRepository { | @@ -48,16 +52,19 @@ export class PageRepository { | ||
| 48 | + "&contentId=" + contentId | 52 | + "&contentId=" + contentId |
| 49 | + "&relType=" + relType; | 53 | + "&relType=" + relType; |
| 50 | // Logger.debug("TAG", 'getCompInfoUrl url: '+url); | 54 | // Logger.debug("TAG", 'getCompInfoUrl url: '+url); |
| 55 | + Logger.info(TAG,"getDetailInfoUrl url = "+url) | ||
| 51 | return url; | 56 | return url; |
| 52 | } | 57 | } |
| 53 | 58 | ||
| 54 | static getInteractDataUrl() { | 59 | static getInteractDataUrl() { |
| 55 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH; | 60 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH; |
| 61 | + Logger.info(TAG,"getInteractDataUrl url = "+url) | ||
| 56 | return url; | 62 | return url; |
| 57 | } | 63 | } |
| 58 | 64 | ||
| 59 | static getNewspaperInfoUrl() { | 65 | static getNewspaperInfoUrl() { |
| 60 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_INFO_PATH; | 66 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_INFO_PATH; |
| 67 | + Logger.info(TAG,"getNewspaperInfoUrl url = "+url) | ||
| 61 | return url; | 68 | return url; |
| 62 | } | 69 | } |
| 63 | 70 | ||
| @@ -65,6 +72,27 @@ export class PageRepository { | @@ -65,6 +72,27 @@ export class PageRepository { | ||
| 65 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_LIST_PATH; | 72 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_LIST_PATH; |
| 66 | url = url + "?date=" + date | 73 | url = url + "?date=" + date |
| 67 | + "&pagesSize=" + pageSize; | 74 | + "&pagesSize=" + pageSize; |
| 75 | + Logger.info(TAG,"getNewspaperListUrl url = "+url) | ||
| 76 | + return url; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * 早晚报pageInfo请求 | ||
| 81 | + * */ | ||
| 82 | + static getMorningEveningPageInfoUrl(pageId: string) { | ||
| 83 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_PAGE_INFO_PATH; | ||
| 84 | + url = url + "?pageId=" + pageId; | ||
| 85 | + Logger.info(TAG,"getMorningEveningPageInfoUrl url = "+url) | ||
| 86 | + return url; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 早晚报compInfo请求 | ||
| 91 | + * */ | ||
| 92 | + static getMorningEveningCompInfoUrl(pageId: string) { | ||
| 93 | + let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH; | ||
| 94 | + url = url + "?pageId=" + pageId; | ||
| 95 | + Logger.info(TAG,"getMorningEveningCompInfoUrl url = "+url) | ||
| 68 | return url; | 96 | return url; |
| 69 | } | 97 | } |
| 70 | 98 | ||
| @@ -118,4 +146,22 @@ export class PageRepository { | @@ -118,4 +146,22 @@ export class PageRepository { | ||
| 118 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 146 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 119 | return WDHttp.get<ResponseDTO<NewspaperListBean>>(url, headers) | 147 | return WDHttp.get<ResponseDTO<NewspaperListBean>>(url, headers) |
| 120 | }; | 148 | }; |
| 149 | + | ||
| 150 | + /** | ||
| 151 | + * 获取早晚报pageInfo | ||
| 152 | + * */ | ||
| 153 | + static fetchMorningEveningPageInfo(pageId: string) { | ||
| 154 | + let url = PageRepository.getMorningEveningPageInfoUrl(pageId) | ||
| 155 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 156 | + return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers) | ||
| 157 | + }; | ||
| 158 | + | ||
| 159 | + /** | ||
| 160 | + * 获取早晚报compInfo | ||
| 161 | + * */ | ||
| 162 | + static fetchMorningEveningCompInfo(pageId: string) { | ||
| 163 | + let url = PageRepository.getMorningEveningCompInfoUrl(pageId) | ||
| 164 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 165 | + return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers) | ||
| 166 | + }; | ||
| 121 | } | 167 | } |
| 1 | - | 1 | +import { CompInfoBean, PageInfoBean } from 'wdBean/Index'; |
| 2 | +import { Logger } from 'wdKit/Index'; | ||
| 3 | +import { ResponseDTO } from 'wdNetwork/Index'; | ||
| 4 | +import { PageRepository } from '../repository/PageRepository'; | ||
| 2 | 5 | ||
| 3 | const TAG = 'MorningEveningViewModel' | 6 | const TAG = 'MorningEveningViewModel' |
| 4 | 7 | ||
| 5 | export class MorningEveningViewModel { | 8 | export class MorningEveningViewModel { |
| 6 | 9 | ||
| 7 | - static async getNewspaperList(date: string, pageSize: string): Promise<NewspaperListBean> { | ||
| 8 | - return new Promise<NewspaperListBean>((success, error) => { | ||
| 9 | - Logger.info(TAG, `getNavData start`); | ||
| 10 | - PageRepository.fetchNewspaperList(date, pageSize).then((resDTO: ResponseDTO<NewspaperListBean>) => { | 10 | + static async getMorningEveningPageInfo(pageId: string): Promise<PageInfoBean> { |
| 11 | + return new Promise<PageInfoBean>((success, error) => { | ||
| 12 | + Logger.info(TAG, `getMorningEveningPageInfo pageInfo start`); | ||
| 13 | + PageRepository.fetchMorningEveningPageInfo(pageId).then((resDTO: ResponseDTO<PageInfoBean>) => { | ||
| 14 | + if (!resDTO || !resDTO.data) { | ||
| 15 | + Logger.error(TAG, 'getMorningEveningPageInfo then navResDTO is empty'); | ||
| 16 | + error('resDTO is empty'); | ||
| 17 | + return | ||
| 18 | + } | ||
| 19 | + if (resDTO.code != 0) { | ||
| 20 | + Logger.error(TAG, `getMorningEveningPageInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 21 | + error('resDTO Response Code is failure'); | ||
| 22 | + return | ||
| 23 | + } | ||
| 24 | + // let navResStr = JSON.stringify(navResDTO); | ||
| 25 | + Logger.info(TAG, "getMorningEveningPageInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 26 | + success(resDTO.data); | ||
| 27 | + }).catch((err: Error) => { | ||
| 28 | + Logger.error(TAG, `getMorningEveningPageInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 29 | + error(err); | ||
| 30 | + }) | ||
| 31 | + }) | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + static async getMorningEveningCompInfo(pageId: string): Promise<CompInfoBean> { | ||
| 35 | + return new Promise<CompInfoBean>((success, error) => { | ||
| 36 | + Logger.info(TAG, `getMorningEveningCompInfo pageInfo start`); | ||
| 37 | + PageRepository.fetchMorningEveningCompInfo(pageId).then((resDTO: ResponseDTO<CompInfoBean>) => { | ||
| 11 | if (!resDTO || !resDTO.data) { | 38 | if (!resDTO || !resDTO.data) { |
| 12 | - Logger.error(TAG, 'getNewspaperList then navResDTO is empty'); | 39 | + Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty'); |
| 13 | error('resDTO is empty'); | 40 | error('resDTO is empty'); |
| 14 | return | 41 | return |
| 15 | } | 42 | } |
| 16 | if (resDTO.code != 0) { | 43 | if (resDTO.code != 0) { |
| 17 | - Logger.error(TAG, `getNewspaperList then code:${resDTO.code}, message:${resDTO.message}`); | 44 | + Logger.error(TAG, `getMorningEveningCompInfo then code:${resDTO.code}, message:${resDTO.message}`); |
| 18 | error('resDTO Response Code is failure'); | 45 | error('resDTO Response Code is failure'); |
| 19 | return | 46 | return |
| 20 | } | 47 | } |
| 21 | // let navResStr = JSON.stringify(navResDTO); | 48 | // let navResStr = JSON.stringify(navResDTO); |
| 22 | - Logger.info(TAG, "getNewspaperList then,navResDTO.timestamp:" + resDTO.timestamp); | 49 | + Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp); |
| 23 | success(resDTO.data); | 50 | success(resDTO.data); |
| 24 | }).catch((err: Error) => { | 51 | }).catch((err: Error) => { |
| 25 | - Logger.error(TAG, `getNewspaperList catch, error.name : ${err.name}, error.message:${err.message}`); | 52 | + Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`); |
| 26 | error(err); | 53 | error(err); |
| 27 | }) | 54 | }) |
| 28 | }) | 55 | }) |
-
Please register or login to post a comment