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-10-24 11:21:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0a3239fa0674c2e06a1733b366fe6df24241f558
0a3239fa
1 parent
ae9a8244
fix |> 修复评论超3行未折叠显示,无展开、收起按钮的问题
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 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 @
0a3239f
...
...
@@ -13,6 +13,8 @@ import NoMoreLayout from '../../page/NoMoreLayout';
import { EmptyComponent } from '../../view/EmptyComponent';
import { ContentDetailDTO, Params } from 'wdBean/Index';
import { TrackingContent, TrackParamConvert } from 'wdTracking/Index';
import { WindowModel } from 'wdKit/Index';
import { window } from '@kit.ArkUI';
const TAG = 'CommentComponent';
...
...
@@ -53,6 +55,11 @@ export struct CommentComponent {
private dialogBeforeJumpOtherPageAction: () => void = () => {}
private dialogUpdateTitle: (title: string) => void = () => {}
private windowClass?: window.Window;
@State isZD: boolean = false // 存储是否折叠屏
private screenWidth: number = 0
@State windowWidth: number = AppStorage.get<number>('windowWidth') || 0
// 在自定义组件即将析构销毁时将dialogControlle置空
aboutToDisappear() {
this.dialogController = null // 将dialogController置空
...
...
@@ -93,8 +100,19 @@ export struct CommentComponent {
this.getData();
this.windowClass = WindowModel.shared.getWindowClass(); // 获取应用主窗口
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width
// 2000折叠屏 TODO DeviceUtil 方法完善了换判断条件
this.isZD = this.screenWidth > 2000 ? true : false
this.resizeWindow()
}
resizeWindow() {
this.windowClass?.on('windowSizeChange', () => {
this.screenWidth = this.windowClass?.getWindowProperties()?.windowRect.width || this.windowWidth
this.isZD = this.screenWidth > 2000 ? true : false
});
}
//
addCommentLocal() {
// let model = commentViewModel.deepCopyCommentItemModel(this.publishCommentModel.lastCommentModel)
...
...
@@ -168,12 +186,13 @@ export struct CommentComponent {
/*1级评论作为titleHeader*/
@Builder
CommentHeaderItem(item: commentItemModel, index: number) {
CommentHeaderItem(item: commentItemModel, index: number
,isZD:boolean
) {
commentHeaderView({
item: item,
dialogController: this.dialogController,
publishCommentModel: this.publishCommentModel,
dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction
dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction,
isZD:isZD
})
}
...
...
@@ -214,7 +233,7 @@ export struct CommentComponent {
}
else if (item.hasMore) {
ListItemGroup({
header: this.CommentHeaderItem(item, index),
header: this.CommentHeaderItem(item, index
,this.isZD
),
footer: this.GroupFooterView(item, index)
}) {
LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => {
...
...
@@ -232,7 +251,7 @@ export struct CommentComponent {
}, (childItem: commentItemModel, subIndex: number) => JSON.stringify(childItem) + subIndex.toString())
}
} else {
ListItemGroup({ header: this.CommentHeaderItem(item, index) }) {
ListItemGroup({ header: this.CommentHeaderItem(item, index
,this.isZD
) }) {
LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => {
ListItem() {
ChildCommentItem({
...
...
@@ -684,6 +703,7 @@ struct commentHeaderView {
private dialogBeforeJumpOtherPageAction: () => void = () => {}
private leftGap: number = 64
@State isCanClickHeader:boolean = true
@Prop isZD: boolean = false
build() {
Column() {
...
...
@@ -731,7 +751,7 @@ struct commentHeaderView {
maxline: 3,
fontSize: 16,
fontWeight: FontWeight.Regular,
marginWidth: (
59
+ 16)
marginWidth: (
this.isZD?60:70
+ 16)
})
.margin({ left: this.leftGap, right: 16,top:-12 })
.onClick(() => {
...
...
@@ -745,7 +765,6 @@ struct commentHeaderView {
}
})
)
if (this.item.commentPics.length > 0) {
Image(this.item.commentPics)
.width(88).height(88)
...
...
Please
register
or
login
to post a comment