王士厅
... ... @@ -91,7 +91,8 @@ export struct ZhCarouselLayout01 {
ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
CarouselLayout01CardView({
item: item,
length: this.compDTO.operDataList.length
length: this.compDTO.operDataList.length,
showPicBorderRadius: this.compDTO.operDataList.length == 1
})
.onClick((event: ClickEvent) => {
InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName)
... ... @@ -188,6 +189,7 @@ struct CarouselLayout01CardView {
@State loadImg: boolean = false;
private item: ContentDTO = new ContentDTO();
private length: number = 1; // 轮播图数量
private showPicBorderRadius: boolean = false;
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
... ... @@ -200,6 +202,7 @@ struct CarouselLayout01CardView {
.height(CommonConstants.FULL_PARENT)
.objectFit(ImageFit.Cover)
.backgroundColor(0xf5f5f5)
.borderRadius(this.showPicBorderRadius ? $r('app.float.image_border_radius') : 0)
Row()
.width(CommonConstants.FULL_PARENT)
... ...
... ... @@ -132,7 +132,7 @@ export struct ZhSingleColumn09 {
.width('100%')
Grid() {
ForEach(this.operDataList, (item: ContentDTO, index: number) => {
ForEach(this.operDataList.slice(0, 8), (item: ContentDTO, index: number) => {
GridItem() {
Stack({ alignContent: Alignment.TopEnd }) {
Image(this.loadImg ? item.coverUrl : '')
... ... @@ -161,7 +161,7 @@ export struct ZhSingleColumn09 {
.objectFit(ImageFit.Contain)
}
.width('100%')
.height('100%')
.aspectRatio(2 / 1)
}
.margin({ right: index % 4 === 3 ? 0 : 6, bottom: 6 })
.onClick(() => {
... ... @@ -174,9 +174,7 @@ export struct ZhSingleColumn09 {
})
})
}
.height(90)
.columnsTemplate('1fr 1fr 1fr 1fr')
.rowsTemplate('1fr 1fr')
.margin({ bottom: 5 })
Row() {
... ... @@ -192,11 +190,14 @@ export struct ZhSingleColumn09 {
.onClick(() => {
if (this.currentOperDataListIndex > 0) {
this.currentOperDataListIndex--
} else {
return
}
if (this.compDTO?.operDataList.length > 8) {
if (this.pageModel) {
this.pageModel.compList.deleteItem(this.compIndex)
}
this.operDataList = this.shuffleArray(this.operDataList)
// if (this.pageModel) {
// this.pageModel.compList.deleteItem(this.compIndex)
// }
this.activeIndexs = [];
}
})
... ...