wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix |> 修复评论超3行未折叠显示,无展开、收起按钮的问题
... ... @@ -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)
... ...