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
wangliang_wd
2024-08-09 14:47:57 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f4d6200d23ae64039638ff73de9ed930ac47e19f
f4d6200d
1 parent
9693dc42
feat:增加搜索撰稿人,简介标识,优化搜索闪退问题
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
3 deletions
sight_harmony/features/wdBean/src/main/ets/bean/content/ContentDTO.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/CardSourceInfo.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/ContentDTO.ets
View file @
f4d6200
...
...
@@ -142,6 +142,8 @@ export class ContentDTO implements BaseDTO {
// 是否国殇
isMourning?: boolean = false;
author: string = ""; ///撰稿人
static clone(old: ContentDTO): ContentDTO {
let content = new ContentDTO();
content.liveType = old.liveType;
...
...
sight_harmony/features/wdComponent/src/main/ets/components/cardCommon/CardSourceInfo.ets
View file @
f4d6200
...
...
@@ -2,6 +2,7 @@ import { CompDTO, ContentDTO } from 'wdBean'
import { CommonConstants } from 'wdConstant/Index';
import { DateTimeUtils, Logger } from 'wdKit/Index';
import router from '@ohos.router'
import { SearchShowRed, textItem, titleInitRes } from '../../utils/searchShowRed';
@Reusable
@Component
...
...
@@ -16,13 +17,27 @@ export struct CardSourceInfo {
@State private isEllipsisActive: boolean = false;
@State private displayText: string = '';
@State authorMarked: boolean = false;
@State authorArr: textItem[] = []
aboutToAppear(): void {
this.processText();
this.titleInit();
}
titleInit() {
if (this.contentDTO?.author&&this.contentDTO?.author.length > 0) {
const titleInitRes:titleInitRes = SearchShowRed.titleInit(this.contentDTO.author);
this.authorMarked = titleInitRes.titleMarked;
this.authorArr = titleInitRes.textArr;
}
}
processText() {
const sourceText = this.contentDTO.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO.source;
if (sourceText.length > this.maxLength) {
const sourceText = this.contentDTO?.rmhPlatform === 1 ? this.contentDTO.rmhInfo?.rmhName : this.contentDTO?.source;
if (sourceText && (sourceText.length > this.maxLength)) {
this.displayText = sourceText.substring(0, this.maxLength) + '...';
this.isEllipsisActive = true;
} else {
...
...
@@ -114,6 +129,7 @@ export struct CardSourceInfo {
}
build() {
Column(){
Flex({ justifyContent: FlexAlign.Start, direction: FlexDirection.Row }) {
// 标签
if (this.contentDTO.cornerMark || this.contentDTO.corner) {
...
...
@@ -185,7 +201,32 @@ export struct CardSourceInfo {
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: this.viewShowData ? 8 : 0 })
if (this.contentDTO?.author&&this.contentDTO?.author.length > 0){
Text() {
if (this.authorMarked) {
ForEach(this.authorArr, (textItem: textItem) => {
if (textItem.isRed) {
Span(textItem.content)
.fontColor(0xED2800)
} else {
Span(textItem.content)
}
})
} else {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_11'))
.fontColor($r("app.color.color_B0B0B0"))
.align(Alignment.Start)
.width('100%')
.margin({top:5})
}
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: this.viewShowData ? 8 : 0 })
}
/**
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
f4d6200
...
...
@@ -547,6 +547,7 @@ export struct SearchResultContentComponent {
contentDTO.rmhInfo = rmhInfo
contentDTO.shareFlag = value.data.shareFlag
contentDTO.contentText = value.data.contentText
contentDTO.author = value.data.author
return contentDTO;
}
...
...
Please
register
or
login
to post a comment