Showing
2 changed files
with
60 additions
and
34 deletions
| @@ -39,46 +39,72 @@ export struct Card19Component { | @@ -39,46 +39,72 @@ export struct Card19Component { | ||
| 39 | } | 39 | } |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | +interface radiusType { | ||
| 43 | + topLeft: number | Resource; | ||
| 44 | + topRight: number | Resource; | ||
| 45 | + bottomLeft: number | Resource; | ||
| 46 | + bottomRight: number | Resource; | ||
| 47 | +} | ||
| 48 | + | ||
| 42 | @Component | 49 | @Component |
| 43 | struct createArticleListItem { | 50 | struct createArticleListItem { |
| 44 | @Prop appStyleImages: appStyleImagesDTO[] | 51 | @Prop appStyleImages: appStyleImagesDTO[] |
| 45 | 52 | ||
| 46 | - build() { | 53 | + caclImageRadius(index: number) { |
| 54 | + let radius: radiusType = { | ||
| 55 | + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 56 | + topRight: 0, | ||
| 57 | + bottomLeft: 0, | ||
| 58 | + bottomRight: 0, | ||
| 59 | + } | ||
| 47 | if (this.appStyleImages.length === 1) { | 60 | if (this.appStyleImages.length === 1) { |
| 48 | - Image(this.appStyleImages[0].fullUrl) | ||
| 49 | - .width('66%') | ||
| 50 | - .alignSelf(ItemAlign.Start) | ||
| 51 | - } else if (this.appStyleImages.length > 4 || this.appStyleImages.length === 2 || this | ||
| 52 | - .appStyleImages.length === 3) { | ||
| 53 | - Flex({ wrap: FlexWrap.Wrap }) { | ||
| 54 | - ForEach(this.appStyleImages, (item: appStyleImagesDTO, index: number) => { | ||
| 55 | - Image(item.fullUrl) | ||
| 56 | - .width('32%') | ||
| 57 | - .aspectRatio(1) | ||
| 58 | - .margin({ right: (index + 1) % 3 === 0 ? 0 : 2, bottom: 2 }) | ||
| 59 | - }) | ||
| 60 | - } | 61 | + radius.topRight = index === 0 ? $r('app.float.image_border_radius') : 0 |
| 62 | + radius.bottomLeft = index === 0 ? $r('app.float.image_border_radius') : 0 | ||
| 63 | + radius.bottomRight = index === 0 ? $r('app.float.image_border_radius') : 0 | ||
| 61 | } else if (this.appStyleImages.length === 4) { | 64 | } else if (this.appStyleImages.length === 4) { |
| 62 | - Flex({ wrap: FlexWrap.Wrap }) { | ||
| 63 | - ForEach(this.appStyleImages.slice(0, 2), (item: appStyleImagesDTO, index: number) => { | ||
| 64 | - Image(item.fullUrl) | ||
| 65 | - .width('32%') | ||
| 66 | - .aspectRatio(1) | ||
| 67 | - .margin({ right: (index + 1) % 3 === 0 ? 0 : 2, bottom: 2 }) | ||
| 68 | - }) | ||
| 69 | - Rect() | ||
| 70 | - .width('32%') | ||
| 71 | - .aspectRatio(1) | ||
| 72 | - .fill($r('app.color.color_transparent')) | ||
| 73 | - ForEach(this.appStyleImages.slice(2, 4), (item: appStyleImagesDTO, index: number) => { | ||
| 74 | - Image(item.fullUrl) | ||
| 75 | - .width('32%') | ||
| 76 | - .aspectRatio(1) | ||
| 77 | - .margin({ right: (index + 1) % 3 === 0 ? 0 : 2, bottom: 2 }) | ||
| 78 | - }) | ||
| 79 | - } | 65 | + radius.topRight = index === 1 ? $r('app.float.image_border_radius') : 0 |
| 66 | + radius.bottomLeft = index === 2 ? $r('app.float.image_border_radius') : 0 | ||
| 67 | + radius.bottomRight = index === 3 ? $r('app.float.image_border_radius') : 0 | ||
| 68 | + } else { | ||
| 69 | + radius.topRight = index === 2 ? $r('app.float.image_border_radius') : 0 | ||
| 70 | + radius.bottomLeft = index === 6 ? $r('app.float.image_border_radius') : 0 | ||
| 71 | + radius.bottomRight = index === 8 ? $r('app.float.image_border_radius') : 0 | ||
| 80 | } | 72 | } |
| 73 | + return radius | ||
| 74 | + } | ||
| 81 | 75 | ||
| 76 | + build() { | ||
| 77 | + GridRow({ | ||
| 78 | + gutter: { x: 2, y: 2 } | ||
| 79 | + }) { | ||
| 80 | + ForEach(this.appStyleImages, (item: appStyleImagesDTO, index: number) => { | ||
| 81 | + if (this.appStyleImages.length === 1) { | ||
| 82 | + GridCol({ | ||
| 83 | + span: { xs: 8 } | ||
| 84 | + }) { | ||
| 85 | + Image(item.fullUrl) | ||
| 86 | + .width('100%') | ||
| 87 | + .borderRadius(this.caclImageRadius(index)) | ||
| 88 | + } | ||
| 89 | + } else if (this.appStyleImages.length === 4) { | ||
| 90 | + GridCol({ | ||
| 91 | + span: { xs: 5 } | ||
| 92 | + }) { | ||
| 93 | + Image(item.fullUrl) | ||
| 94 | + .aspectRatio(1) | ||
| 95 | + .borderRadius(this.caclImageRadius(index)) | ||
| 96 | + } | ||
| 97 | + } else { | ||
| 98 | + GridCol({ | ||
| 99 | + span: { sm: 4, lg: 3 } | ||
| 100 | + }) { | ||
| 101 | + Image(item.fullUrl) | ||
| 102 | + .aspectRatio(1) | ||
| 103 | + .borderRadius(this.caclImageRadius(index)) | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + }) | ||
| 107 | + } | ||
| 82 | } | 108 | } |
| 83 | } | 109 | } |
| 84 | 110 |
| @@ -17,12 +17,12 @@ interface RmhInfo extends RmhInfoDTO { | @@ -17,12 +17,12 @@ interface RmhInfo extends RmhInfoDTO { | ||
| 17 | @Component | 17 | @Component |
| 18 | export struct rmhTitle { | 18 | export struct rmhTitle { |
| 19 | // TODO 这里需要传入rmh信息及是否显示关注,是否已关注 | 19 | // TODO 这里需要传入rmh信息及是否显示关注,是否已关注 |
| 20 | - @State isAttentionShow: Boolean = false | 20 | + @State isAttentionShow: Boolean = true |
| 21 | @State rmhInfo: RmhInfo = { | 21 | @State rmhInfo: RmhInfo = { |
| 22 | authIcon: "https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png", | 22 | authIcon: "https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png", |
| 23 | authTitle: "四川农业大学", | 23 | authTitle: "四川农业大学", |
| 24 | headPhotoUrl: "https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20221208/a_785146000057561088.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg", | 24 | headPhotoUrl: "https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20221208/a_785146000057561088.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg", |
| 25 | - introduction: "四川农业四川", | 25 | + introduction: "四川农业大学", |
| 26 | userId: "554708665557894", | 26 | userId: "554708665557894", |
| 27 | userName: "四川农业大学", | 27 | userName: "四川农业大学", |
| 28 | userType: "2", | 28 | userType: "2", |
-
Please register or login to post a comment