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
yangsunyue_wd
2024-04-29 09:12:56 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e50122dbe0927de82d088c68e9a81f1d3006ac1a
e50122db
1 parent
bae802d5
desc:评论相关
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
6 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentCustomDialog.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentTabComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
e50122d
import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit';
import { Logger, NumberFormatterUtils, DateTimeUtils
, EmitterUtils, EmitterEventId
} from 'wdKit';
import {
Action,
ContentDetailDTO,
...
...
@@ -126,6 +126,7 @@ export struct ImageAndTextPageComponent {
CommentComponent({
publishCommentModel: this.publishCommentModel
})
// .onMeasureSize()
}
}
}
...
...
@@ -280,6 +281,15 @@ export struct ImageAndTextPageComponent {
aboutToAppear() {
this.getDetail()
//注册通知,来自别的组件的评论成功通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, (targetId?: string) => {
if (targetId) {
if (targetId == this.publishCommentModel.targetId) {
// 滚动到评论列表
}
}
})
}
aboutToDisappear() {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
View file @
e50122d
...
...
@@ -25,6 +25,10 @@ export struct CommentComponent {
// @State private browSingModel: commentListModel = new commentListModel()
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
listScroller: ListScroller = new ListScroller(); // scroller控制器
historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
...
...
@@ -69,11 +73,12 @@ export struct CommentComponent {
//
addCommentLocal() {
let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel)
// let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel)
let model = this.publishCommentModel.lastCommentModel
/*一级评论*/
// if (this.publishCommentModel.lastCommentModel)
if (this.publishCommentModel.lastCommentModel.parentId == '-1') {
this.allDatas.addFirstItem(model)
//TODO 跳转顶部
} else {
//二级评论
this.allDatas.getDataArray().forEach(element => {
...
...
@@ -134,7 +139,7 @@ export struct CommentComponent {
build() {
Column() {
List() {
List(
{scroller:this.listScroller}
) {
ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
...
...
@@ -176,7 +181,9 @@ export struct CommentComponent {
if (this.hasMore === false) NoMoreLayout()
}
}
// .onScrollFrameBegin((offset: number, state: ScrollState)=>{
//
// })
.onReachEnd(()=>{
if (this.hasMore) {
this.getData()
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentCustomDialog.ets
View file @
e50122d
...
...
@@ -27,7 +27,9 @@ export struct CommentCustomDialog {
this.publishCommentModel.commentType = '2'
commentViewModel.publishComment(this.publishCommentModel).then((model:commentItemModel) => {
this.publishCommentModel.commentContent = ''
this.publishCommentModel.lastCommentModel = model
//
this.publishCommentModel.lastCommentModel = commentViewModel.deepCopyCommentItemModel(model)
// this.commentText = ''
if (this.controller != null) {
this.controller.close()
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentTabComponent.ets
View file @
e50122d
...
...
@@ -44,7 +44,10 @@ export struct CommentTabComponent {
}
}.width(151).height(30)
.onClick(() => {
this.publishCommentModel.rootCommentId = '-1';
this.publishCommentModel.parentId = '-1';
this.publishCommentModel.placeHolderText = "优质评论会获得最佳评论人的称号"
this.dialogController?.open();
})
}
...
...
Please
register
or
login
to post a comment