liyubing

feat:

1、电子报全屏适配
@@ -10,7 +10,7 @@ import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; @@ -10,7 +10,7 @@ import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
10 import { RMCalendarBean } from './calendar/RMCalendarBean'; 10 import { RMCalendarBean } from './calendar/RMCalendarBean';
11 import { newsSkeleton } from './skeleton/newsSkeleton'; 11 import { newsSkeleton } from './skeleton/newsSkeleton';
12 import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index'; 12 import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index';
13 -import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index'; 13 +import { TrackingContent, TrackConstants, TrackingButton } from 'wdTracking/Index';
14 import { WDShare } from 'wdShare/Index'; 14 import { WDShare } from 'wdShare/Index';
15 import { window } from '@kit.ArkUI'; 15 import { window } from '@kit.ArkUI';
16 import { WindowModel } from 'wdKit'; 16 import { WindowModel } from 'wdKit';
@@ -35,26 +35,26 @@ export struct ENewspaperPageComponent { @@ -35,26 +35,26 @@ export struct ENewspaperPageComponent {
35 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 35 @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
36 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 36 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
37 @State ratio: string = '100%' 37 @State ratio: string = '100%'
38 -  
39 - @State toastText:ResourceStr = "" 38 + @State toastText: ResourceStr = ""
40 dialogToast: CustomDialogController = new CustomDialogController({ 39 dialogToast: CustomDialogController = new CustomDialogController({
41 builder: CustomToast({ 40 builder: CustomToast({
42 - bgColor:$r("app.color.color_B3000000"),  
43 - opacityValue:1,  
44 - fontSizeValue:"25lpx",  
45 - lineHeightValue:"36lpx", 41 + bgColor: $r("app.color.color_B3000000"),
  42 + opacityValue: 1,
  43 + fontSizeValue: "25lpx",
  44 + lineHeightValue: "36lpx",
46 msg: this.toastText, 45 msg: this.toastText,
47 }), 46 }),
48 autoCancel: false, 47 autoCancel: false,
49 alignment: DialogAlignment.Center, 48 alignment: DialogAlignment.Center,
50 customStyle: true, 49 customStyle: true,
51 - maskColor:"#00000000" 50 + maskColor: "#00000000"
52 }) 51 })
53 52
54 - showToastTip(msg:ResourceStr){ 53 + showToastTip(msg: ResourceStr) {
55 this.toastText = msg 54 this.toastText = msg
56 this.dialogToast.open() 55 this.dialogToast.open()
57 } 56 }
  57 +
58 //watch监听报纸页码回调 58 //watch监听报纸页码回调
59 onCurrentPageNumUpdated(): void { 59 onCurrentPageNumUpdated(): void {
60 console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum) 60 console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
@@ -63,12 +63,13 @@ export struct ENewspaperPageComponent { @@ -63,12 +63,13 @@ export struct ENewspaperPageComponent {
63 this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex 63 this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
64 64
65 //电子报--版面序号选择点击 65 //电子报--版面序号选择点击
66 - TrackingContent.clickWithEvent('panel_number_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage  
67 - ,{  
68 - 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,  
69 - 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,  
70 - 'currentPanelDate':this.selectDate.toDateString(),  
71 - 'currentNumber':this.swiperIndex, 66 + TrackingContent.clickWithEvent('panel_number_selection_click', TrackConstants.PageName.NewsPaperPage,
  67 + TrackConstants.PageName.NewsPaperPage
  68 + , {
  69 + 'panelNumber': this.newspaperListBean?.list[this.swiperIndex].pageNum,
  70 + 'panelName': this.newspaperListBean?.list[this.swiperIndex].pageName,
  71 + 'currentPanelDate': this.selectDate.toDateString(),
  72 + 'currentNumber': this.swiperIndex,
72 }) 73 })
73 } 74 }
74 75
@@ -88,12 +89,13 @@ export struct ENewspaperPageComponent { @@ -88,12 +89,13 @@ export struct ENewspaperPageComponent {
88 new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0) 89 new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0)
89 } 90 }
90 //日历选择点击 91 //日历选择点击
91 - TrackingContent.clickWithEvent('date_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage  
92 - ,{  
93 - 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,  
94 - 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,  
95 - 'currentPanelDate':this.selectDate.toDateString(),  
96 - 'currentNumber':this.swiperIndex, 92 + TrackingContent.clickWithEvent('date_selection_click', TrackConstants.PageName.NewsPaperPage,
  93 + TrackConstants.PageName.NewsPaperPage
  94 + , {
  95 + 'panelNumber': this.newspaperListBean?.list[this.swiperIndex].pageNum,
  96 + 'panelName': this.newspaperListBean?.list[this.swiperIndex].pageName,
  97 + 'currentPanelDate': this.selectDate.toDateString(),
  98 + 'currentNumber': this.swiperIndex,
97 }) 99 })
98 } 100 }
99 }), 101 }),
@@ -134,7 +136,7 @@ export struct ENewspaperPageComponent { @@ -134,7 +136,7 @@ export struct ENewspaperPageComponent {
134 this.picWidth = this.screenWidth - vp2px(52) 136 this.picWidth = this.screenWidth - vp2px(52)
135 let screenHeight = this.displayTool.height; 137 let screenHeight = this.displayTool.height;
136 // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度 138 // bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
137 - let height = screenHeight -this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60) 139 + let height = screenHeight - this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60)
138 this.picHeight = height 140 this.picHeight = height
139 // 默认日期 141 // 默认日期
140 const date = new Date() 142 const date = new Date()
@@ -213,6 +215,7 @@ export struct ENewspaperPageComponent { @@ -213,6 +215,7 @@ export struct ENewspaperPageComponent {
213 this.calendarDialogController.close() 215 this.calendarDialogController.close()
214 } 216 }
215 }) 217 })
  218 +
216 if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { 219 if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
217 Image($r('app.media.icon_share')) 220 Image($r('app.media.icon_share'))
218 .height($r('app.float.top_arrow_size')) 221 .height($r('app.float.top_arrow_size'))
@@ -227,7 +230,7 @@ export struct ENewspaperPageComponent { @@ -227,7 +230,7 @@ export struct ENewspaperPageComponent {
227 }) 230 })
228 } 231 }
229 } 232 }
230 - .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) 233 + .margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16'), top: this.topSafeHeight + 'px' })
231 .height($r('app.float.top_bar_height')) 234 .height($r('app.float.top_bar_height'))
232 .alignRules({ 235 .alignRules({
233 top: { anchor: '__container__', align: VerticalAlign.Top }, 236 top: { anchor: '__container__', align: VerticalAlign.Top },
@@ -251,7 +254,7 @@ export struct ENewspaperPageComponent { @@ -251,7 +254,7 @@ export struct ENewspaperPageComponent {
251 if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { 254 if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
252 Swiper(this.swiperController) { 255 Swiper(this.swiperController) {
253 ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { 256 ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
254 - ENewspaperItemComponent({ newspaperListItemBean: item}) 257 + ENewspaperItemComponent({ newspaperListItemBean: item })
255 }) 258 })
256 } 259 }
257 .itemSpace(10) 260 .itemSpace(10)
@@ -310,10 +313,11 @@ export struct ENewspaperPageComponent { @@ -310,10 +313,11 @@ export struct ENewspaperPageComponent {
310 .onClick((event: ClickEvent) => { 313 .onClick((event: ClickEvent) => {
311 this.swiperController.showNext() 314 this.swiperController.showNext()
312 // 电子报--滑动查看下一版 315 // 电子报--滑动查看下一版
313 - TrackingButton.click('panelPageViewNextPanel',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage  
314 - ,{  
315 - 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,  
316 - 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName, 316 + TrackingButton.click('panelPageViewNextPanel', TrackConstants.PageName.NewsPaperPage,
  317 + TrackConstants.PageName.NewsPaperPage
  318 + , {
  319 + 'panelNumber': this.newspaperListBean?.list[this.swiperIndex].pageNum,
  320 + 'panelName': this.newspaperListBean?.list[this.swiperIndex].pageName,
317 }) 321 })
318 }) 322 })
319 } 323 }
@@ -341,7 +345,7 @@ export struct ENewspaperPageComponent { @@ -341,7 +345,7 @@ export struct ENewspaperPageComponent {
341 }) 345 })
342 .id('e_newspaper_page_num') 346 .id('e_newspaper_page_num')
343 .onClick((event: ClickEvent) => { 347 .onClick((event: ClickEvent) => {
344 - if(!NetworkUtil.isNetConnected()){ 348 + if (!NetworkUtil.isNetConnected()) {
345 this.showToastTip('网络出小差了,请检查网络后重试') 349 this.showToastTip('网络出小差了,请检查网络后重试')
346 return 350 return
347 } 351 }
@@ -352,7 +356,7 @@ export struct ENewspaperPageComponent { @@ -352,7 +356,7 @@ export struct ENewspaperPageComponent {
352 } else { 356 } else {
353 this.pageDialogController.close() 357 this.pageDialogController.close()
354 } 358 }
355 - }else { 359 + } else {
356 this.showToastTip('暂无数据') 360 this.showToastTip('暂无数据')
357 } 361 }
358 }) 362 })
@@ -380,21 +384,22 @@ export struct ENewspaperPageComponent { @@ -380,21 +384,22 @@ export struct ENewspaperPageComponent {
380 }) 384 })
381 .id('e_newspaper_read') 385 .id('e_newspaper_read')
382 .onClick((event: ClickEvent) => { 386 .onClick((event: ClickEvent) => {
383 - if(!NetworkUtil.isNetConnected()){ 387 + if (!NetworkUtil.isNetConnected()) {
384 this.showToastTip('网络出小差了,请检查网络后重试') 388 this.showToastTip('网络出小差了,请检查网络后重试')
385 return 389 return
386 } 390 }
387 if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { 391 if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
388 this.isOpenListDialog = true 392 this.isOpenListDialog = true
389 //电子报--读报纸点击 393 //电子报--读报纸点击
390 - TrackingContent.clickWithEvent('read_newspaper_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage  
391 - ,{  
392 - 'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,  
393 - 'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,  
394 - 'currentPanelDate':this.selectDate.toDateString(),  
395 - 'currentNumber':this.swiperIndex, 394 + TrackingContent.clickWithEvent('read_newspaper_click', TrackConstants.PageName.NewsPaperPage,
  395 + TrackConstants.PageName.NewsPaperPage
  396 + , {
  397 + 'panelNumber': this.newspaperListBean?.list[this.swiperIndex].pageNum,
  398 + 'panelName': this.newspaperListBean?.list[this.swiperIndex].pageName,
  399 + 'currentPanelDate': this.selectDate.toDateString(),
  400 + 'currentNumber': this.swiperIndex,
396 }) 401 })
397 - }else { 402 + } else {
398 this.showToastTip('暂无数据') 403 this.showToastTip('暂无数据')
399 } 404 }
400 }) 405 })
@@ -430,7 +435,8 @@ export struct ENewspaperPageComponent { @@ -430,7 +435,8 @@ export struct ENewspaperPageComponent {
430 private async getNewspaperList() { 435 private async getNewspaperList() {
431 try { 436 try {
432 if (NetworkUtil.isNetConnected()) { 437 if (NetworkUtil.isNetConnected()) {
433 - let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight) 438 + let listBean =
  439 + await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight)
434 this.newspaperListBean = listBean; 440 this.newspaperListBean = listBean;
435 } else { 441 } else {
436 this.showToastTip('网络出小差了,请检查网络后重试') 442 this.showToastTip('网络出小差了,请检查网络后重试')
@@ -442,21 +448,22 @@ export struct ENewspaperPageComponent { @@ -442,21 +448,22 @@ export struct ENewspaperPageComponent {
442 448
443 share() { 449 share() {
444 let contentDetailData: ContentDetailDTO = { 450 let contentDetailData: ContentDetailDTO = {
445 - shareInfo:{  
446 - shareTitle:this.newspaperListBean?.list[this.swiperIndex].pageName,  
447 - appCustomPublishTime:this.newspaperListBean?.list[this.swiperIndex].periodNum,  
448 - appCustomImageUrl:this.newspaperListBean?.list[this.swiperIndex].pagePic,  
449 - shareUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.shareUrl,  
450 - sharePosterCoverUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.sharePosterCoverUrl,  
451 - appCustomShowReport:false,  
452 - appCustomShowLike:-1,  
453 - shareOpen:1,  
454 - sharePosterOpen:1,  
455 - appCustomPosterShareControl:'-1',  
456 - appCustomShowPoster:-1,  
457 - appCustomShowPosterType:4, 451 + shareInfo: {
  452 + shareTitle: this.newspaperListBean?.list[this.swiperIndex].pageName,
  453 + appCustomPublishTime: this.newspaperListBean?.list[this.swiperIndex].periodNum,
  454 + appCustomImageUrl: this.newspaperListBean?.list[this.swiperIndex].pagePic,
  455 + shareUrl: this.newspaperListBean?.list[this.swiperIndex].sharePagePic.shareUrl,
  456 + sharePosterCoverUrl: this.newspaperListBean?.list[this.swiperIndex].sharePagePic.sharePosterCoverUrl,
  457 + appCustomShowReport: false,
  458 + appCustomShowLike: -1,
  459 + shareOpen: 1,
  460 + sharePosterOpen: 1,
  461 + appCustomPosterShareControl: '-1',
  462 + appCustomShowPoster: -1,
  463 + appCustomShowPosterType: 4,
458 } 464 }
459 } as ContentDetailDTO 465 } as ContentDetailDTO
460 - WDShare.shareContent(contentDetailData,TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage) 466 + WDShare.shareContent(contentDetailData, TrackConstants.PageName.NewsPaperPage,
  467 + TrackConstants.PageName.NewsPaperPage)
461 } 468 }
462 } 469 }