Showing
3 changed files
with
43 additions
and
22 deletions
| @@ -174,6 +174,7 @@ export struct CardMediaInfo { | @@ -174,6 +174,7 @@ export struct CardMediaInfo { | ||
| 174 | .mediaLogo() | 174 | .mediaLogo() |
| 175 | Text(`${this.contentDTO.photoNum}`) | 175 | Text(`${this.contentDTO.photoNum}`) |
| 176 | .mediaTextImgtype() | 176 | .mediaTextImgtype() |
| 177 | + .fontFamily('BebasNeue') | ||
| 177 | } | 178 | } |
| 178 | .margin({ left: 80,top: 55}) | 179 | .margin({ left: 80,top: 55}) |
| 179 | 180 |
| @@ -36,18 +36,7 @@ export struct Card2Component { | @@ -36,18 +36,7 @@ export struct Card2Component { | ||
| 36 | this.titleInit(); | 36 | this.titleInit(); |
| 37 | this.loadImg = await onlyWifiLoadImg(); | 37 | this.loadImg = await onlyWifiLoadImg(); |
| 38 | } | 38 | } |
| 39 | - calculateTextIndent() { | ||
| 40 | - if (this.contentDTO?.newTags?.length < 5 && this.contentDTO?.newTags?.length > 2) { | ||
| 41 | - return 58; | ||
| 42 | - } else if ((this.contentDTO.newTags?.length !== 0) || (this.contentDTO.seoTags?.length !== 0)) { | ||
| 43 | - // 当newTags或seoTags存在时,应用相同的缩进 | ||
| 44 | - return 35; | ||
| 45 | - } else if (this.contentDTO.objectType == '5') { | ||
| 46 | - return 35; | ||
| 47 | - } else { | ||
| 48 | - return 0; | ||
| 49 | - } | ||
| 50 | - } | 39 | + |
| 51 | titleInit() { | 40 | titleInit() { |
| 52 | if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { | 41 | if (this.contentDTO.title?.includes('<em>') && this.contentDTO.title?.includes('</em>')) { |
| 53 | this.titleMarked = true; | 42 | this.titleMarked = true; |
| @@ -63,13 +52,27 @@ export struct Card2Component { | @@ -63,13 +52,27 @@ export struct Card2Component { | ||
| 63 | Stack() { | 52 | Stack() { |
| 64 | if(this.contentDTO.objectType == '5'){ | 53 | if(this.contentDTO.objectType == '5'){ |
| 65 | Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center) | 54 | Notes({ objectType: this.contentDTO.objectType }).height(30).align(Alignment.Center) |
| 66 | - } else { | ||
| 67 | - if (this.contentDTO.seoTags) { | ||
| 68 | - Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center) | ||
| 69 | - } else if (this.contentDTO.newTags) { | 55 | + }else if(this.contentDTO.objectType == '2'){ |
| 56 | + if(this.contentDTO.seoTags){ | ||
| 57 | + Notes({ newTags: this.contentDTO.seoTags }).height(30).align(Alignment.Center) | ||
| 58 | + }else if(this.contentDTO.newTags){ | ||
| 59 | + Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center) | ||
| 60 | + | ||
| 61 | + } | ||
| 62 | + }else { | ||
| 63 | + if(this.contentDTO.newTags){ | ||
| 70 | Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center) | 64 | Notes({ newTags: this.contentDTO.newTags }).height(30).align(Alignment.Center) |
| 71 | } | 65 | } |
| 72 | } | 66 | } |
| 67 | + //新闻标题 | ||
| 68 | + // if (this.contentDTO.newTags) { | ||
| 69 | + // | ||
| 70 | + // //Notes({ newTags: this.contentDTO.newTags }) | ||
| 71 | + // } else if (this.contentDTO.objectType == '5') { | ||
| 72 | + // | ||
| 73 | + // //Notes({ objectType: this.contentDTO.objectType }) | ||
| 74 | + // } | ||
| 75 | + | ||
| 73 | Text() { | 76 | Text() { |
| 74 | if (this.titleMarked) { | 77 | if (this.titleMarked) { |
| 75 | Span(this.str01) | 78 | Span(this.str01) |
| @@ -86,7 +89,9 @@ export struct Card2Component { | @@ -86,7 +89,9 @@ export struct Card2Component { | ||
| 86 | .lineHeight(27) | 89 | .lineHeight(27) |
| 87 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 90 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 88 | .align(Alignment.Start) | 91 | .align(Alignment.Start) |
| 89 | - .textIndent(this.calculateTextIndent()) | 92 | + .textIndent( (this.contentDTO.objectType === '2' && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 2 && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) < 5) ? 58 : |
| 93 | + (this.contentDTO.objectType === '2' && (this.contentDTO.newTags?.length || this.contentDTO.seoTags?.length) > 0 || this.contentDTO.objectType === '5') ? 35 : | ||
| 94 | + 0 ) | ||
| 90 | }.alignContent(Alignment.TopStart) | 95 | }.alignContent(Alignment.TopStart) |
| 91 | 96 | ||
| 92 | //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | 97 | //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0) |
| @@ -22,7 +22,7 @@ interface ILikeStyleResp { | @@ -22,7 +22,7 @@ interface ILikeStyleResp { | ||
| 22 | export struct LikeComponent { | 22 | export struct LikeComponent { |
| 23 | @Consume contentDetailData: ContentDetailDTO | 23 | @Consume contentDetailData: ContentDetailDTO |
| 24 | @Prop pageComponentType: number | 24 | @Prop pageComponentType: number |
| 25 | - @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | 25 | + @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 |
| 26 | @State likeStatus: boolean = false | 26 | @State likeStatus: boolean = false |
| 27 | viewModel: LikeViewModel = new LikeViewModel() | 27 | viewModel: LikeViewModel = new LikeViewModel() |
| 28 | @Prop @Watch('onDataUpdated') data: Record<string, string> | 28 | @Prop @Watch('onDataUpdated') data: Record<string, string> |
| @@ -41,6 +41,14 @@ export struct LikeComponent { | @@ -41,6 +41,14 @@ export struct LikeComponent { | ||
| 41 | // this.data['status'] = "1" | 41 | // this.data['status'] = "1" |
| 42 | 42 | ||
| 43 | aboutToAppear() { | 43 | aboutToAppear() { |
| 44 | + // 2:竖屏直播页 3:图集 4:横屏直播页 | ||
| 45 | + if(this.pageComponentType == 2 || this.pageComponentType == 4) { | ||
| 46 | + // 点赞样式 love爱心型 thumb点赞手势 mourning 蜡烛(默哀) pray 祈福 | ||
| 47 | + this.likesStyle = this.contentDetailData?.liveInfo?.likesStyle | ||
| 48 | + } else { | ||
| 49 | + // 内容用 点赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 | ||
| 50 | + this.likesStyle = this.contentDetailData.likesStyle | ||
| 51 | + } | ||
| 44 | this.onDataUpdated() | 52 | this.onDataUpdated() |
| 45 | } | 53 | } |
| 46 | 54 | ||
| @@ -80,7 +88,7 @@ export struct LikeComponent { | @@ -80,7 +88,7 @@ export struct LikeComponent { | ||
| 80 | * 将点赞样式转换为icon | 88 | * 将点赞样式转换为icon |
| 81 | */ | 89 | */ |
| 82 | transLikeStyle(): ILikeStyleResp { | 90 | transLikeStyle(): ILikeStyleResp { |
| 83 | - if (this.likesStyle === 1) { | 91 | + if (this.likesStyle === 1 || this.likesStyle === 'love' || this.likesStyle === 'thumb') { |
| 84 | return { | 92 | return { |
| 85 | url: this.likeStatus ? $r(`app.media.ic_like_check`) : | 93 | url: this.likeStatus ? $r(`app.media.ic_like_check`) : |
| 86 | this.styleType == 1 ? | 94 | this.styleType == 1 ? |
| @@ -88,12 +96,12 @@ export struct LikeComponent { | @@ -88,12 +96,12 @@ export struct LikeComponent { | ||
| 88 | $r(`app.media.ic_like_uncheck`), | 96 | $r(`app.media.ic_like_uncheck`), |
| 89 | name: '赞' | 97 | name: '赞' |
| 90 | } | 98 | } |
| 91 | - } else if (this.likesStyle === 2) { | 99 | + } else if (this.likesStyle === 2 || this.likesStyle === 'pray') { |
| 92 | return { | 100 | return { |
| 93 | url: this.likeStatus ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`), | 101 | url: this.likeStatus ? $r(`app.media.ic_thub_check`) : $r(`app.media.ic_thub_uncheck`), |
| 94 | name: '祈祷' | 102 | name: '祈祷' |
| 95 | } | 103 | } |
| 96 | - } else if (this.likesStyle === 3) { | 104 | + } else if (this.likesStyle === 3 || this.likesStyle === 'mourning') { |
| 97 | return { | 105 | return { |
| 98 | url: this.likeStatus ? $r(`app.media.ic_candle_check`) : | 106 | url: this.likeStatus ? $r(`app.media.ic_candle_check`) : |
| 99 | $r(`app.media.ic_candle_uncheck`), | 107 | $r(`app.media.ic_candle_uncheck`), |
| @@ -143,6 +151,7 @@ export struct LikeComponent { | @@ -143,6 +151,7 @@ export struct LikeComponent { | ||
| 143 | } | 151 | } |
| 144 | .width(154) | 152 | .width(154) |
| 145 | .height(40) | 153 | .height(40) |
| 154 | + .visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible) | ||
| 146 | } | 155 | } |
| 147 | 156 | ||
| 148 | @Builder | 157 | @Builder |
| @@ -160,6 +169,7 @@ export struct LikeComponent { | @@ -160,6 +169,7 @@ export struct LikeComponent { | ||
| 160 | .onClick(() => { | 169 | .onClick(() => { |
| 161 | this.clickButtonEvent() | 170 | this.clickButtonEvent() |
| 162 | }) | 171 | }) |
| 172 | + .visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible) | ||
| 163 | } | 173 | } |
| 164 | 174 | ||
| 165 | @Builder | 175 | @Builder |
| @@ -173,7 +183,10 @@ export struct LikeComponent { | @@ -173,7 +183,10 @@ export struct LikeComponent { | ||
| 173 | .onClick(() => { | 183 | .onClick(() => { |
| 174 | this.clickButtonEvent() | 184 | this.clickButtonEvent() |
| 175 | }) | 185 | }) |
| 176 | - }.width(24).height(24) | 186 | + } |
| 187 | + .width(24) | ||
| 188 | + .height(24) | ||
| 189 | + .visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible) | ||
| 177 | } | 190 | } |
| 178 | 191 | ||
| 179 | @Builder | 192 | @Builder |
| @@ -248,6 +261,7 @@ export struct LikeComponent { | @@ -248,6 +261,7 @@ export struct LikeComponent { | ||
| 248 | }.width(24).height(24).onClick(() => { | 261 | }.width(24).height(24).onClick(() => { |
| 249 | this.clickButtonEvent() | 262 | this.clickButtonEvent() |
| 250 | }) | 263 | }) |
| 264 | + .visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible) | ||
| 251 | } | 265 | } |
| 252 | 266 | ||
| 253 | @Builder | 267 | @Builder |
| @@ -284,6 +298,7 @@ export struct LikeComponent { | @@ -284,6 +298,7 @@ export struct LikeComponent { | ||
| 284 | } | 298 | } |
| 285 | .width(36) | 299 | .width(36) |
| 286 | .height(42) | 300 | .height(42) |
| 301 | + .visibility(this.likesStyle == 4 || this.likesStyle == 'empty' ? Visibility.None : Visibility.Visible) | ||
| 287 | 302 | ||
| 288 | } | 303 | } |
| 289 | 304 |
-
Please register or login to post a comment