chenjun3_wd

早晚报非头版样式现网数据填充

1 // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean'; 1 // import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean';
2 -import { PageInfoBean } from 'wdBean'; 2 +import { CompList, PageInfoBean } from 'wdBean';
3 import { DateTimeUtils, Logger } from 'wdKit/Index'; 3 import { DateTimeUtils, Logger } from 'wdKit/Index';
4 import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel'; 4 import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel';
5 import { AudioBarView } from './AudioBarView'; 5 import { AudioBarView } from './AudioBarView';
@@ -15,6 +15,9 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包 @@ -15,6 +15,9 @@ const PATTERN_DATE_CN_RN: string = 'yyyy年\nMM月dd日'; // 日期中包含包
15 @Component 15 @Component
16 export struct MorningEveningPaperComponent { 16 export struct MorningEveningPaperComponent {
17 @State pageInfoBean: PageInfoBean = {} as PageInfoBean 17 @State pageInfoBean: PageInfoBean = {} as PageInfoBean
  18 + // @State compInfoBean: CompInfoBean = {} as CompInfoBean
  19 + @State compListItem: CompList = {} as CompList
  20 + // @Provide compListItem: CompList = {} as CompList
18 // @State morningEveningPaperDTO: MorningEveningPaperDTO = { 21 // @State morningEveningPaperDTO: MorningEveningPaperDTO = {
19 // name: "新闻夜读", 22 // name: "新闻夜读",
20 // topicInfo: { 23 // topicInfo: {
@@ -41,7 +44,7 @@ export struct MorningEveningPaperComponent { @@ -41,7 +44,7 @@ export struct MorningEveningPaperComponent {
41 Logger.info(TAG, "currentTime = " + currentTime) 44 Logger.info(TAG, "currentTime = " + currentTime)
42 Logger.info(TAG, `currentTime = ${currentTime}`) 45 Logger.info(TAG, `currentTime = ${currentTime}`)
43 try { 46 try {
44 - let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("28927") 47 + let pageInfoBean = await MorningEveningViewModel.getMorningEveningPageInfo("28949")
45 this.pageInfoBean = pageInfoBean; 48 this.pageInfoBean = pageInfoBean;
46 this.title = this.pageInfoBean?.topicInfo?.title 49 this.title = this.pageInfoBean?.topicInfo?.title
47 let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN); 50 let dateTime = DateTimeUtils.parseDate(this.pageInfoBean?.topicInfo?.topicDate ?? '', DateTimeUtils.PATTERN_DATE_HYPHEN);
@@ -52,7 +55,12 @@ export struct MorningEveningPaperComponent { @@ -52,7 +55,12 @@ export struct MorningEveningPaperComponent {
52 Logger.info(TAG, "pageInfoBean dateTime = " + dateTime) 55 Logger.info(TAG, "pageInfoBean dateTime = " + dateTime)
53 Logger.info(TAG, "pageInfoBean subTitle = " + this.subTitle) 56 Logger.info(TAG, "pageInfoBean subTitle = " + this.subTitle)
54 57
55 - let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "") 58 + let compInfoBean = await MorningEveningViewModel.getMorningEveningCompInfo(pageInfoBean?.id, pageInfoBean?.groups[0]?.id, currentTime + "", pageInfoBean?.topicInfo?.topicId)
  59 + // this.compInfoBean = compInfoBean
  60 + if (compInfoBean?.compList[0]) {
  61 + this.compListItem = compInfoBean?.compList[0]
  62 + }
  63 +
56 Logger.info(TAG, "compInfoBean compStyle = " + compInfoBean.compList[0].compStyle) 64 Logger.info(TAG, "compInfoBean compStyle = " + compInfoBean.compList[0].compStyle)
57 } catch (exception) { 65 } catch (exception) {
58 66
@@ -67,14 +75,14 @@ export struct MorningEveningPaperComponent { @@ -67,14 +75,14 @@ export struct MorningEveningPaperComponent {
67 ListItem() { 75 ListItem() {
68 topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject }) 76 topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject })
69 } 77 }
70 - }  
71 78
72 - ListItem() {  
73 - AudioBarView() 79 + ListItem() {
  80 + AudioBarView()
  81 + }
74 } 82 }
75 83
76 ListItem() { 84 ListItem() {
77 - SingleColumn999Component() 85 + SingleColumn999Component({ compListItem: this.compListItem }).margin({ top: $r('app.float.top_bar_height') })
78 } 86 }
79 } 87 }
80 // .backgroundColor('#FFF1F3F5') 88 // .backgroundColor('#FFF1F3F5')
@@ -82,13 +90,12 @@ export struct MorningEveningPaperComponent { @@ -82,13 +90,12 @@ export struct MorningEveningPaperComponent {
82 .height('100%') 90 .height('100%')
83 .margin({ left: 14, right: 14 }) 91 .margin({ left: 14, right: 14 })
84 92
85 - PaperTitleComponent()  
86 - // PaperTitleComponent({  
87 - // // title: this.morningEveningPaperDTO?.topicInfo?.title ?? "",  
88 - // title: this.title ?? "",  
89 - // // subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? ''  
90 - // subtitle: this.subTitle  
91 - // }) 93 + PaperTitleComponent()// PaperTitleComponent({
  94 + // // title: this.morningEveningPaperDTO?.topicInfo?.title ?? "",
  95 + // title: this.title ?? "",
  96 + // // subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? ''
  97 + // subtitle: this.subTitle
  98 + // })
92 .margin({ left: 14, right: 14 }) 99 .margin({ left: 14, right: 14 })
93 } 100 }
94 .width('100%') 101 .width('100%')
1 -import { CompDTO, ContentDTO, VideoInfoDTO, } from 'wdBean'; 1 +import { CompList, ContentDTO } from 'wdBean';
2 import { BreakpointConstants } from 'wdConstant'; 2 import { BreakpointConstants } from 'wdConstant';
3 import { Logger } from 'wdKit'; 3 import { Logger } from 'wdKit';
4 import { PaperSingleColumn999CardView } from '../page/CardView'; 4 import { PaperSingleColumn999CardView } from '../page/CardView';
@@ -11,67 +11,71 @@ const TAG = 'SingleColumn999Component'; @@ -11,67 +11,71 @@ const TAG = 'SingleColumn999Component';
11 */ 11 */
12 @Component 12 @Component
13 export struct SingleColumn999Component { 13 export struct SingleColumn999Component {
  14 + // @Consume compListItem?: CompList
  15 + @Prop compListItem?: CompList
14 @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS; 16 @StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
15 - @State compDTO: CompDTO = {  
16 - compStyle: 'compStyle3',  
17 - operDataList: [  
18 - {  
19 - newsTitle: '时政微观察丨从外贸“成绩单”看中国经济新亮色',  
20 - description: "description0",  
21 - coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'  
22 - } as ContentDTO,  
23 - {  
24 - newsTitle: '画好强国建设、民族复兴的最大同心圆',  
25 - description: "description1",  
26 - coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/80351784d4da4fc08b8987ba45a7647f.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",  
27 - } as ContentDTO,  
28 - {  
29 - newsTitle: '绿色“一带一路”十周年创新理念与实践案例',  
30 - description: "description2",  
31 - newsSummary: "共建“一带一路”倡议提出10年多来,在各方共同努力下,共建“一带一路”绿色发展取得积极进展,理念引领不断增强,交流机制不断完善,务实合作不断深化。",  
32 - coverUrl: "",  
33 - } as ContentDTO,  
34 - {  
35 - newsTitle: '瞭望 | 在深海聆听“幽灵粒子”',  
36 - description: "description3",  
37 - coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/b77a3577594d4d24b84e7b2b20e38e41.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'  
38 - } as ContentDTO,  
39 - {  
40 - newsTitle: '一图读懂|未来三年,长三角示范区安排了这些重大项目',  
41 - description: "description4",  
42 - coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/8d54ef1cbbe14ef08d6ab38f07867e4c.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",  
43 - } as ContentDTO,  
44 - {  
45 - newsTitle: '一头江豚的自述',  
46 - description: "description5",  
47 - newsSummary: "我是生活在长江里的一头江豚,是长江中唯一的水生哺乳动物,更是国家一级保护动物。但曾几何时,我和我的江中小伙伴出现了生存危机……直到有一天,我突然发现,打渔人变成护渔人,江水变清澈了,长江逐渐恢复了生机,我的家族数量上升到了1249头。当长江之水再一次悠悠流淌,我们相拥在清澈波光中起舞。长江,我的家园。",  
48 - coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/2ec7bccff2324b05ac4b6503d868a381.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",  
49 - visitorComment: 10,  
50 - videoInfo: {  
51 - // clarity: 0,  
52 - // resolutionHeight: 0,  
53 - // resolutionWidth: 0,  
54 - videoDuration: 229,  
55 - videoLandScape: 1,  
56 - // videoType: 0,  
57 - videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",  
58 - firstFrameImageUri: ""  
59 - } as VideoInfoDTO  
60 - } as ContentDTO,  
61 - {  
62 - newsTitle: '遇见习近平丨北京正在书写历史',  
63 - description: "description6",  
64 - coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/7c54d59b63844464a261dcbba82c7aed.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",  
65 - } as ContentDTO  
66 - ]  
67 - } as CompDTO 17 +
  18 + // @State compDTO: CompDTO = {
  19 + // compStyle: 'compStyle3',
  20 + // operDataList: [
  21 + // {
  22 + // newsTitle: '时政微观察丨从外贸“成绩单”看中国经济新亮色',
  23 + // description: "description0",
  24 + // coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
  25 + // } as ContentDTO,
  26 + // {
  27 + // newsTitle: '画好强国建设、民族复兴的最大同心圆',
  28 + // description: "description1",
  29 + // coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/80351784d4da4fc08b8987ba45a7647f.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
  30 + // } as ContentDTO,
  31 + // {
  32 + // newsTitle: '绿色“一带一路”十周年创新理念与实践案例',
  33 + // description: "description2",
  34 + // newsSummary: "共建“一带一路”倡议提出10年多来,在各方共同努力下,共建“一带一路”绿色发展取得积极进展,理念引领不断增强,交流机制不断完善,务实合作不断深化。",
  35 + // coverUrl: "",
  36 + // } as ContentDTO,
  37 + // {
  38 + // newsTitle: '瞭望 | 在深海聆听“幽灵粒子”',
  39 + // description: "description3",
  40 + // coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/b77a3577594d4d24b84e7b2b20e38e41.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg'
  41 + // } as ContentDTO,
  42 + // {
  43 + // newsTitle: '一图读懂|未来三年,长三角示范区安排了这些重大项目',
  44 + // description: "description4",
  45 + // coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/8d54ef1cbbe14ef08d6ab38f07867e4c.jpeg?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
  46 + // } as ContentDTO,
  47 + // {
  48 + // newsTitle: '一头江豚的自述',
  49 + // description: "description5",
  50 + // newsSummary: "我是生活在长江里的一头江豚,是长江中唯一的水生哺乳动物,更是国家一级保护动物。但曾几何时,我和我的江中小伙伴出现了生存危机……直到有一天,我突然发现,打渔人变成护渔人,江水变清澈了,长江逐渐恢复了生机,我的家族数量上升到了1249头。当长江之水再一次悠悠流淌,我们相拥在清澈波光中起舞。长江,我的家园。",
  51 + // coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/sjbj-20240116/image/display/2ec7bccff2324b05ac4b6503d868a381.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
  52 + // visitorComment: 10,
  53 + // videoInfo: {
  54 + // // clarity: 0,
  55 + // // resolutionHeight: 0,
  56 + // // resolutionWidth: 0,
  57 + // videoDuration: 229,
  58 + // videoLandScape: 1,
  59 + // // videoType: 0,
  60 + // videoUrl: "https://cdnjdout.aikan.pdnews.cn/zhbj-20240116/vod/content/output/c72f4170db2c4d34befa453f60d39a69_opt.mp4",
  61 + // firstFrameImageUri: ""
  62 + // } as VideoInfoDTO
  63 + // } as ContentDTO,
  64 + // {
  65 + // newsTitle: '遇见习近平丨北京正在书写历史',
  66 + // description: "description6",
  67 + // coverUrl: "https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/7c54d59b63844464a261dcbba82c7aed.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg",
  68 + // } as ContentDTO
  69 + // ]
  70 + // } as CompDTO
68 71
69 watchCurrentBreakpoint() { 72 watchCurrentBreakpoint() {
70 Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`); 73 Logger.info(TAG, `watchCurrentBreakpoint, this.currentBreakpoint: ${this.currentBreakpoint}`);
71 } 74 }
72 75
73 aboutToAppear() { 76 aboutToAppear() {
74 - Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`); 77 + // Logger.info(TAG, `aboutToAppear, beanList:${this.compDTO?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
  78 + Logger.info(TAG, `aboutToAppear, beanList:${this.compListItem?.operDataList?.length}, currentBreakpoint:${this.currentBreakpoint}`);
75 } 79 }
76 80
77 aboutToDisappear() { 81 aboutToDisappear() {
@@ -106,16 +110,18 @@ export struct SingleColumn999Component { @@ -106,16 +110,18 @@ export struct SingleColumn999Component {
106 } 110 }
107 111
108 build() { 112 build() {
109 - if (this.compDTO && this.compDTO?.operDataList?.length > 0) { 113 + // if (this.compDTO && this.compDTO?.operDataList?.length > 0) {
  114 + if (this.compListItem && this.compListItem?.operDataList?.length > 0) {
110 List({ space: 2, initialIndex: 0 }) { 115 List({ space: 2, initialIndex: 0 }) {
111 // ListItemGroup({ 116 // ListItemGroup({
112 // // footer: this.itemFooter("") 117 // // footer: this.itemFooter("")
113 // }) { 118 // }) {
114 - ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {  
115 - ListItem() {  
116 - this.buildPaperItem(item, index)  
117 - }  
118 - }, (item: ContentDTO, index: number) => JSON.stringify(item)) 119 + // ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
  120 + ForEach(this.compListItem?.operDataList, (item: ContentDTO, index: number) => {
  121 + ListItem() {
  122 + this.buildPaperItem(item, index)
  123 + }
  124 + }, (item: ContentDTO, index: number) => JSON.stringify(item))
119 // } 125 // }
120 // .divider({ strokeWidth: 1, color: '#EFEFEF' }) // 每行之间的分界线 126 // .divider({ strokeWidth: 1, color: '#EFEFEF' }) // 每行之间的分界线
121 127
@@ -14,6 +14,7 @@ import { @@ -14,6 +14,7 @@ import {
14 } from 'wdBean'; 14 } from 'wdBean';
15 15
16 const TAG = 'HttpRequest'; 16 const TAG = 'HttpRequest';
  17 +
17 export class PageRepository { 18 export class PageRepository {
18 static getBottomNavGroupUrl() { 19 static getBottomNavGroupUrl() {
19 // https: //pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup 20 // https: //pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup
@@ -30,7 +31,7 @@ export class PageRepository { @@ -30,7 +31,7 @@ export class PageRepository {
30 + "&refreshTime=" + DateTimeUtils.getTimeStamp() 31 + "&refreshTime=" + DateTimeUtils.getTimeStamp()
31 + "&pageId=" + pageId 32 + "&pageId=" + pageId
32 // Logger.debug("TAG", 'getCompInfoUrl url: '+url); 33 // Logger.debug("TAG", 'getCompInfoUrl url: '+url);
33 - Logger.info(TAG,"getPageInfoUrl url = "+url) 34 + Logger.info(TAG, "getPageInfoUrl url = " + url)
34 return url; 35 return url;
35 } 36 }
36 37
@@ -48,29 +49,29 @@ export class PageRepository { @@ -48,29 +49,29 @@ export class PageRepository {
48 + "&pageSize=" + pageSize 49 + "&pageSize=" + pageSize
49 + "&pageNum=" + currentPage; 50 + "&pageNum=" + currentPage;
50 // Logger.debug("TAG", 'getCompInfoUrl url: '+url); 51 // Logger.debug("TAG", 'getCompInfoUrl url: '+url);
51 - Logger.info(TAG,"getCompInfoUrl url = "+url) 52 + Logger.info(TAG, "getCompInfoUrl url = " + url)
52 return url; 53 return url;
53 } 54 }
54 55
55 static getDetailInfoUrl(relId: string, contentId: string, relType: string) { 56 static getDetailInfoUrl(relId: string, contentId: string, relType: string) {
56 let url = HttpUrlUtils.getHost() + HttpUrlUtils.DETAIL_PATH; 57 let url = HttpUrlUtils.getHost() + HttpUrlUtils.DETAIL_PATH;
57 url = url + "?relId=" + relId 58 url = url + "?relId=" + relId
58 - + "&contentId=" + contentId  
59 - + "&relType=" + relType; 59 + + "&contentId=" + contentId
  60 + + "&relType=" + relType;
60 // Logger.debug("TAG", 'getCompInfoUrl url: '+url); 61 // Logger.debug("TAG", 'getCompInfoUrl url: '+url);
61 - Logger.info(TAG,"getDetailInfoUrl url = "+url) 62 + Logger.info(TAG, "getDetailInfoUrl url = " + url)
62 return url; 63 return url;
63 } 64 }
64 65
65 static getInteractDataUrl() { 66 static getInteractDataUrl() {
66 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH; 67 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH;
67 - Logger.info(TAG,"getInteractDataUrl url = "+url) 68 + Logger.info(TAG, "getInteractDataUrl url = " + url)
68 return url; 69 return url;
69 } 70 }
70 71
71 static getNewspaperInfoUrl(date: string) { 72 static getNewspaperInfoUrl(date: string) {
72 let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_INFO_PATH + "?date=" + date; 73 let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_INFO_PATH + "?date=" + date;
73 - Logger.info(TAG,"getNewspaperInfoUrl url = "+url) 74 + Logger.info(TAG, "getNewspaperInfoUrl url = " + url)
74 return url; 75 return url;
75 } 76 }
76 77
@@ -78,7 +79,7 @@ export class PageRepository { @@ -78,7 +79,7 @@ export class PageRepository {
78 let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_LIST_PATH; 79 let url = HttpUrlUtils.getHost() + HttpUrlUtils.E_NEWSPAPER_LIST_PATH;
79 url = url + "?date=" + date 80 url = url + "?date=" + date
80 + "&pagesSize=" + pageSize; 81 + "&pagesSize=" + pageSize;
81 - Logger.info(TAG,"getNewspaperListUrl url = "+url) 82 + Logger.info(TAG, "getNewspaperListUrl url = " + url)
82 return url; 83 return url;
83 } 84 }
84 85
@@ -88,7 +89,7 @@ export class PageRepository { @@ -88,7 +89,7 @@ export class PageRepository {
88 static getMorningEveningPageInfoUrl(pageId: string) { 89 static getMorningEveningPageInfoUrl(pageId: string) {
89 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_PAGE_INFO_PATH; 90 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_PAGE_INFO_PATH;
90 url = url + "?pageId=" + pageId; 91 url = url + "?pageId=" + pageId;
91 - Logger.info(TAG,"getMorningEveningPageInfoUrl url = "+url) 92 + Logger.info(TAG, "getMorningEveningPageInfoUrl url = " + url)
92 return url; 93 return url;
93 } 94 }
94 95
@@ -105,11 +106,11 @@ export class PageRepository { @@ -105,11 +106,11 @@ export class PageRepository {
105 * channelStrategy:频道策略 106 * channelStrategy:频道策略
106 * topicId:专题id 107 * topicId:专题id
107 * */ 108 * */
108 - static getMorningEveningCompInfoUrl(pageId: number,groupId:number,refreshTime:string,pageNum:number,pageSize:number) { 109 + static getMorningEveningCompInfoUrl(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) {
109 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH; 110 let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
110 - url = url + "?loadStrategy=first_load&pageNum="+pageNum+"&refreshTime="+refreshTime+"&pageId="  
111 - +pageId+"&channelStrategy=2&groupId="+groupId+"&topicId=10000009445&pageSize="+pageSize;  
112 - Logger.info(TAG,"getMorningEveningCompInfoUrl url = "+url) 111 + url = url + "?loadStrategy=first_load&pageNum=" + pageNum + "&refreshTime=" + refreshTime + "&pageId="
  112 + + pageId + "&channelStrategy=2&groupId=" + groupId + "&topicId=" + topicId + "&pageSize=" + pageSize;
  113 + Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url)
113 return url; 114 return url;
114 } 115 }
115 116
@@ -176,8 +177,8 @@ export class PageRepository { @@ -176,8 +177,8 @@ export class PageRepository {
176 /** 177 /**
177 * 获取早晚报compInfo 178 * 获取早晚报compInfo
178 * */ 179 * */
179 - static fetchMorningEveningCompInfo(pageId: number,groupId:number,refreshTime:string,pageNum:number,pageSize:number) {  
180 - let url = PageRepository.getMorningEveningCompInfoUrl(pageId,groupId,refreshTime,pageNum,pageSize) 180 + static fetchMorningEveningCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) {
  181 + let url = PageRepository.getMorningEveningCompInfoUrl(pageId, groupId, refreshTime, topicId, pageNum, pageSize)
181 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); 182 let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
182 return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers) 183 return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers)
183 }; 184 };
@@ -6,7 +6,6 @@ import { PageRepository } from '../repository/PageRepository'; @@ -6,7 +6,6 @@ import { PageRepository } from '../repository/PageRepository';
6 const TAG = 'MorningEveningViewModel' 6 const TAG = 'MorningEveningViewModel'
7 7
8 export class MorningEveningViewModel { 8 export class MorningEveningViewModel {
9 -  
10 static async getMorningEveningPageInfo(pageId: string): Promise<PageInfoBean> { 9 static async getMorningEveningPageInfo(pageId: string): Promise<PageInfoBean> {
11 return new Promise<PageInfoBean>((success, error) => { 10 return new Promise<PageInfoBean>((success, error) => {
12 Logger.info(TAG, `getMorningEveningPageInfo pageInfo start`); 11 Logger.info(TAG, `getMorningEveningPageInfo pageInfo start`);
@@ -31,27 +30,29 @@ export class MorningEveningViewModel { @@ -31,27 +30,29 @@ export class MorningEveningViewModel {
31 }) 30 })
32 } 31 }
33 32
34 - static async getMorningEveningCompInfo(pageId: number,groupId:number,refreshTime:string,pageNum:number = 1,pageSize:number = 20): Promise<CompInfoBean> { 33 + static async getMorningEveningCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number = 1, pageSize: number = 20): Promise<CompInfoBean> {
35 return new Promise<CompInfoBean>((success, error) => { 34 return new Promise<CompInfoBean>((success, error) => {
36 Logger.info(TAG, `getMorningEveningCompInfo pageInfo start`); 35 Logger.info(TAG, `getMorningEveningCompInfo pageInfo start`);
37 - PageRepository.fetchMorningEveningCompInfo(pageId,groupId,refreshTime,pageNum,pageSize).then((resDTO: ResponseDTO<CompInfoBean>) => {  
38 - if (!resDTO || !resDTO.data) {  
39 - Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty');  
40 - error('resDTO is empty');  
41 - return  
42 - }  
43 - if (resDTO.code != 0) {  
44 - Logger.error(TAG, `getMorningEveningCompInfo then code:${resDTO.code}, message:${resDTO.message}`);  
45 - error('resDTO Response Code is failure');  
46 - return  
47 - }  
48 - // let navResStr = JSON.stringify(navResDTO);  
49 - Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp);  
50 - success(resDTO.data);  
51 - }).catch((err: Error) => {  
52 - Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`);  
53 - error(err);  
54 - }) 36 + PageRepository.fetchMorningEveningCompInfo(pageId, groupId, refreshTime, topicId, pageNum, pageSize)
  37 + .then((resDTO: ResponseDTO<CompInfoBean>) => {
  38 + if (!resDTO || !resDTO.data) {
  39 + Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty');
  40 + error('resDTO is empty');
  41 + return
  42 + }
  43 + if (resDTO.code != 0) {
  44 + Logger.error(TAG, `getMorningEveningCompInfo then code:${resDTO.code}, message:${resDTO.message}`);
  45 + error('resDTO Response Code is failure');
  46 + return
  47 + }
  48 + // let navResStr = JSON.stringify(navResDTO);
  49 + Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp);
  50 + success(resDTO.data);
  51 + })
  52 + .catch((err: Error) => {
  53 + Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`);
  54 + error(err);
  55 + })
55 }) 56 })
56 } 57 }
57 } 58 }