Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
陈剑华
2024-05-15 15:19:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
99a750ee5bbfe21181ac4b1c2a755ae539508c2c
99a750ee
1 parent
bd1d6e2b
fix: 17150 功能缺陷-搜索结果页-命中内容未露出展示
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
137 additions
and
2 deletions
sight_harmony/features/wdBean/src/main/ets/bean/content/ContentDTO.ets
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card2Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card4Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/SearchContentComponent.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/ContentDTO.ets
View file @
99a750e
...
...
@@ -61,6 +61,7 @@ export class ContentDTO implements BaseDTO {
videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的
newsSummary: string = ''; //appstyle:2 ,新闻详情
contentText?: string ='';
// 二次请求接口,返回的数据,这里组装到content里;
interactData?: InteractDataDTO;
...
...
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
View file @
99a750e
...
...
@@ -16,6 +16,7 @@ import { Card17Component } from './cardview/Card17Component';
import { Card19Component } from './cardview/Card19Component';
import { Card20Component } from './cardview/Card20Component';
import { Card21Component } from './cardview/Card21Component';
import { SearchContentComponent } from './cardview/SearchContentComponent';
/**
* card适配器,卡片样式汇总,依据ContentDTO#appStyle
...
...
@@ -32,6 +33,9 @@ export struct CardParser {
@Builder
contentBuilder(contentDTO: ContentDTO, compDTO: CompDTO) {
if (!!contentDTO.contentText) {
SearchContentComponent({ contentDTO })
} else {
if (contentDTO.appStyle === CompStyle.Card_02) {
Card2Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_03) {
...
...
@@ -73,4 +77,6 @@ export struct CardParser {
// .backgroundColor(Color.Brown) // 展示本页未实现的compStyle
}
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card2Component.ets
View file @
99a750e
...
...
@@ -22,10 +22,24 @@ export struct Card2Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
// this.clicked = hasClicked(this.contentDTO.objectId)
this.titleInit();
}
titleInit() {
if (this.contentDTO.title.includes('<em>') && this.contentDTO.title.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.newsTitle?.split('<em>')[0] || '';
this.str02 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
...
...
@@ -36,7 +50,17 @@ export struct Card2Component {
if (this.contentDTO.objectType == '5') {
Notes({ objectType: this.contentDTO.objectType })
}
Text(this.contentDTO.newsTitle)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(2)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card4Component.ets
View file @
99a750e
...
...
@@ -18,10 +18,24 @@ export struct Card4Component {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State titleMarked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.titleInit();
}
titleInit() {
if (this.contentDTO.title.includes('<em>') && this.contentDTO.title.includes('</em>')) {
this.titleMarked = true;
this.str01 = this.contentDTO.newsTitle?.split('<em>')[0] || '';
this.str02 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.newsTitle?.split('<em>')[1].split('</em>')[1] || '';
}
}
build() {
...
...
@@ -29,7 +43,16 @@ export struct Card4Component {
//body
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
Text() {
if (this.titleMarked) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardview/SearchContentComponent.ets
0 → 100644
View file @
99a750e
import { ContentDTO, FullColumnImgUrlDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from 'wdRouter';
import { CardSourceInfo } from '../cardCommon/CardSourceInfo'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
const TAG: string = 'Card4Component';
/**
* 上图下文,用于搜索页命中搜索内容展示
*/
@Component
export struct SearchContentComponent {
@State contentDTO: ContentDTO = new ContentDTO();
@State loadImg: boolean = false;
@State clicked: boolean = false;
@State str01: string = '';
@State str02: string = '';
@State str03: string = '';
async aboutToAppear(): Promise<void> {
this.loadImg = await onlyWifiLoadImg();
this.titleInit();
}
titleInit() {
this.str01 = this.contentDTO.contentText?.split('<em>')[0] || '';
this.str02 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[0] || '';
this.str03 = this.contentDTO.contentText?.split('<em>')[1].split('</em>')[1] || '';
}
build() {
Column() {
//body
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
// 命中内容
Text(this.contentDTO.contentText) {
Span(this.str01)
Span(this.str02)
.fontColor(0xED2800)
Span(this.str03)
}
.fontSize(13)
.width(CommonConstants.FULL_PARENT)
.margin({ top: 8 })
.fontColor(0x222222)
}
.width('100%')
.justifyContent(FlexAlign.Start)
.alignItems(HorizontalAlign.Start)
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
})
//bottom 评论等信息
CardSourceInfo({ contentDTO: this.contentDTO })
}
.width(CommonConstants.FULL_WIDTH)
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
}
}
@Extend(Text)
function bottomTextStyle() {
.fontSize(12)
.fontColor('#B0B0B0')
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment