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-22 11:23:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6881aa77be201bdbcbf3485aee54633c9053dcec
6881aa77
1 parent
4d425951
feat:优化人民号动态卡以及动态详情页图片展示
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/DynamicDetailComponent.ets
View file @
6881aa7
...
...
@@ -1045,6 +1045,7 @@ struct createImg {
@Prop loadImg: boolean = true;
@State onePicW: number = 0; // 只有一张图时候图片的宽度
@State onePicH: number = 0; // 只有一张图时候图片的高度
compWidth = (DisplayUtils.getDeviceWidth() - 32)
async aboutToAppear(): Promise<void> {
if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
...
...
@@ -1108,6 +1109,21 @@ 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
if (sizeH > imageH) {
return sizeH
}else {
return imageH
}
} else {
return 305; //普通图
}
}
@Builder
longPicTip(weight: number, height: number) {
if (weight / height > 2 || height / weight > 2){
...
...
@@ -1216,7 +1232,7 @@ struct createImg {
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
.constraintSize({
maxHeight: this.
onePicW > this.onePicH ? 228 : 305
maxHeight: this.
getPicHeight(this.onePicW,this.onePicH)
})
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card19Component.ets
View file @
6881aa7
...
...
@@ -8,6 +8,7 @@ import { persistentStorage, hasClicked } from '../../utils/persistentStorage';
import { InfomationCardClick } from '../../utils/infomationCardClick'
import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed';
import router from '@ohos.router'
import { DisplayUtils } from 'wdKit';
const TAG = 'Card19Component';
...
...
@@ -137,6 +138,7 @@ struct createImg {
@Prop loadImg: boolean = true;
@State onePicW: number = 0; // 只有一张图时候图片的宽度
@State onePicH: number = 0; // 只有一张图时候图片的高度
compWidth = (DisplayUtils.getDeviceWidth() - 32)
async aboutToAppear(): Promise<void> {
if (this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
...
...
@@ -200,6 +202,21 @@ 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
if (sizeH > imageH) {
return sizeH
}else {
return imageH
}
} else {
return 305; //普通图
}
}
@Builder
longPicTip(weight: number, height: number) {
if (weight / height > 2 || height / weight > 2){
...
...
@@ -327,7 +344,7 @@ struct createImg {
// .aspectRatio(this.onePicW > this.onePicH ? 343 / 198 : 228 / 305)
.width('100%')
.constraintSize({
maxHeight: this.
onePicW > this.onePicH ? 228 : 305
maxHeight: this.
getPicHeight(this.onePicW,this.onePicH)
})
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
...
...
Please
register
or
login
to post a comment