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
zhenghy
2024-04-19 12:49:09 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
7ecce0d8fbe73df57b742680a7052fe9d8505ee3
7ecce0d8
2 parents
21dba92d
8469939c
Merge branch 'main' of
http://192.168.1.42/developOne/harmonyPool
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
108 additions
and
52 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageDownloadComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/MyCollectionListPage.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/HorizontalStrokeCardThreeTwoRadioForMoreComponent.ets
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
sight_harmony/features/wdComponent/src/main/resources/base/media/logo_rmh.png
sight_harmony/features/wdComponent/src/main/resources/base/media/logo_rmrb.png
sight_harmony/features/wdComponent/src/main/ets/components/ENewspaperPageComponent.ets
View file @
7ecce0d
...
...
@@ -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/components/ImageAndTextPageComponent.ets
View file @
7ecce0d
import { Logger, NumberFormatterUtils } from 'wdKit';
import { Logger, NumberFormatterUtils
, DateTimeUtils
} from 'wdKit';
import {
Action,
ContentDetailDTO,
...
...
@@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel';
import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
import router from '@ohos.router';
import { RecommendList } from '../components/view/RecommendList'
import { CommonConstants } from 'wdConstant'
import { CommonConstants } from 'wdConstant'
;
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton'
import { detailedSkeleton } from './skeleton/detailSkeleton';
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
const TAG = 'ImageAndTextPageComponent'
@Component
export struct ImageAndTextPageComponent {
scroller: Scroller = new Scroller();
...
...
@@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent {
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State isPageEnd: boolean = false
@State publishTime: string = ''
build() {
Column() {
if (!this.isPageEnd) {
...
...
@@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent {
} else {
// 发布时间
Row() {
Image($r('app.media.icon_ren_min_ri_bao'))
.width(70)
Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
Text(this.contentDetailData[0]?
.publishTime)
Text(this
.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize($r('app.float.font_size_13'))
.height('100%')
...
...
@@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent {
let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN)
if (this.contentDetailData[0]?.recommendShow === 1) {
this.getRecommend()
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageDownloadComponent.ets
View file @
7ecce0d
...
...
@@ -7,10 +7,14 @@ import { photoAccessHelper } from '@kit.MediaLibraryKit';
import fs from '@ohos.file.fs';
const PERMISSIONS: Array<Permissions> = [
'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA'
'ohos.permission.READ_IMAGEVIDEO',
'ohos.permission.WRITE_IMAGEVIDEO'
];
/*
* saveButton参考文档
* https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/savebutton-0000001820999677
* */
@Component
export struct ImageDownloadComponent {
@State image: PixelMap | undefined = undefined;
...
...
@@ -20,12 +24,8 @@ export struct ImageDownloadComponent {
build() {
Column() {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.rotate({ angle: -90 })
SaveButton({ icon: SaveIconStyle.LINES })
.iconColor(Color.White)
.onClick(async () => {
console.info(`cj2024 onClick ${this.imageBuffer}`)
if (this.imageBuffer !== undefined) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
View file @
7ecce0d
...
...
@@ -287,16 +287,6 @@ struct ChannelDialog {
.height('100%')
.justifyContent(FlexAlign.Center)
.backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff')
.onClick(() => {
if (this.isEditIng) {
if (item.delPermitted === 1) {
this.delChannelItem(index)
}
} else {
this.confirm(index)
this.controller?.close()
}
})
}
.width('23%')
.height(40)
...
...
@@ -307,9 +297,19 @@ struct ChannelDialog {
})
.zIndex(this.dragItem == item.num ? 1 : 0)
.translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 })
.gesture(
GestureGroup(GestureMode.Sequence,
TapGesture()
.onAction((event?: GestureEvent) => {
if (this.isEditIng) {
if (item.delPermitted === 1) {
this.delChannelItem(index)
}
} else {
this.confirm(index)
this.controller?.close()
}
}),
PanGesture({ fingers: 1, direction: null, distance: 0 })
.onActionStart((event: GestureEvent) => {
this.dragItem = item.num
...
...
@@ -330,8 +330,7 @@ struct ChannelDialog {
this.dragRefOffsetY = 0
})
})
)
.onCancel(() => {
).onCancel(() => {
animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => {
this.dragItem = -1
this.offsetX = 0
...
...
@@ -339,8 +338,8 @@ struct ChannelDialog {
this.dragRefOffsetX = 0
this.dragRefOffsetY = 0
})
}))
})
)
}, (item: TopNavDTO) => JSON.stringify(item))
}
.width('100%')
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/MyCollectionListPage.ets
View file @
7ecce0d
...
...
@@ -66,6 +66,7 @@ struct MyCollectionListPage {
}
if (this.isEditState){
Stack(){
CustomBottomFuctionUI({
selectAllCallback:(isAllSelect)=>{
this.allSelectDatas(isAllSelect)
...
...
@@ -74,7 +75,7 @@ struct MyCollectionListPage {
this.deleteDatas()
}
})
.position({y:'92%'})
}
.position({y:'92%'})
}
}
.width(CommonConstants.FULL_WIDTH)
...
...
@@ -119,16 +120,22 @@ struct MyCollectionListPage {
MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
if (this.currentPage === 1) this.allDatas = []
if (this.currentPage === 1) {
this.allDatas = []
this.allDatas.push(...collectionItem.list)
}else {
this.allDatas = this.allDatas.concat(...collectionItem.list)
if (collectionItem.totalCount === this.allDatas.length) {
}
if (collectionItem.hasNext === 0) {
this.browSingModel.hasMore = false;
} else {
this.browSingModel.hasMore = true;
}
} else {
if (this.currentPage === 1) {
this.browSingModel.viewType = ViewType.EMPTY;
}
}
})
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/HorizontalStrokeCardThreeTwoRadioForMoreComponent.ets
View file @
7ecce0d
import { CommonConstants } from 'wdConstant'
import { ContentDTO,CompDTO } from 'wdBean'
import { ContentDTO, CompDTO } from 'wdBean'
import { ProcessUtils } from '../../utils/ProcessUtils';
@Component
export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
...
...
@@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
.padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })
// .offset({x:16})
.onClick(() => {
if (item.objectType != '0') {
console.log(item.objectId)
}
ProcessUtils.processPage(item)
})
})
}.listDirection(Axis.Horizontal)
.scrollBar(BarState.Off)
.width('100%')
// .backgroundColor($r("app.color.color_FE4B05"))
...
...
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
View file @
7ecce0d
...
...
@@ -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 {
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/logo_rmh.png
0 → 100644
View file @
7ecce0d
4.05 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/logo_rmrb.png
0 → 100644
View file @
7ecce0d
4.26 KB
Please
register
or
login
to post a comment