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-09-19 14:35:09 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
6f51d7f426dbbb9e517a6ce566adec44d28cadc3
6f51d7f4
2 parents
cc896b83
adc8c00e
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
33 deletions
sight_harmony/features/wdComponent/src/main/ets/components/cardview/LiveBigImage02Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02NewsContent.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageTopComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchCreatorComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/LiveBigImage02Component.ets
View file @
6f51d7f
...
...
@@ -2,7 +2,7 @@ import { CompDTO, ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
import { hasClicked, persistentStorage } from '../../utils/persistentStorage';
import { DateTimeUtils } from 'wdKit/Index';
import { DateTimeUtils
, NumberFormatterUtils
} from 'wdKit/Index';
import { LottieView } from '../lottie/LottieView';
import { router } from '@kit.ArkUI';
...
...
@@ -155,13 +155,6 @@ export struct LiveBigImage02Component {
}
private computeShowNum(count: number): string {
if (count >= 10000) {
let num = (count / 10000).toFixed(1)
if (Number(num.substring(num.length - 1)) == 0) {
num = num.substring(0, num.length - 2)
}
return num + '万人参加'
}
return `${count}人参加`
return NumberFormatterUtils.formatNumberWithWan(count) + '人参加'
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02NewsContent.ets
View file @
6f51d7f
import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { Logger } from 'wdKit/Index';
import { Logger
, NumberFormatterUtils
} from 'wdKit/Index';
import { ProcessUtils } from 'wdRouter';
import PageViewModel from '../../viewmodel/PageViewModel';
import { onlyWifiLoadImg } from '../../utils/lazyloadImg';
...
...
@@ -98,15 +98,7 @@ export struct ZhGridLayout02NewsContent {
}
private computeShowNum(bean: LiveRoomDataBean): string {
let count = bean.pv
if (count >= 10000) {
let num = (count / 10000).toFixed(1)
if (Number(num.substring(num.length - 1)) == 0) {
num = num.substring(0, num.length - 2)
}
return num + '万人参加'
}
return `${count}人参加`
return NumberFormatterUtils.formatNumberWithWan(bean.pv) + '人参加'
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
View file @
6f51d7f
...
...
@@ -4,6 +4,7 @@ import { HttpUtils } from 'wdNetwork/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import { TrackConstants, TrackingContent } from 'wdTracking/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { SearchShowRed, titleInitRes, textItem } from '../../../utils/searchShowRed'
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'
...
...
@@ -14,6 +15,7 @@ export struct FollowChildComponent{
@State columnHeight:number = 202
@State isLoadingAttention:boolean = false
@State searchText:string = ""
aboutToAppear(): void {
if(this.type == 0 && StringUtils.isEmpty(this.data.introduction)){
...
...
@@ -190,7 +192,20 @@ export struct FollowChildComponent{
.margin({right: 11})
Column(){
Text(this.data.cnUserName)
Text(){
if (StringUtils.isNotEmpty(this.searchText) && this.titleInit(this.data.cnUserName, this.searchText).titleMarked) {
ForEach(this.titleInit(this.data.cnUserName, this.searchText).textArr, (textItem: textItem) => {
if (textItem.isRed) {
Span(textItem.content)
.fontColor("#ED2800")
} else {
Span(textItem.content)
}
})
} else {
Span(this.data.cnUserName)
}
}
.fontWeight(400)
.fontSize(18)
.lineHeight(22)
...
...
@@ -351,4 +366,21 @@ export struct FollowChildComponent{
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
}
// 正则过滤检索词
createCaseInsensitiveRegex(str: string, pattern: string) {
let regex = new RegExp(pattern, 'gi');
return str.replace(regex, (match) => `<em>${match}</em>`);
}
checkForPattern(str: string, pattern: string) {
let highlightedStr = this.createCaseInsensitiveRegex(str, pattern);
return highlightedStr;
}
titleInit(str: string, pattern: string) {
const title = this.checkForPattern(str, pattern)
const titleInitRes:titleInitRes = SearchShowRed.titleInit(title)
return titleInitRes
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShipHomePage/PeopleShipHomePageTopComponent.ets
View file @
6f51d7f
import measure from '@ohos.measure'
import { DisplayUtils } from 'wdKit'
import { DisplayUtils
, NumberFormatterUtils
} from 'wdKit'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent'
import { Logger } from 'wdKit'
...
...
@@ -366,14 +366,7 @@ export struct PeopleShipHomePageTopComponent {
}
private computeShowNum(count: number) {
if (count >= 10000) {
let num = ( count / 10000).toFixed(1)
if (Number(num.substring(num.length-1)) == 0) {
num = num.substring(0, num.length-2)
}
return num + '万'
}
return `${count}`
return NumberFormatterUtils.formatNumberWithWan(count)
}
// 通过省份code获取IP问题
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchCreatorComponent.ets
View file @
6f51d7f
import { ToastUtils } from 'wdKit/Index'
import {
StringUtils,
ToastUtils } from 'wdKit/Index'
import { WDRouterRule, WDRouterPage, ProcessUtils } from 'wdRouter/Index'
import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed'
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
@Component
export struct SearchCreatorComponent{
@ObjectLink item: SearchRmhDescription
userName: string = ''
@State searchText:string = ""
aboutToAppear(): void {
const userNetName: string = this.item.creatorName;
...
...
@@ -38,7 +40,20 @@ export struct SearchCreatorComponent{
.height('92lpx')
.margin({bottom:'15lpx'})
Text(this.userName)
Text(){
if (StringUtils.isNotEmpty(this.searchText) && this.titleInit(this.userName, this.searchText).titleMarked) {
ForEach(this.titleInit(this.userName, this.searchText).textArr, (textItem: textItem) => {
if (textItem.isRed) {
Span(textItem.content)
.fontColor("#ED2800")
} else {
Span(textItem.content)
}
})
} else {
Span(this.userName)
}
}
.fontSize('25lpx')
.fontWeight('400lpx')
.lineHeight('35lpx')
...
...
@@ -62,4 +77,21 @@ export struct SearchCreatorComponent{
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
}
// 正则过滤检索词
createCaseInsensitiveRegex(str: string, pattern: string) {
let regex = new RegExp(pattern, 'gi');
return str.replace(regex, (match) => `<em>${match}</em>`);
}
checkForPattern(str: string, pattern: string) {
let highlightedStr = this.createCaseInsensitiveRegex(str, pattern);
return highlightedStr;
}
titleInit(str: string, pattern: string) {
const title = this.checkForPattern(str, pattern)
const titleInitRes:titleInitRes = SearchShowRed.titleInit(title)
return titleInitRes
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
6f51d7f
...
...
@@ -282,7 +282,7 @@ export struct SearchResultContentComponent {
if (this.data_rmh != null && this.data_rmh.length > 0) {
if (this.data_rmh.length === 1) {
ListItem() {
FollowChildComponent({ data: this.bean, type: 1 })
FollowChildComponent({ data: this.bean, type: 1
,searchText: decodeURI(this.keywords)
})
}.padding({ left: "31lpx", right: "31lpx" })
} else {
ListItem() {
...
...
@@ -356,7 +356,7 @@ export struct SearchResultContentComponent {
ListItemGroup() {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({ item: item })
SearchCreatorComponent({ item: item
,searchText: decodeURI(this.keywords)
})
}
.width('150lpx')
.height('100%')
...
...
Please
register
or
login
to post a comment