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
wangyong_wd
2024-04-24 22:17:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
880d864d554e8f225de8416368d5ba8418cf6419
880d864d
1 parent
4cb803e8
fix:修复轮播图:1、单张图片不显示底部indicator;2、轮播图数量超过9,indicator显示字数问题;3、直播信息,左上角显示直播状态
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhCarouselLayout01.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhCarouselLayout01.ets
View file @
880d864
...
...
@@ -4,6 +4,7 @@ import { BreakPointType, Logger } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
import { ProcessUtils } from 'wdRouter';
import { EmptyComponent } from '../view/EmptyComponent';
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
const TAG = 'Zh_Carousel_Layout-01';
...
...
@@ -73,7 +74,7 @@ export struct ZhCarouselLayout01 {
ForEach(this.compDTO?.operDataList, (item: ContentDTO, index: number) => {
CarouselLayout01CardView({
item: item,
index: index
length: this.compDTO.operDataList.length
})
})
}
...
...
@@ -102,6 +103,7 @@ export struct ZhCarouselLayout01 {
console.info("onAnimationEnd, index: " + index)
})
if (this.compDTO?.operDataList.length > 1) {
// 自定义indicator
GridRow({
columns: this.data.totalCount(),
...
...
@@ -133,6 +135,7 @@ export struct ZhCarouselLayout01 {
})
.alignItems(ItemAlign.End)
}
}
.alignContent(Alignment.BottomEnd)
.width(CommonConstants.FULL_WIDTH)
.padding({
...
...
@@ -159,7 +162,7 @@ export struct ZhCarouselLayout01 {
@Component
struct CarouselLayout01CardView {
private item: ContentDTO = {} as ContentDTO;
private
index: number = -1;
private
length: number = 1; // 轮播图数量
build() {
Stack() {
...
...
@@ -167,6 +170,7 @@ struct CarouselLayout01CardView {
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.objectFit(ImageFit.Cover)
Row()
.width(CommonConstants.FULL_PARENT)
.height(60)
...
...
@@ -174,6 +178,13 @@ struct CarouselLayout01CardView {
direction: GradientDirection.Top, // 渐变方向:to Top/从下往上
colors: [[0x7508111A, 0.0], [0x7508111A, 0.3], [Color.Transparent, 1.0]]
})
Column() {
// 这里用于展示轮播图右上角信息,这里只对直播类型的展示
if (this.item.objectType === '2') {
CardMediaInfo({ contentDTO: this.item })
.width(CommonConstants.FULL_PARENT)
}
Blank()
// 文本信息
Text(`${this.item.corner}${this.item.newsTitle}`)
.width(CommonConstants.FULL_PARENT)
...
...
@@ -183,7 +194,7 @@ struct CarouselLayout01CardView {
right: 10
})
.margin({
bottom: 28
bottom: this.length > 1 ? 28 : 10
})
.fontColor(Color.White)
.fontSize($r('app.float.font_size_16'))
...
...
@@ -193,6 +204,9 @@ struct CarouselLayout01CardView {
.maxLines(CompUtils.MAX_LINES_2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
}
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(CompUtils.ASPECT_RATIO_2_1)
.alignContent(Alignment.BottomStart)
...
...
@@ -244,7 +258,7 @@ struct indicatorAnimations {
.width('100%')
.alignContent(Alignment.Start)
Text(
`0
${this.index + 1}`)
Text(
this.index + 1 < 10 ? `0${this.index + 1}` : `
${this.index + 1}`)
.fontSize(this.centerFontSize)
.fontColor($r('app.color.white'))
.width(16)
...
...
Please
register
or
login
to post a comment