Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
2 changed files
with
28 additions
and
10 deletions
| @@ -92,6 +92,7 @@ export struct TopNavigationComponentNew { | @@ -92,6 +92,7 @@ export struct TopNavigationComponentNew { | ||
| 92 | channelId: navItem?.channelId + '', | 92 | channelId: navItem?.channelId + '', |
| 93 | autoRefresh: this.autoRefresh2Page | 93 | autoRefresh: this.autoRefresh2Page |
| 94 | }) | 94 | }) |
| 95 | + .backgroundColor(Color.White) | ||
| 95 | } else { | 96 | } else { |
| 96 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | 97 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { |
| 97 | if (CompUtils.isNews(this.navItem)) { | 98 | if (CompUtils.isNews(this.navItem)) { |
| @@ -172,7 +173,8 @@ export struct TopNavigationComponentNew { | @@ -172,7 +173,8 @@ export struct TopNavigationComponentNew { | ||
| 172 | channelId: navItem?.channelId + '', | 173 | channelId: navItem?.channelId + '', |
| 173 | autoRefresh: this.autoRefresh2Page, | 174 | autoRefresh: this.autoRefresh2Page, |
| 174 | isMourning: mourningCheckFn(`${navItem.channelId}`), | 175 | isMourning: mourningCheckFn(`${navItem.channelId}`), |
| 175 | - }); | 176 | + }) |
| 177 | + .backgroundColor(CompUtils.isRMH(this.navItem)?Color.White:Color.Transparent) | ||
| 176 | } | 178 | } |
| 177 | 179 | ||
| 178 | /** | 180 | /** |
| @@ -259,10 +261,11 @@ export struct TopNavigationComponentNew { | @@ -259,10 +261,11 @@ export struct TopNavigationComponentNew { | ||
| 259 | @Builder | 261 | @Builder |
| 260 | tabBar() { | 262 | tabBar() { |
| 261 | 263 | ||
| 264 | + // 顶部背景图 | ||
| 265 | + Image(this.navItem.backgroundUrl).width('100%').height('100%') | ||
| 266 | + .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 267 | + | ||
| 262 | if (CompUtils.isNews(this.navItem)) { | 268 | if (CompUtils.isNews(this.navItem)) { |
| 263 | - // 顶部背景图 | ||
| 264 | - Image(this.navItem.backgroundUrl).width('100%') | ||
| 265 | - .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 266 | // 顶部搜索、日报logo、早晚报 | 269 | // 顶部搜索、日报logo、早晚报 |
| 267 | this.topBar() | 270 | this.topBar() |
| 268 | 271 | ||
| @@ -306,10 +309,10 @@ export struct TopNavigationComponentNew { | @@ -306,10 +309,10 @@ export struct TopNavigationComponentNew { | ||
| 306 | }) | 309 | }) |
| 307 | } else { | 310 | } else { |
| 308 | // 顶部背景图 | 311 | // 顶部背景图 |
| 309 | - Image(this.navItem.backgroundUrl) | ||
| 310 | - .width('100%') | ||
| 311 | - .height(this.backgroundImageH) | ||
| 312 | - .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | 312 | + // Image(this.navItem.backgroundUrl) |
| 313 | + // .width('100%') | ||
| 314 | + // .height(this.backgroundImageH) | ||
| 315 | + // .grayscale(this.GrayManage.get().isMourning() ? 1 : 0) | ||
| 313 | 316 | ||
| 314 | Row() { | 317 | Row() { |
| 315 | Image($r('app.media.icon_search')) | 318 | Image($r('app.media.icon_search')) |
| @@ -16,6 +16,11 @@ export struct PlayerTitleView { | @@ -16,6 +16,11 @@ export struct PlayerTitleView { | ||
| 16 | @State rmhPlatform: number = 0 // 1是人民号 | 16 | @State rmhPlatform: number = 0 // 1是人民号 |
| 17 | @State isOverLines: boolean = false | 17 | @State isOverLines: boolean = false |
| 18 | @State summary: string = '' | 18 | @State summary: string = '' |
| 19 | + | ||
| 20 | + @State private titleLines: number = 0 | ||
| 21 | + @State private summaryLines: number = 0 | ||
| 22 | + | ||
| 23 | + | ||
| 19 | dialogController: CustomDialogController = new CustomDialogController({ | 24 | dialogController: CustomDialogController = new CustomDialogController({ |
| 20 | builder: DetailDialog({ | 25 | builder: DetailDialog({ |
| 21 | name: this.getName(), | 26 | name: this.getName(), |
| @@ -104,6 +109,13 @@ export struct PlayerTitleView { | @@ -104,6 +109,13 @@ export struct PlayerTitleView { | ||
| 104 | this.summary = this.getSummary() | 109 | this.summary = this.getSummary() |
| 105 | } | 110 | } |
| 106 | 111 | ||
| 112 | + | ||
| 113 | + private updateSummaryLines() { | ||
| 114 | + this.summaryLines = Math.max(1, 4 - this.titleLines) | ||
| 115 | + this.isOverLines = this.summary.length > this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)).length | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + | ||
| 107 | build() { | 119 | build() { |
| 108 | Column() { | 120 | Column() { |
| 109 | if (this.getName()) { | 121 | if (this.getName()) { |
| @@ -133,7 +145,10 @@ export struct PlayerTitleView { | @@ -133,7 +145,10 @@ export struct PlayerTitleView { | ||
| 133 | .fontFamily('PingFang SC-Regular') | 145 | .fontFamily('PingFang SC-Regular') |
| 134 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 146 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 135 | .margin({ bottom: 2 }) //8 | 147 | .margin({ bottom: 2 }) //8 |
| 136 | - | 148 | + .onAreaChange((oldArea: Area, newArea: Area) => { |
| 149 | + this.titleLines = Math.ceil((newArea.height as number) / 20) // 20是行高 | ||
| 150 | + this.updateSummaryLines() | ||
| 151 | + }) | ||
| 137 | /** | 152 | /** |
| 138 | * 标题大于三行或存在简介显示查看详情按钮 | 153 | * 标题大于三行或存在简介显示查看详情按钮 |
| 139 | */ | 154 | */ |
| @@ -161,7 +176,7 @@ export struct PlayerTitleView { | @@ -161,7 +176,7 @@ export struct PlayerTitleView { | ||
| 161 | // } else { | 176 | // } else { |
| 162 | if(this.summary) { | 177 | if(this.summary) { |
| 163 | Text() { | 178 | Text() { |
| 164 | - Span(this.clipText(this.summary, 14, 3, this.windowWidth - 150 - vp2px(50))) | 179 | + Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50))) |
| 165 | .fontSize(14) | 180 | .fontSize(14) |
| 166 | .fontColor(Color.White) | 181 | .fontColor(Color.White) |
| 167 | .lineHeight(21) | 182 | .lineHeight(21) |
-
Please register or login to post a comment