wangliang_wd

feat:优化人民号动态卡图片展示

... ... @@ -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)
... ...