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-05-24 12:55:47 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f3f737893d3476f8a99f3c8ea24e461ca73c20a2
f3f73789
1 parent
9c003f8b
精选评论通顶通底
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
33 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
View file @
f3f7378
...
...
@@ -18,9 +18,8 @@ const TAG = 'QualityCommentsComponent';
@Preview
@Component
export struct QualityCommentsComponent {
//刷新
@State viewType:number = ViewType.LOADING;
@State viewType:
number = ViewType.LOADING;
@State hasMore: boolean = true;
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
...
...
@@ -32,11 +31,9 @@ export struct QualityCommentsComponent {
currentWindowColor: string = '#FF4202'
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
/*必传*/
@State publishCommentModel: publishCommentModel = new publishCommentModel()
aboutToDisappear(): void {
// windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
this.dialogController = null // 将dialogController置空
...
...
@@ -55,7 +52,7 @@ export struct QualityCommentsComponent {
this.showAlert()
}
showAlert(){
showAlert()
{
this.dialogController = new CustomDialogController({
builder: CommentCustomDialog({
confirm: (value: Record<string, string>) => {
...
...
@@ -74,9 +71,11 @@ export struct QualityCommentsComponent {
})
}
getData(resolve?: (value: string | PromiseLike<string>) => void){
getData(resolve?: (value: string | PromiseLike<string>) => void)
{
commentViewModel.fetchQualityCommentList(this.currentPage + '').then((commentListModel) => {
if(resolve) resolve('刷新成功')
if (resolve) {
resolve('刷新成功')
}
if (commentListModel && commentListModel.list && commentListModel.list.length > 0) {
if (this.currentPage === 1) {
...
...
@@ -143,6 +142,7 @@ export struct QualityCommentsComponent {
.height(this.topSafeHeight + vp2px(44) + 'px')
.width('100%')
.backgroundColor($r('app.color.color_transparent'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
/*导航栏*/
...
...
@@ -187,62 +187,66 @@ export struct QualityCommentsComponent {
.height(this.topSafeHeight + vp2px(44) + 'px')
.width('100%')
.backgroundColor($r('app.color.white'))
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])
}
build() {
Column() {
Stack({ alignContent: Alignment.Top }) {
Scroll() {
Column() {
Stack() {
this.titleHeader()
if(this.viewType == ViewType.ERROR)
{
if (this.viewType == ViewType.ERROR)
{
ErrorComponent()
}else if(this.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoComment})
}else {
} else if (this.viewType == ViewType.EMPTY) {
EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoComment })
} else {
this.listLayout()
}
}.alignContent(Alignment.Top)
}.backgroundColor(this.currentWindowColor).width('100%')
}
.backgroundColor(this.currentWindowColor).width('100%')
}
.friction(0.6)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.width('100%')
.height('100%')
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
this.TabbarTransparent()
this.TabbarNormal()
}
}
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
@Builder
listLayout(){
List({ space: 12, scroller:this.scroller }) {
listLayout() {
List({ space: 12, scroller: this.scroller }) {
// ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
ListItem() {
QualityCommentItem({ item: item, index: index , dialogController:this.dialogController, publishCommentModel:this.publishCommentModel}).margin({ left: 12, right: 12 })
QualityCommentItem({
item: item,
index: index,
dialogController: this.dialogController,
publishCommentModel: this.publishCommentModel
}).margin({ left: 12, right: 12 })
}
})
// 加载更多
ListItem() {
if (this.hasMore === false) NoMoreLayout()
if (this.hasMore === false) {
NoMoreLayout()
}
}
// ListItem() {
//
// }.height(`${this.bottomSafeHeight}` + 'px')
}.onReachEnd(()=>{
}
.onReachEnd(() => {
this.currentPage++
this.getData()
})
...
...
@@ -255,14 +259,9 @@ export struct QualityCommentsComponent {
scrollBackward: NestedScrollMode.SELF_FIRST
})
}
}
@Component
struct QualityCommentItem {
@ObjectLink publishCommentModel: publishCommentModel
...
...
@@ -279,7 +278,8 @@ struct QualityCommentItem {
Image(this.item.fromUserHeader)
.alt($r(commentViewModel.adjustUserType(this.item.fromUserType) ? 'app.media.WDAccountOwnerHedaerDefaultIcon' : 'app.media.WDAccountDefaultIcon'))
.alt($r(commentViewModel.adjustUserType(this.item.fromUserType) ?
'app.media.WDAccountOwnerHedaerDefaultIcon' : 'app.media.WDAccountDefaultIcon'))
.width(50)
.height(50)
.borderRadius(25)
...
...
@@ -376,7 +376,7 @@ struct QualityCommentItem {
Row() {
Image($r('app.media.comment_icon_pinglun')).width(16).height(16)
}.height('100%')
.onClick(()
=>
{
.onClick(()
=>
{
this.replyComment()
})
...
...
Please
register
or
login
to post a comment