fix: 组件用的是comp上的coverUrl
稿件用的是programInfo上的ullColumnImgUrls里的url
appstyle有值的是稿件
compstyle有值是组件
Showing
9 changed files
with
41 additions
and
14 deletions
| @@ -111,7 +111,7 @@ export struct Card10Component { | @@ -111,7 +111,7 @@ export struct Card10Component { | ||
| 111 | } | 111 | } |
| 112 | // 大图 | 112 | // 大图 |
| 113 | Stack() { | 113 | Stack() { |
| 114 | - Image(this.loadImg ? this.contentDTO?.coverUrl : '') | 114 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 115 | .backgroundColor(0xf5f5f5) | 115 | .backgroundColor(0xf5f5f5) |
| 116 | .width('100%') | 116 | .width('100%') |
| 117 | .borderRadius({ | 117 | .borderRadius({ |
| @@ -80,7 +80,7 @@ export struct Card14Component { | @@ -80,7 +80,7 @@ export struct Card14Component { | ||
| 80 | .margin({right: 12}) | 80 | .margin({right: 12}) |
| 81 | .width('64%') | 81 | .width('64%') |
| 82 | 82 | ||
| 83 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 83 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 84 | .backgroundColor(0xf5f5f5) | 84 | .backgroundColor(0xf5f5f5) |
| 85 | .aspectRatio(3 / 2) | 85 | .aspectRatio(3 / 2) |
| 86 | .height(78) | 86 | .height(78) |
| @@ -80,7 +80,7 @@ export struct Card15Component { | @@ -80,7 +80,7 @@ export struct Card15Component { | ||
| 80 | } | 80 | } |
| 81 | //大图 | 81 | //大图 |
| 82 | Stack() { | 82 | Stack() { |
| 83 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 83 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 84 | .backgroundColor(0xf5f5f5) | 84 | .backgroundColor(0xf5f5f5) |
| 85 | .borderRadius($r('app.float.image_border_radius')) | 85 | .borderRadius($r('app.float.image_border_radius')) |
| 86 | //播放状态+时长 | 86 | //播放状态+时长 |
| @@ -197,14 +197,14 @@ struct createImg { | @@ -197,14 +197,14 @@ struct createImg { | ||
| 197 | alignContent: Alignment.BottomEnd | 197 | alignContent: Alignment.BottomEnd |
| 198 | }) { | 198 | }) { |
| 199 | if (this.getPicType(item.weight, item.height) === 1) { | 199 | if (this.getPicType(item.weight, item.height) === 1) { |
| 200 | - Image(this.loadImg ? item.fullUrl || item.url : '') | 200 | + Image(this.loadImg ? item.url || item.fullUrl : '') |
| 201 | .backgroundColor(0xf5f5f5) | 201 | .backgroundColor(0xf5f5f5) |
| 202 | .width('100%') | 202 | .width('100%') |
| 203 | .height(198) | 203 | .height(198) |
| 204 | .autoResize(true) | 204 | .autoResize(true) |
| 205 | .borderRadius(this.caclImageRadius(index)) | 205 | .borderRadius(this.caclImageRadius(index)) |
| 206 | } else if (this.getPicType(item.weight, item.height) === 2) { | 206 | } else if (this.getPicType(item.weight, item.height) === 2) { |
| 207 | - Image(this.loadImg ? item.fullUrl || item.url : '') | 207 | + Image(this.loadImg ? item.url || item.fullUrl : '') |
| 208 | .width('100%') | 208 | .width('100%') |
| 209 | .height(305) | 209 | .height(305) |
| 210 | .autoResize(true) | 210 | .autoResize(true) |
| @@ -153,7 +153,7 @@ struct createImg { | @@ -153,7 +153,7 @@ struct createImg { | ||
| 153 | span: { xs: 12 } | 153 | span: { xs: 12 } |
| 154 | }) { | 154 | }) { |
| 155 | Stack() { | 155 | Stack() { |
| 156 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 156 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 157 | .backgroundColor(0xf5f5f5) | 157 | .backgroundColor(0xf5f5f5) |
| 158 | .width(CommonConstants.FULL_WIDTH) | 158 | .width(CommonConstants.FULL_WIDTH) |
| 159 | .aspectRatio(16 / 9) | 159 | .aspectRatio(16 / 9) |
| @@ -176,7 +176,7 @@ struct createImg { | @@ -176,7 +176,7 @@ struct createImg { | ||
| 176 | span: { xs: 6 } | 176 | span: { xs: 6 } |
| 177 | }) { | 177 | }) { |
| 178 | Stack() { | 178 | Stack() { |
| 179 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 179 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 180 | .backgroundColor(0xf5f5f5) | 180 | .backgroundColor(0xf5f5f5) |
| 181 | .width(CommonConstants.FULL_WIDTH) | 181 | .width(CommonConstants.FULL_WIDTH) |
| 182 | .borderRadius($r('app.float.image_border_radius')) | 182 | .borderRadius($r('app.float.image_border_radius')) |
| @@ -79,7 +79,7 @@ export struct Card21Component { | @@ -79,7 +79,7 @@ export struct Card21Component { | ||
| 79 | 79 | ||
| 80 | GridItem() { | 80 | GridItem() { |
| 81 | Stack() { | 81 | Stack() { |
| 82 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 82 | + Image(this.loadImg ? this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') |
| 83 | .backgroundColor(0xf5f5f5) | 83 | .backgroundColor(0xf5f5f5) |
| 84 | .width(CommonConstants.FULL_WIDTH) | 84 | .width(CommonConstants.FULL_WIDTH) |
| 85 | .borderRadius($r('app.float.image_border_radius')) | 85 | .borderRadius($r('app.float.image_border_radius')) |
| 1 | //全标题 "appStyle":"2", | 1 | //全标题 "appStyle":"2", |
| 2 | import { CompDTO, ContentDTO } from 'wdBean'; | 2 | import { CompDTO, ContentDTO } from 'wdBean'; |
| 3 | -import { CommonConstants } from 'wdConstant/Index'; | 3 | +import { CommonConstants, CompStyle } from 'wdConstant/Index'; |
| 4 | import { ProcessUtils } from 'wdRouter'; | 4 | import { ProcessUtils } from 'wdRouter'; |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo'; |
| 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; | 6 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo'; |
| @@ -44,6 +44,14 @@ export struct Card2Component { | @@ -44,6 +44,14 @@ export struct Card2Component { | ||
| 44 | this.textArr = titleInitRes.textArr; | 44 | this.textArr = titleInitRes.textArr; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | + getCover() { | ||
| 48 | + if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) { | ||
| 49 | + return this.contentDTO.coverUrl | ||
| 50 | + } else if (this.contentDTO.appStyle === CompStyle.Card_02) { | ||
| 51 | + return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl | ||
| 52 | + } | ||
| 53 | + return '' | ||
| 54 | + } | ||
| 47 | 55 | ||
| 48 | build() { | 56 | build() { |
| 49 | Column() { | 57 | Column() { |
| @@ -96,7 +104,7 @@ export struct Card2Component { | @@ -96,7 +104,7 @@ export struct Card2Component { | ||
| 96 | 104 | ||
| 97 | //大图 | 105 | //大图 |
| 98 | Stack() { | 106 | Stack() { |
| 99 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 107 | + Image(this.loadImg ? this.getCover() : '') |
| 100 | .width(CommonConstants.FULL_WIDTH) | 108 | .width(CommonConstants.FULL_WIDTH) |
| 101 | .aspectRatio(16 / 9) | 109 | .aspectRatio(16 / 9) |
| 102 | .borderRadius($r('app.float.image_border_radius')) | 110 | .borderRadius($r('app.float.image_border_radius')) |
| 1 | import { ContentDTO, CompDTO } from 'wdBean'; | 1 | import { ContentDTO, CompDTO } from 'wdBean'; |
| 2 | -import { CommonConstants } from 'wdConstant'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 2 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 3 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 5 | import { Notes } from './notes'; | 4 | import { Notes } from './notes'; |
| @@ -7,7 +6,8 @@ import { getNotesContentWidth } from '../../utils/FuncUtils' | @@ -7,7 +6,8 @@ import { getNotesContentWidth } from '../../utils/FuncUtils' | ||
| 7 | import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; | 6 | import { persistentStorage, hasClicked } from '../../utils/persistentStorage'; |
| 8 | import { InfomationCardClick } from '../../utils/infomationCardClick' | 7 | import { InfomationCardClick } from '../../utils/infomationCardClick' |
| 9 | import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'; | 8 | import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'; |
| 10 | -import router from '@ohos.router' | 9 | +import router from '@ohos.router'; |
| 10 | +import { CommonConstants, CompStyle } from 'wdConstant/Index'; | ||
| 11 | 11 | ||
| 12 | 12 | ||
| 13 | const TAG: string = 'Card5Component'; | 13 | const TAG: string = 'Card5Component'; |
| @@ -42,9 +42,18 @@ export struct Card5Component { | @@ -42,9 +42,18 @@ export struct Card5Component { | ||
| 42 | this.textArr = titleInitRes.textArr; | 42 | this.textArr = titleInitRes.textArr; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | + getCover() { | ||
| 46 | + if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | ||
| 47 | + return this.contentDTO.coverUrl | ||
| 48 | + } else if (this.contentDTO.appStyle === CompStyle.Card_05) { | ||
| 49 | + return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl | ||
| 50 | + } | ||
| 51 | + return '' | ||
| 52 | + } | ||
| 53 | + | ||
| 45 | build() { | 54 | build() { |
| 46 | Stack() { | 55 | Stack() { |
| 47 | - Image(this.loadImg ? this.contentDTO.coverUrl : '') | 56 | + Image(this.loadImg ? this.getCover() : '') |
| 48 | .backgroundColor(0xf5f5f5) | 57 | .backgroundColor(0xf5f5f5) |
| 49 | .width(CommonConstants.FULL_WIDTH) | 58 | .width(CommonConstants.FULL_WIDTH) |
| 50 | .borderRadius( | 59 | .borderRadius( |
| @@ -35,12 +35,22 @@ export struct Card6Component { | @@ -35,12 +35,22 @@ export struct Card6Component { | ||
| 35 | const curRouter = router.getState().name; | 35 | const curRouter = router.getState().name; |
| 36 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) | 36 | this.clicked = hasClicked(this.contentDTO.objectId, curRouter) |
| 37 | } | 37 | } |
| 38 | + | ||
| 38 | titleInit() { | 39 | titleInit() { |
| 39 | const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title); | 40 | const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.title); |
| 40 | this.titleMarked = titleInitRes.titleMarked; | 41 | this.titleMarked = titleInitRes.titleMarked; |
| 41 | this.textArr = titleInitRes.textArr; | 42 | this.textArr = titleInitRes.textArr; |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 45 | + getCover() { | ||
| 46 | + if (this.compDTO.compStyle === CompStyle.Card_13) { | ||
| 47 | + return this.contentDTO.coverUrl | ||
| 48 | + } else if (this.contentDTO.appStyle === CompStyle.Card_06) { | ||
| 49 | + return this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl | ||
| 50 | + } | ||
| 51 | + return '' | ||
| 52 | + } | ||
| 53 | + | ||
| 44 | build() { | 54 | build() { |
| 45 | Row() { | 55 | Row() { |
| 46 | Column() { | 56 | Column() { |
| @@ -109,7 +119,7 @@ export struct Card6Component { | @@ -109,7 +119,7 @@ export struct Card6Component { | ||
| 109 | 119 | ||
| 110 | 120 | ||
| 111 | Stack({alignContent: Alignment.BottomEnd}) { | 121 | Stack({alignContent: Alignment.BottomEnd}) { |
| 112 | - Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') | 122 | + Image(this.loadImg ? this.getCover() : '') |
| 113 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) | 123 | .backgroundColor(this.loadImg ? $r('app.color.color_B0B0B0') : 0xf5f5f5) |
| 114 | .borderRadius(5) | 124 | .borderRadius(5) |
| 115 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) | 125 | .aspectRatio(this.contentDTO.appStyle === CompStyle.Card_13 ? 3 / 2 : 3 / 4) |
-
Please register or login to post a comment