Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
liyubing
2024-06-05 11:27:09 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
360f52852fe20284a7dd755519c373aea42a35c1
360f5285
1 parent
ead4b48f
feat:
1、电子报全屏适配
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
53 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
View file @
360f528
...
...
@@ -10,7 +10,7 @@ import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
import { RMCalendarBean } from './calendar/RMCalendarBean';
import { newsSkeleton } from './skeleton/newsSkeleton';
import { Logger, ToastUtils, NetworkUtil, CustomToast } from 'wdKit/Index';
import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index';
import { TrackingContent,
TrackConstants, TrackingButton } from 'wdTracking/Index';
import { WDShare } from 'wdShare/Index';
import { window } from '@kit.ArkUI';
import { WindowModel } from 'wdKit';
...
...
@@ -35,26 +35,26 @@ export struct ENewspaperPageComponent {
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State ratio: string = '100%'
@State toastText:ResourceStr = ""
@State toastText: ResourceStr = ""
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
bgColor:$r("app.color.color_B3000000"),
opacityValue:1,
fontSizeValue:"25lpx",
lineHeightValue:"36lpx",
bgColor: $r("app.color.color_B3000000"),
opacityValue: 1,
fontSizeValue: "25lpx",
lineHeightValue: "36lpx",
msg: this.toastText,
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
maskColor:"#00000000"
maskColor:
"#00000000"
})
showToastTip(msg:
ResourceStr)
{
showToastTip(msg:
ResourceStr)
{
this.toastText = msg
this.dialogToast.open()
}
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
console.log("ENewspaperPageComponent-onCurrentPageNumUpdated", "currentPageNum:", this.currentPageNum)
...
...
@@ -63,12 +63,13 @@ export struct ENewspaperPageComponent {
this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex
//电子报--版面序号选择点击
TrackingContent.clickWithEvent('panel_number_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate':this.selectDate.toDateString(),
'currentNumber':this.swiperIndex,
TrackingContent.clickWithEvent('panel_number_selection_click', TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage
, {
'panelNumber': this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName': this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate': this.selectDate.toDateString(),
'currentNumber': this.swiperIndex,
})
}
...
...
@@ -88,12 +89,13 @@ export struct ENewspaperPageComponent {
new Date(date.fullYear ? date.fullYear : 0, date.month ? date.month : 0, date.date ? date.date : 0)
}
//日历选择点击
TrackingContent.clickWithEvent('date_selection_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate':this.selectDate.toDateString(),
'currentNumber':this.swiperIndex,
TrackingContent.clickWithEvent('date_selection_click', TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage
, {
'panelNumber': this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName': this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate': this.selectDate.toDateString(),
'currentNumber': this.swiperIndex,
})
}
}),
...
...
@@ -134,7 +136,7 @@ export struct ENewspaperPageComponent {
this.picWidth = this.screenWidth - vp2px(52)
let screenHeight = this.displayTool.height;
// bottomSafeHeight 底导高度 topSafeHeight 顶导高度 44 顶部高度 60 底部高度
let height = screenHeight -this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60)
let height = screenHeight -
this.bottomSafeHeight - this.topSafeHeight - vp2px(44) - vp2px(60)
this.picHeight = height
// 默认日期
const date = new Date()
...
...
@@ -213,6 +215,7 @@ export struct ENewspaperPageComponent {
this.calendarDialogController.close()
}
})
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Image($r('app.media.icon_share'))
.height($r('app.float.top_arrow_size'))
...
...
@@ -227,7 +230,7 @@ export struct ENewspaperPageComponent {
})
}
}
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') })
.margin({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16')
, top: this.topSafeHeight + 'px'
})
.height($r('app.float.top_bar_height'))
.alignRules({
top: { anchor: '__container__', align: VerticalAlign.Top },
...
...
@@ -251,7 +254,7 @@ export struct ENewspaperPageComponent {
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Swiper(this.swiperController) {
ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
ENewspaperItemComponent({ newspaperListItemBean: item})
ENewspaperItemComponent({ newspaperListItemBean: item
})
})
}
.itemSpace(10)
...
...
@@ -310,10 +313,11 @@ export struct ENewspaperPageComponent {
.onClick((event: ClickEvent) => {
this.swiperController.showNext()
// 电子报--滑动查看下一版
TrackingButton.click('panelPageViewNextPanel',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
TrackingButton.click('panelPageViewNextPanel', TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage
, {
'panelNumber': this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName': this.newspaperListBean?.list[this.swiperIndex].pageName,
})
})
}
...
...
@@ -341,7 +345,7 @@ export struct ENewspaperPageComponent {
})
.id('e_newspaper_page_num')
.onClick((event: ClickEvent) => {
if
(!NetworkUtil.isNetConnected())
{
if
(!NetworkUtil.isNetConnected())
{
this.showToastTip('网络出小差了,请检查网络后重试')
return
}
...
...
@@ -352,7 +356,7 @@ export struct ENewspaperPageComponent {
} else {
this.pageDialogController.close()
}
}else {
}
else {
this.showToastTip('暂无数据')
}
})
...
...
@@ -380,21 +384,22 @@ export struct ENewspaperPageComponent {
})
.id('e_newspaper_read')
.onClick((event: ClickEvent) => {
if
(!NetworkUtil.isNetConnected())
{
if
(!NetworkUtil.isNetConnected())
{
this.showToastTip('网络出小差了,请检查网络后重试')
return
}
if (this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
this.isOpenListDialog = true
//电子报--读报纸点击
TrackingContent.clickWithEvent('read_newspaper_click',TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage
,{
'panelNumber':this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName':this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate':this.selectDate.toDateString(),
'currentNumber':this.swiperIndex,
TrackingContent.clickWithEvent('read_newspaper_click', TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage
, {
'panelNumber': this.newspaperListBean?.list[this.swiperIndex].pageNum,
'panelName': this.newspaperListBean?.list[this.swiperIndex].pageName,
'currentPanelDate': this.selectDate.toDateString(),
'currentNumber': this.swiperIndex,
})
}else {
}
else {
this.showToastTip('暂无数据')
}
})
...
...
@@ -430,7 +435,8 @@ export struct ENewspaperPageComponent {
private async getNewspaperList() {
try {
if (NetworkUtil.isNetConnected()) {
let listBean = await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight)
let listBean =
await NewspaperViewModel.getNewspaperList(this.calendarDate, this.picWidth + 'x' + this.picHeight)
this.newspaperListBean = listBean;
} else {
this.showToastTip('网络出小差了,请检查网络后重试')
...
...
@@ -442,21 +448,22 @@ export struct ENewspaperPageComponent {
share() {
let contentDetailData: ContentDetailDTO = {
shareInfo:{
shareTitle:this.newspaperListBean?.list[this.swiperIndex].pageName,
appCustomPublishTime:this.newspaperListBean?.list[this.swiperIndex].periodNum,
appCustomImageUrl:this.newspaperListBean?.list[this.swiperIndex].pagePic,
shareUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.shareUrl,
sharePosterCoverUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.sharePosterCoverUrl,
appCustomShowReport:false,
appCustomShowLike:-1,
shareOpen:1,
sharePosterOpen:1,
appCustomPosterShareControl:'-1',
appCustomShowPoster:-1,
appCustomShowPosterType:4,
shareInfo: {
shareTitle: this.newspaperListBean?.list[this.swiperIndex].pageName,
appCustomPublishTime: this.newspaperListBean?.list[this.swiperIndex].periodNum,
appCustomImageUrl: this.newspaperListBean?.list[this.swiperIndex].pagePic,
shareUrl: this.newspaperListBean?.list[this.swiperIndex].sharePagePic.shareUrl,
sharePosterCoverUrl: this.newspaperListBean?.list[this.swiperIndex].sharePagePic.sharePosterCoverUrl,
appCustomShowReport: false,
appCustomShowLike: -1,
shareOpen: 1,
sharePosterOpen: 1,
appCustomPosterShareControl: '-1',
appCustomShowPoster: -1,
appCustomShowPosterType: 4,
}
} as ContentDetailDTO
WDShare.shareContent(contentDetailData,TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage)
WDShare.shareContent(contentDetailData, TrackConstants.PageName.NewsPaperPage,
TrackConstants.PageName.NewsPaperPage)
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment