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
陈剑华
2024-09-06 15:05:13 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
34ddbb0b4cfb1a46998fc7e0cc2eb48f9772ef2b
34ddbb0b
1 parent
f06a89dd
fix: 20218 搜索-猛犸新闻,搜索结果中动态图文的长图比例展示不正确
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
74 deletions
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
View file @
34ddbb0
...
...
@@ -185,6 +185,34 @@ struct createImg {
}
}
@Builder
longPicTip(weight: number, height: number) {
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
weight / height > 2 || height / weight > 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 8 })
}
build() {
GridRow({
gutter: { x: 2, y: 2 }
...
...
@@ -212,29 +240,7 @@ struct createImg {
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
}
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({right: 4})
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: '#777',
offsetX:1,
offsetY:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.padding({bottom: 9})
this.longPicTip(item.weight, item.height)
}
}
...
...
@@ -261,20 +267,25 @@ struct createImg {
GridCol({
span: this.onePicW > this.onePicH ? 12 : 8
}) {
Stack({alignContent: Alignment.BottomEnd}) {
Image(this.loadImg ? item.url || item.fullUrl : '')
.backgroundColor(0xf5f5f5)
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
.constraintSize({
maxHeight: this.onePicW > this.onePicH ? 198 : 305
})
.autoResize(true)
// .objectFit(ImageFit.Cover)
.autoResize(true)
// .aspectRatio(3/4)
.borderRadius(this.caclImageRadius(index))
.opacity(!item.weight && !item.height ? 0 : 1)
.onComplete((event?) => {
this.onePicW = event?.width || 0;
this.onePicH = event?.height || 0;
})
if (this.onePicW && this.onePicH) {
this.longPicTip(this.onePicW, this.onePicH)
}
}
}
}
} else if (this.fullColumnImgUrls.length === 5) {
...
...
@@ -290,30 +301,7 @@ struct createImg {
.height('226lvp')
.borderRadius(this.caclImageRadius(index))
if(this.getPicType(item.weight, item.height) !== 3){
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY:1,
offsetX:1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 3 })
this.longPicTip(item.weight, item.height)
}
}
}
...
...
@@ -329,30 +317,7 @@ struct createImg {
.width('100%')
.autoResize(true)
if (this.getPicType(item.weight, item.height) !== 3) {
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(12)
.height(12)
.margin({ right: 4 })
Text('长图')
.fontSize(10)
.fontWeight(400)
.textShadow({
radius: 1,
color: `rgba(0,0,0,0.5)`,
offsetY: 1,
offsetX: 1
})
.fontColor(0xffffff)
.fontFamily('PingFang SC')
.visibility(
item.weight / item.height > 2 / 1 || item.weight / item.height < 1 / 2
? Visibility.Visible : Visibility.None
)
}
.width(48)
.align(Alignment.BottomEnd)
.padding({ bottom: 3 })
this.longPicTip(item.weight, item.height)
}
}
.onClick(() => {
...
...
Please
register
or
login
to post a comment