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
chenquansheng
2024-11-07 10:33:12 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
666a1a4e7152df05b113177fbba36f8f03d03b4d
666a1a4e
1 parent
2910d3e7
ref |> 添加长按评论回复功能
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
31 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
View file @
666a1a4
...
...
@@ -45,6 +45,9 @@ export struct CommentComponent {
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
firstPageHotIds: string = ''
@State dialogController: CustomDialogController | null = null;
@State customDialogController: CustomDialogController | null = null;
@State delDialogController: CustomDialogController | null = null;
// @State private browSingModel: commentListModel = new commentListModel()
// 是否为固定高度模式。true时,里面上拉加载更多生效,外层不能包Scroll。
...
...
@@ -69,6 +72,8 @@ export struct CommentComponent {
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
this.customDialogController = null
this.delDialogController = null
}
aboutToAppear() {
...
...
@@ -104,6 +109,32 @@ export struct CommentComponent {
maskColor: "#50000000",
})
this.customDialogController = new CustomDialogController({
builder:DeleteCommentDialogView({
configItem:this.itemType(),
confirmCallback: (actionType:PublicCommentMoreActionType) =>{
this.confirmCallback(actionType)
}
}),
alignment:DialogAlignment.Bottom
})
this.delDialogController = new CustomDialogController({
builder: ConfirmLogoutDialog({
tipShow:false,
title:"是否确认删除?",
leftText:"取消",
leftTextColor:$r('app.color.color_648DF2'),
rightText:"确认",
cancelIsLeft:true,
confirm: () => {
this.deleteComponent()
}
}),
customStyle: true,
alignment: DialogAlignment.Center
})
this.getData();
this.windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口
...
...
@@ -149,32 +180,6 @@ export struct CommentComponent {
}
}
customDialogController: CustomDialogController = new CustomDialogController({
builder:DeleteCommentDialogView({
configItem:this.itemType(),
confirmCallback: (actionType:PublicCommentMoreActionType) =>{
this.confirmCallback(actionType)
}
}),
alignment:DialogAlignment.Bottom
})
delDialogController: CustomDialogController = new CustomDialogController({
builder: ConfirmLogoutDialog({
tipShow:false,
title:"是否确认删除?",
leftText:"取消",
leftTextColor:$r('app.color.color_648DF2'),
rightText:"确认",
cancelIsLeft:true,
confirm: () => {
this.deleteComponent()
}
}),
customStyle: true,
alignment: DialogAlignment.Center
})
confirmCallback(actionType:PublicCommentMoreActionType){
//复制评论内容
...
...
@@ -194,7 +199,7 @@ export struct CommentComponent {
if (actionType == PublicCommentMoreActionType.PublicCommentMoreActionType_Delete) {
//删除评论内容
this.delDialogController.open();
this.delDialogController
?
.open();
return
}
...
...
@@ -243,9 +248,9 @@ export struct CommentComponent {
itemType() {
let typeArr:string[] = []
// if (this.item.id && this.item.checkStatus == '2') {
// typeArr.push('回复')
// }
if (this.item.id && this.item.checkStatus == '2') {
typeArr.push('回复')
}
typeArr.push('复制')
if (HttpUtils.isLogin()) {
if (HttpUtils.getUserId() == this.item.fromUserId) {
...
...
@@ -256,7 +261,7 @@ export struct CommentComponent {
}
showDeleteCommentDialogView(){
this.customDialogController.open();
this.customDialogController
?
.open();
}
/*标题:全部评论*/
...
...
@@ -585,6 +590,17 @@ struct ChildCommentItem {
@Consume inDialog: boolean
private dialogBeforeJumpOtherPageAction: () => void = () => {}
private longPressCommentAction: () => void = () => {}
private isLongPress:boolean = false
aboutToAppear() {
getContext(this).eventHub.on('1',()=>{
if (this.isLongPress) {
this.replyComment()
this.isLongPress = false
}
})
}
build() {
Column() {
...
...
@@ -653,6 +669,7 @@ struct ChildCommentItem {
LongPressGesture()
.onAction((event: GestureEvent|undefined)=>{
if (event) {
this.isLongPress = true
this.longPressCommentAction()
}
})
...
...
@@ -841,6 +858,15 @@ struct commentHeaderView {
@Prop isZD: boolean = false
private isLongPress:boolean = false
aboutToAppear() {
getContext(this).eventHub.on('1',()=>{
if (this.isLongPress) {
this.replyComment()
this.isLongPress = false
}
})
}
build() {
Column() {
...
...
Please
register
or
login
to post a comment