yangchenggong1_wd
@@ -66,6 +66,29 @@ export struct ENewspaperPageComponent { @@ -66,6 +66,29 @@ export struct ENewspaperPageComponent {
66 offset: { dx: 0, dy: 0 } 66 offset: { dx: 0, dy: 0 }
67 }) 67 })
68 68
  69 + async aboutToAppear() {
  70 + //获取宽高尺寸
  71 + this.screenWidth = this.displayTool.width
  72 + this.picWidth = this.screenWidth - vp2px(52)
  73 + this.picHeight = this.picWidth * 566 / 378
  74 + //注册字体
  75 + font.registerFont({
  76 + familyName: 'BebasNeue_Regular',
  77 + familySrc: $rawfile('font/BebasNeue_Regular.otf')
  78 + })
  79 + this.getNewspaperTime()
  80 + this.getNewspaperList()
  81 + }
  82 +
  83 + aboutToDisappear() {
  84 + // if (this.calendarDialogController) {
  85 + // this.calendarDialogController = null
  86 + // }
  87 + // if (this.listDialogController) {
  88 + // this.listDialogController = null
  89 + // }
  90 + }
  91 +
69 build() { 92 build() {
70 RelativeContainer() { 93 RelativeContainer() {
71 RelativeContainer() { 94 RelativeContainer() {
@@ -245,26 +268,11 @@ export struct ENewspaperPageComponent { @@ -245,26 +268,11 @@ export struct ENewspaperPageComponent {
245 .id('e_newspaper_container') 268 .id('e_newspaper_container')
246 } 269 }
247 270
248 - async aboutToAppear() {  
249 - //获取宽高尺寸  
250 - this.screenWidth = this.displayTool.width  
251 - this.picWidth = this.screenWidth - vp2px(52)  
252 - this.picHeight = this.picWidth * 566 / 378  
253 - //注册字体  
254 - font.registerFont({  
255 - familyName: 'BebasNeue_Regular',  
256 - familySrc: $rawfile('font/BebasNeue_Regular.otf')  
257 - })  
258 - this.getNewspaperTime()  
259 - this.getNewspaperList()  
260 - }  
261 -  
262 private async getNewspaperTime() { 271 private async getNewspaperTime() {
263 let newspaperTimes = await NewspaperViewModel.getNewspaperTime(this.calendarDate) 272 let newspaperTimes = await NewspaperViewModel.getNewspaperTime(this.calendarDate)
264 if (newspaperTimes && newspaperTimes.length > 0) { 273 if (newspaperTimes && newspaperTimes.length > 0) {
265 this.calendarDate = newspaperTimes[0].date 274 this.calendarDate = newspaperTimes[0].date
266 this.currentPageNum = '01' 275 this.currentPageNum = '01'
267 - this.swiperIndex = 0  
268 } 276 }
269 } 277 }
270 278
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,23 +75,23 @@ export struct MorningEveningPaperComponent { @@ -67,23 +75,23 @@ 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() { 79 ListItem() {
73 AudioBarView() 80 AudioBarView()
74 } 81 }
  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')
81 // .backgroundColor(Color.Blue) 89 // .backgroundColor(Color.Blue)
82 .height('100%') 90 .height('100%')
83 - .margin({ left: 14, right: 14 })  
84 91
85 - PaperTitleComponent()  
86 - // PaperTitleComponent({ 92 + // .margin({ left: 12, right: 12 })
  93 +
  94 + PaperTitleComponent()// PaperTitleComponent({
87 // // title: this.morningEveningPaperDTO?.topicInfo?.title ?? "", 95 // // title: this.morningEveningPaperDTO?.topicInfo?.title ?? "",
88 // title: this.title ?? "", 96 // title: this.title ?? "",
89 // // subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? '' 97 // // subtitle: this.morningEveningPaperDTO?.topicInfo?.topicDate ?? ''
@@ -93,6 +101,7 @@ export struct MorningEveningPaperComponent { @@ -93,6 +101,7 @@ export struct MorningEveningPaperComponent {
93 } 101 }
94 .width('100%') 102 .width('100%')
95 // .backgroundColor('#000080') 103 // .backgroundColor('#000080')
96 - .backgroundColor(Color.Black) 104 + // .backgroundColor(Color.Black)
  105 + .backgroundColor(this.pageInfoBean?.backgroundColor ?? Color.Black)
97 } 106 }
98 } 107 }
@@ -61,6 +61,7 @@ export struct PaperTitleComponent { @@ -61,6 +61,7 @@ export struct PaperTitleComponent {
61 // console.info(TAG, "img_close") 61 // console.info(TAG, "img_close")
62 router.back() 62 router.back()
63 }) 63 })
  64 + .margin({ right: 16 })
64 65
65 Image($r('app.media.icon_share')) 66 Image($r('app.media.icon_share'))
66 .height($r('app.float.top_arrow_size')) 67 .height($r('app.float.top_arrow_size'))
@@ -69,9 +70,11 @@ export struct PaperTitleComponent { @@ -69,9 +70,11 @@ export struct PaperTitleComponent {
69 right: { anchor: "img_close", align: HorizontalAlign.Start }, 70 right: { anchor: "img_close", align: HorizontalAlign.Start },
70 center: { anchor: "__container__", align: VerticalAlign.Center } }) 71 center: { anchor: "__container__", align: VerticalAlign.Center } })
71 .id('img_share') 72 .id('img_share')
  73 + .margin({ right: 13 })
72 } 74 }
73 // .margin({ left: 14, right: 14 }) 75 // .margin({ left: 14, right: 14 })
74 .height($r('app.float.top_bar_height')) 76 .height($r('app.float.top_bar_height'))
75 - .backgroundColor(Color.Black) 77 +
  78 + // .backgroundColor(Color.Black)
76 } 79 }
77 } 80 }
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,12 +110,14 @@ export struct SingleColumn999Component { @@ -106,12 +110,14 @@ 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) => { 119 + // ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
  120 + ForEach(this.compListItem?.operDataList, (item: ContentDTO, index: number) => {
115 ListItem() { 121 ListItem() {
116 this.buildPaperItem(item, index) 122 this.buildPaperItem(item, index)
117 } 123 }
@@ -3,7 +3,6 @@ import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant'; @@ -3,7 +3,6 @@ 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 import { ProcessUtils } from '../../utils/ProcessUtils';
8 7
9 const TAG: string = 'CardView'; 8 const TAG: string = 'CardView';
@@ -400,7 +399,8 @@ export struct PaperSingleColumn999CardView { @@ -400,7 +399,8 @@ export struct PaperSingleColumn999CardView {
400 .fontWeight(FontWeight.Bold) 399 .fontWeight(FontWeight.Bold)
401 .alignSelf(ItemAlign.Start) 400 .alignSelf(ItemAlign.Start)
402 .maxLines(3) 401 .maxLines(3)
403 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 402 + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
  403 + .margin({ left: 22, right: 22, top: 28 })
404 if (this.item?.coverUrl) { 404 if (this.item?.coverUrl) {
405 Stack({ alignContent: Alignment.BottomEnd }) { 405 Stack({ alignContent: Alignment.BottomEnd }) {
406 Image(this.item?.coverUrl) 406 Image(this.item?.coverUrl)
@@ -418,7 +418,7 @@ export struct PaperSingleColumn999CardView { @@ -418,7 +418,7 @@ export struct PaperSingleColumn999CardView {
418 .fitOriginalSize(true) 418 .fitOriginalSize(true)
419 }.width(CommonConstants.FULL_PARENT) 419 }.width(CommonConstants.FULL_PARENT)
420 } 420 }
421 - } 421 + }.margin({ left: 22, right: 22 })
422 } 422 }
423 if (this.item?.newsSummary) { 423 if (this.item?.newsSummary) {
424 Text(this.item?.newsSummary) 424 Text(this.item?.newsSummary)
@@ -426,23 +426,26 @@ export struct PaperSingleColumn999CardView { @@ -426,23 +426,26 @@ export struct PaperSingleColumn999CardView {
426 .padding({ top: 10 }) 426 .padding({ top: 10 })
427 .alignSelf(ItemAlign.Start) 427 .alignSelf(ItemAlign.Start)
428 .maxLines(3) 428 .maxLines(3)
429 - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 429 + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
  430 + .margin({ left: 22, right: 22 })
430 } 431 }
431 if (this.item?.visitorComment) { 432 if (this.item?.visitorComment) {
432 Row() { 433 Row() {
433 Text(this.item?.visitorComment + "评") 434 Text(this.item?.visitorComment + "评")
434 .fontSize(12) 435 .fontSize(12)
435 .fontColor(Color.Gray) 436 .fontColor(Color.Gray)
  437 + .margin({ left: 22 })
436 Image($r('app.media.icon_share')) 438 Image($r('app.media.icon_share'))
437 .width(16) 439 .width(16)
438 .height(16) 440 .height(16)
439 - .margin(10) 441 + .margin({ left: 10, right: 22, top: 10, bottom: 10 })
440 .backgroundColor(Color.Brown) 442 .backgroundColor(Color.Brown)
441 }.width(CommonConstants.FULL_PARENT) 443 }.width(CommonConstants.FULL_PARENT)
442 .justifyContent(FlexAlign.SpaceBetween) 444 .justifyContent(FlexAlign.SpaceBetween)
443 } 445 }
444 } 446 }
445 .backgroundColor(Color.White) 447 .backgroundColor(Color.White)
446 - .margin({ bottom: 5 }) 448 + .margin({ bottom: 5, left: 12, right: 12 })
  449 + .borderRadius(4)
447 } 450 }
448 } 451 }
@@ -12,16 +12,6 @@ export struct ENewspaperListDialog { @@ -12,16 +12,6 @@ export struct ENewspaperListDialog {
12 @State scrollIndex: number = 0 12 @State scrollIndex: number = 0
13 newspaperListBean: NewspaperListBean = {} as NewspaperListBean 13 newspaperListBean: NewspaperListBean = {} as NewspaperListBean
14 private listScroller: Scroller = new Scroller(); 14 private listScroller: Scroller = new Scroller();
15 -  
16 - //watch监听报纸页码回调  
17 - onCurrentPageNumUpdated(): void {  
18 - console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)  
19 - let _scrollIndex = Number.parseInt(this.currentPageNum)  
20 - console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_swiperIndex:", _scrollIndex)  
21 - this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex  
22 - this.listScroller.scrollToIndex(this.scrollIndex)  
23 - }  
24 -  
25 //文字版选择弹框 15 //文字版选择弹框
26 pageListDialogController: CustomDialogController = new CustomDialogController({ 16 pageListDialogController: CustomDialogController = new CustomDialogController({
27 builder: ENewspaperPageDialog({ 17 builder: ENewspaperPageDialog({
@@ -37,6 +27,29 @@ export struct ENewspaperListDialog { @@ -37,6 +27,29 @@ export struct ENewspaperListDialog {
37 // 那么此处需要将指向自己的controller放在所有controller的后面 27 // 那么此处需要将指向自己的controller放在所有controller的后面
38 listDialogController: CustomDialogController 28 listDialogController: CustomDialogController
39 29
  30 + //watch监听报纸页码回调
  31 + onCurrentPageNumUpdated(): void {
  32 + console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
  33 + let _scrollIndex = Number.parseInt(this.currentPageNum)
  34 + console.log("ENewspaperListDialog-onCurrentPageNumUpdated", "_scrollIndex:", _scrollIndex)
  35 + this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
  36 + this.listScroller.scrollToIndex(this.scrollIndex)
  37 + }
  38 +
  39 + aboutToAppear(): void {
  40 + console.log("ENewspaperListDialog-aboutToAppear", "currentPageNum:", this.currentPageNum)
  41 + let _scrollIndex = Number.parseInt(this.currentPageNum)
  42 + console.log("ENewspaperListDialog-aboutToAppear", "_scrollIndex:", _scrollIndex)
  43 + this.scrollIndex = _scrollIndex > 0 ? _scrollIndex - 1 : _scrollIndex
  44 + // this.listScroller.scrollToIndex(this.scrollIndex)
  45 + }
  46 +
  47 + aboutToDisappear() {
  48 + // if (this.pageListDialogController) {
  49 + // this.pageListDialogController = null
  50 + // }
  51 + }
  52 +
40 build() { 53 build() {
41 Column() { 54 Column() {
42 Row() 55 Row()
@@ -80,8 +93,10 @@ export struct ENewspaperListDialog { @@ -80,8 +93,10 @@ export struct ENewspaperListDialog {
80 .margin({ top: 20, left: 16, right: 16 }) 93 .margin({ top: 20, left: 16, right: 16 })
81 .objectFit(ImageFit.Contain) 94 .objectFit(ImageFit.Contain)
82 95
83 - List({ scroller: this.listScroller }) { 96 + List({ scroller: this.listScroller, initialIndex: this.scrollIndex }) {
84 ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { 97 ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
  98 + ListItem() {
  99 + List() {
85 ForEach(item.items, (positionItem: NewspaperPositionItemBean, itemIndex: number) => { 100 ForEach(item.items, (positionItem: NewspaperPositionItemBean, itemIndex: number) => {
86 ListItem() { 101 ListItem() {
87 Column() { 102 Column() {
@@ -131,6 +146,8 @@ export struct ENewspaperListDialog { @@ -131,6 +146,8 @@ export struct ENewspaperListDialog {
131 } 146 }
132 147
133 }) 148 })
  149 + }
  150 + }
134 }) 151 })
135 } 152 }
136 .width('100%') 153 .width('100%')
@@ -141,7 +158,17 @@ export struct ENewspaperListDialog { @@ -141,7 +158,17 @@ export struct ENewspaperListDialog {
141 color: '#EDEDED' 158 color: '#EDEDED'
142 }) 159 })
143 .onScrollIndex((firstIndex: number) => { 160 .onScrollIndex((firstIndex: number) => {
144 - this.updateCurrentPageNum(firstIndex) 161 + console.log('firstIndex', firstIndex)
  162 + })
  163 + .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {
  164 + console.info('first' + firstIndex)
  165 + console.info('last' + lastIndex)
  166 + console.info('center' + centerIndex)
  167 + // this.updateCurrentPageNum(firstIndex)
  168 + this.currentPageNum = `${centerIndex < 9 ? '0' + (centerIndex + 1) : centerIndex + 1}`
  169 + })
  170 + .onScroll((scrollOffset: number, scrollState: ScrollState) => {
  171 + console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset)
145 }) 172 })
146 } 173 }
147 .width('100%') 174 .width('100%')
@@ -157,7 +184,7 @@ export struct ENewspaperListDialog { @@ -157,7 +184,7 @@ export struct ENewspaperListDialog {
157 for (let item of itemBean.items) { 184 for (let item of itemBean.items) {
158 index++ 185 index++
159 if (index == firstIndex) { 186 if (index == firstIndex) {
160 - // this.currentPageNum = itemBean.pageNum 187 + this.currentPageNum = itemBean.pageNum
161 return 188 return
162 } 189 }
163 } 190 }
@@ -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,7 +49,7 @@ export class PageRepository { @@ -48,7 +49,7 @@ 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
@@ -58,19 +59,19 @@ export class PageRepository { @@ -58,19 +59,19 @@ export class PageRepository {
58 + "&contentId=" + contentId 59 + "&contentId=" + contentId
59 + "&relType=" + relType; 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,10 +30,11 @@ export class MorningEveningViewModel { @@ -31,10 +30,11 @@ 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>) => { 36 + PageRepository.fetchMorningEveningCompInfo(pageId, groupId, refreshTime, topicId, pageNum, pageSize)
  37 + .then((resDTO: ResponseDTO<CompInfoBean>) => {
38 if (!resDTO || !resDTO.data) { 38 if (!resDTO || !resDTO.data) {
39 Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty'); 39 Logger.error(TAG, 'getMorningEveningCompInfo then navResDTO is empty');
40 error('resDTO is empty'); 40 error('resDTO is empty');
@@ -48,7 +48,8 @@ export class MorningEveningViewModel { @@ -48,7 +48,8 @@ export class MorningEveningViewModel {
48 // let navResStr = JSON.stringify(navResDTO); 48 // let navResStr = JSON.stringify(navResDTO);
49 Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp); 49 Logger.info(TAG, "getMorningEveningCompInfo then,navResDTO.timestamp:" + resDTO.timestamp);
50 success(resDTO.data); 50 success(resDTO.data);
51 - }).catch((err: Error) => { 51 + })
  52 + .catch((err: Error) => {
52 Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`); 53 Logger.error(TAG, `getMorningEveningCompInfo catch, error.name : ${err.name}, error.message:${err.message}`);
53 error(err); 54 error(err);
54 }) 55 })
@@ -81,22 +81,23 @@ @@ -81,22 +81,23 @@
81 "value": "#994D00" 81 "value": "#994D00"
82 }, 82 },
83 { 83 {
84 - "name":"color_B15900", 84 + "name": "color_B15900",
85 "value": "#B15900" 85 "value": "#B15900"
86 }, 86 },
87 { 87 {
88 "name": "main_red", 88 "name": "main_red",
89 "value": "#E84026" 89 "value": "#E84026"
90 - }, {  
91 - "name":"color_4D000000", 90 + },
  91 + {
  92 + "name": "color_4D000000",
92 "value": "#4D000000" 93 "value": "#4D000000"
93 }, 94 },
94 { 95 {
95 - "name":"color_CCCCCC", 96 + "name": "color_CCCCCC",
96 "value": "#CCCCCC" 97 "value": "#CCCCCC"
97 }, 98 },
98 { 99 {
99 - "name":"color_EDEDED", 100 + "name": "color_EDEDED",
100 "value": "#EDEDED" 101 "value": "#EDEDED"
101 }, 102 },
102 { 103 {
@@ -108,9 +109,14 @@ @@ -108,9 +109,14 @@
108 "value": "#B2FFFFFF" 109 "value": "#B2FFFFFF"
109 }, 110 },
110 { 111 {
  112 + "name": "color_00304c",
  113 + "value": "#00304c"
  114 + },
  115 + {
111 "name": "color_transparent", 116 "name": "color_transparent",
112 "value": "#00000000" 117 "value": "#00000000"
113 } 118 }
114 119
  120 +
115 ] 121 ]
116 } 122 }