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
wangliang_wd
2024-10-23 14:26:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7129760ffe09ff28db354e171bef94a7c9b8193a
7129760f
1 parent
5b8997f4
feat:优化人民号动态卡图片展示
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 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 @
7129760
...
...
@@ -203,11 +203,9 @@ struct createImg {
}
getPicHeight(picWidth: number, picHeight: number) {
//console.info(`cj2024 getPicType picWidth = ${picWidth} picHeight = ${picHeight} picWidth / picHeight = ${picWidth / picHeight}`)
if (picWidth && picHeight) {
let imageH = 305
let sizeH = this.compWidth * picHeight / picWidth
return
Math.max(sizeH,imageH)
return
picWidth/picHeight === 1 ? 228:sizeH
} else {
return 305; //普通图
}
...
...
@@ -260,7 +258,7 @@ struct createImg {
Image(this.loadImg ? item.url || item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.
aspectRatio(
16 / 9)
.
height(this.compWidth *
16 / 9)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
...
...
@@ -268,6 +266,7 @@ struct createImg {
.borderColor($r('app.color.color_0D000000'))
} else if (this.getPicType(item.weight, item.height) === 2) {
Image(this.loadImg ? item.url || item.fullUrl : '')
.backgroundColor(0xf5f5f5)
.width('100%')
.height(305)
.autoResize(true)
...
...
@@ -304,8 +303,7 @@ struct createImg {
.width('100%')
.autoResize(true)
.objectFit(ImageFit.Cover)
.autoResize(true)
.aspectRatio(3/4)
.height(this.compWidth * 3 / 4)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
.borderWidth(0.5)
...
...
@@ -339,9 +337,10 @@ struct createImg {
.backgroundColor(0xf5f5f5)
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
.constraintSize({
maxHeight: this.getPicHeight(this.onePicW,this.onePicH)
})
.height(this.getPicHeight(item.weight,item.height))
// .constraintSize({
// maxHeight: this.getPicHeight(this.onePicW,this.onePicH)
// })
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
.borderStyle(BorderStyle.Solid)
...
...
Please
register
or
login
to post a comment