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
wangyujian_wd
2024-04-19 12:18:36 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9745e2d1077dfbccac3973074a426b2c03c7d7b7
9745e2d1
1 parent
bd222260
feat:1)电子报修改优化
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
14 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
View file @
9745e2d
...
...
@@ -8,6 +8,7 @@ import { ENewspaperCalendarDialog } from '../dialog/ENewspaperCalendarDialog';
import font from '@ohos.font';
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog';
import { RMCalendarBean } from './calendar/RMCalendarBean';
import { newsSkeleton } from './skeleton/newsSkeleton';
@Component
export struct ENewspaperPageComponent {
...
...
@@ -63,13 +64,15 @@ export struct ENewspaperPageComponent {
customStyle: true,
})
//文字报纸弹框
listDialogController: CustomDialogController = new CustomDialogController({
builder: ENewspaperListDialog({
newspaperListBean: this.newspaperListBean
}),
alignment: DialogAlignment.Bottom,
offset: { dx: 0, dy: 0 }
})
@State isOpenListDialog: boolean = false
// listDialogController: CustomDialogController = new CustomDialogController({
// builder: ENewspaperListDialog({
// newspaperListBean: this.newspaperListBean
// }),
// alignment: DialogAlignment.Bottom,
// offset: { dx: 0, dy: 0 }
// })
async aboutToAppear() {
//获取宽高尺寸
...
...
@@ -95,6 +98,7 @@ export struct ENewspaperPageComponent {
}
build() {
Stack() {
RelativeContainer() {
RelativeContainer() {
Image($r('app.media.icon_arrow_down'))
...
...
@@ -154,6 +158,18 @@ export struct ENewspaperPageComponent {
})
.id('e_newspaper_top')
if (!this.newspaperListBean || !this.newspaperListBean.list || this.newspaperListBean.list.length == 0) {
newsSkeleton()
.alignRules({
top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
.id('news_skeleton_id')
.width('100%')
.height(px2vp(this.picHeight) + 32)
.margin({ top: 35, left: 10, right: 10 })
}
if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) {
Swiper(this.swiperController) {
ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => {
...
...
@@ -266,13 +282,23 @@ export struct ENewspaperPageComponent {
})
.id('e_newspaper_read')
.onClick((event: ClickEvent) => {
this.listDialogController.open()
this.isOpenListDialog = true
})
}
.width('100%')
.height('100%')
.backgroundColor($r('app.color.color_80000000'))
.id('e_newspaper_container')
ENewspaperListDialog({
newspaperListBean: this.newspaperListBean,
closeDialog: () => {
this.isOpenListDialog = false
}
})
.visibility(this.isOpenListDialog ? Visibility.Visible : Visibility.None)
}
}
private async getNewspaperTime() {
...
...
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
View file @
9745e2d
...
...
@@ -12,7 +12,7 @@ export struct ENewspaperListDialog {
@Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string
@State pageDialogShow: boolean = false
@State scrollIndex: number = 0
newspaperListBean: NewspaperListBean = {} as NewspaperListBean
@Prop
newspaperListBean: NewspaperListBean = {} as NewspaperListBean
private listScroller: Scroller = new Scroller();
//文字版选择弹框
pageListDialogController: CustomDialogController = new CustomDialogController({
...
...
@@ -21,13 +21,14 @@ export struct ENewspaperListDialog {
newspaperListBean: this.newspaperListBean,
}),
alignment: DialogAlignment.TopStart,
offset: { dx: 0, dy: 2
1
4 },
offset: { dx: 0, dy: 2
2
4 },
customStyle: true,
})
//页面半屏弹窗(实现在上个组件)若尝试在CustomDialog中传入多个其他的Controller,
// 以实现在CustomDialog中打开另一个或另一些CustomDialog,
// 那么此处需要将指向自己的controller放在所有controller的后面
listDialogController: CustomDialogController
// listDialogController: CustomDialogController
public closeDialog?: () => void
//watch监听报纸页码回调
onCurrentPageNumUpdated(): void {
...
...
@@ -53,6 +54,7 @@ export struct ENewspaperListDialog {
}
build() {
Stack() {
Column() {
Row()
.width(43)
...
...
@@ -62,6 +64,11 @@ export struct ENewspaperListDialog {
top: 10,
bottom: 10
})
.onClick(() => {
if (this.closeDialog) {
this.closeDialog()
}
})
Row() {
Text(this.currentPageNum)
.fontSize($r('app.float.font_size_36'))
...
...
@@ -142,6 +149,7 @@ export struct ENewspaperListDialog {
.fontColor($r('app.color.color_999999'))
.margin({ top: 15, bottom: 15 })
.maxLines(5)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
}
.alignItems(HorizontalAlign.Start)
...
...
@@ -159,9 +167,9 @@ export struct ENewspaperListDialog {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
if (this.listDialogController) {
this.listDialogController.close()
}
// if (this.listDialogController) {
// this.listDialogController.close()
// }
})
}
...
...
@@ -172,6 +180,9 @@ export struct ENewspaperListDialog {
}
.width('100%')
.padding({ left: 15, right: 15 })
.margin({
bottom: 85
})
.scrollBar(BarState.Off)
.divider({
strokeWidth: 0.5,
...
...
@@ -191,9 +202,20 @@ export struct ENewspaperListDialog {
console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset)
})
}
.margin({ top: 124 })
.width('100%')
.backgroundColor(Color.White)
.onClick(() => {
})
}.width('100%')
.height('100%')
.backgroundColor('#80000000')
.onClick(() => {
if (this.closeDialog) {
this.closeDialog()
}
})
}
updateCurrentPageNum(firstIndex: number): void {
...
...
Please
register
or
login
to post a comment