王士厅
... ... @@ -92,6 +92,7 @@ export struct TopNavigationComponentNew {
channelId: navItem?.channelId + '',
autoRefresh: this.autoRefresh2Page
})
.backgroundColor(Color.White)
} else {
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
if (CompUtils.isNews(this.navItem)) {
... ... @@ -172,7 +173,8 @@ export struct TopNavigationComponentNew {
channelId: navItem?.channelId + '',
autoRefresh: this.autoRefresh2Page,
isMourning: mourningCheckFn(`${navItem.channelId}`),
});
})
.backgroundColor(CompUtils.isRMH(this.navItem)?Color.White:Color.Transparent)
}
/**
... ... @@ -259,10 +261,11 @@ export struct TopNavigationComponentNew {
@Builder
tabBar() {
// 顶部背景图
Image(this.navItem.backgroundUrl).width('100%').height('100%')
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
if (CompUtils.isNews(this.navItem)) {
// 顶部背景图
Image(this.navItem.backgroundUrl).width('100%')
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
// 顶部搜索、日报logo、早晚报
this.topBar()
... ... @@ -306,10 +309,10 @@ export struct TopNavigationComponentNew {
})
} else {
// 顶部背景图
Image(this.navItem.backgroundUrl)
.width('100%')
.height(this.backgroundImageH)
.grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
// Image(this.navItem.backgroundUrl)
// .width('100%')
// .height(this.backgroundImageH)
// .grayscale(this.GrayManage.get().isMourning() ? 1 : 0)
Row() {
Image($r('app.media.icon_search'))
... ...
... ... @@ -16,6 +16,11 @@ export struct PlayerTitleView {
@State rmhPlatform: number = 0 // 1是人民号
@State isOverLines: boolean = false
@State summary: string = ''
@State private titleLines: number = 0
@State private summaryLines: number = 0
dialogController: CustomDialogController = new CustomDialogController({
builder: DetailDialog({
name: this.getName(),
... ... @@ -104,6 +109,13 @@ export struct PlayerTitleView {
this.summary = this.getSummary()
}
private updateSummaryLines() {
this.summaryLines = Math.max(1, 4 - this.titleLines)
this.isOverLines = this.summary.length > this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)).length
}
build() {
Column() {
if (this.getName()) {
... ... @@ -133,7 +145,10 @@ export struct PlayerTitleView {
.fontFamily('PingFang SC-Regular')
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ bottom: 2 }) //8
.onAreaChange((oldArea: Area, newArea: Area) => {
this.titleLines = Math.ceil((newArea.height as number) / 20) // 20是行高
this.updateSummaryLines()
})
/**
* 标题大于三行或存在简介显示查看详情按钮
*/
... ... @@ -161,7 +176,7 @@ export struct PlayerTitleView {
// } else {
if(this.summary) {
Text() {
Span(this.clipText(this.summary, 14, 3, this.windowWidth - 150 - vp2px(50)))
Span(this.clipText(this.summary, 14, this.summaryLines, this.windowWidth - 150 - vp2px(50)))
.fontSize(14)
.fontColor(Color.White)
.lineHeight(21)
... ...