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
yangchenggong1_wd
2024-04-16 16:20:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ffb1f077ee5afc4559e72953d52a42636ee3f2d6
ffb1f077
1 parent
b949600d
desc:搜索结果展示
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
511 additions
and
9 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomCommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/model/SearcherAboutDataModel.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/SearchResultContentData.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/SearchResultContentItem.ets
sight_harmony/products/phone/src/main/resources/rawfile/search_result_interact_list_data.json
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
ffb1f07
...
...
@@ -662,6 +662,11 @@ export class HttpUrlUtils {
return url
}
static getInteractListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH
return url
}
// static getYcgCommonHeaders(): HashMap<string, string> {
// let headers: HashMap<string, string> = new HashMap<string, string>()
//
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/home/OtherHomePageBottomCommentComponent.ets
View file @
ffb1f07
...
...
@@ -90,6 +90,7 @@ export struct OtherHomePageBottomCommentComponent{
MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{
if (!this.data_comment || value.list.length == 0){
this.hasMore = false
this.isLoading = false
}else{
this.getCommentListStatus(value)
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
ffb1f07
import { ContentDTO, FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
import { ContentDTO,
contentListParams,
FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
import { LazyDataSource, StringUtils } from 'wdKit/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
...
...
@@ -13,6 +17,7 @@ export struct SearchResultContentComponent{
@State keywords:string = ""
@State searchType:string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
@State data_rmh: SearchRmhDescription[] = []
@State count:number = 0;
@State isLoading:boolean = false
@State hasMore:boolean = true
...
...
@@ -42,9 +47,51 @@ export struct SearchResultContentComponent{
SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
this.hasMore = false
this.isLoading = false
}else{
value.list.forEach((value)=>{
if(value.list[0].dataList!=null){
this.data_rmh = value.list[0].dataList
//TODO 查询创作者详情接口
}
this.getInteractData(value)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isLoading = false
})
}
}
getInteractData(resultData:SearchResultContentData){
if(resultData.list[0].dataList!=null){
resultData.list.splice(0,1)
}
let data : contentListParams = {
contentList: []
}
resultData.list.forEach((item)=>{
data.contentList.push({
contentId: item.data.id + '',
contentType: Number.parseInt(item.data.type)
})
})
SearcherAboutDataModel.getInteractListData(data,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
resultData.list.forEach((data)=>{
if (item.contentId == data.data.id) {
data.data.collectNum = item.collectNum+""
data.data.commentNum = item.commentNum+""
data.data.likeNum = item.likeNum+""
data.data.readNum = item.readNum+""
data.data.shareNum = item.shareNum+""
}
})
})
resultData.list.forEach((value)=>{
let photos:FullColumnImgUrlDTO[] = []
if(value.data.appStyle === 4){
value.data.appStyleImages.split("&&").forEach((value)=>{
...
...
@@ -118,30 +165,70 @@ export struct SearchResultContentComponent{
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value
.totalCount) {
if (this.data.totalCount() < resultData
.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
}
console.log(TAG,"请求失败")
this.isLoading = false
})
}
build() {
Column() {
if(this.count == 0){
ListHasNoMoreDataUI({style:2})
}else{
Column(){
if (this.data_rmh!=null && this.data_rmh.length > 0) {
//List
List() {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
Column(){
Image($r('app.media.default_head'))
.width('84lpx')
.height('84lpx')
.margin({bottom:'15lpx'})
Text(item.creatorName)
.fontSize('20lpx')
}.alignItems(HorizontalAlign.Center)
}.onClick(()=>{
//TODO 跳转
})
.width('150lpx')
})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height('150lpx')
.onReachEnd(()=>{
if(!this.isLoading){
//进入更多关注页
}
})
}
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
Column(){
CardParser({contentDTO:item})
if(index != this.data.totalCount()-1 ){
Divider()
.width('100%')
.height('1lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}
}
}
.onClick(()=>{
//TODO 跳转
...
...
@@ -154,7 +241,8 @@ export struct SearchResultContentComponent{
ListHasNoMoreDataUI()
}
}
}.cachedCount(4)
}.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.margin({top:'23lpx',left:'23lpx',right:'23lpx'})
.layoutWeight(1)
...
...
@@ -167,6 +255,7 @@ export struct SearchResultContentComponent{
})
}
}
}
.backgroundColor($r('app.color.white'))
.height('100%')
.width('100%')
...
...
sight_harmony/features/wdComponent/src/main/ets/model/SearcherAboutDataModel.ets
View file @
ffb1f07
...
...
@@ -6,6 +6,7 @@ import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem';
import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
import { SearchResultContentData } from '../viewmodel/SearchResultContentData';
import { contentListParams, InteractDataDTO } from 'wdBean/Index';
const TAG = "SearcherAboutDataModel"
...
...
@@ -82,6 +83,8 @@ class SearcherAboutDataModel{
if(this.searchHistoryData.length>10){
this.searchHistoryData.splice(10,this.searchHistoryData.length - 10)
}
// this.putSearchHistoryData("大家")
// this.putSearchHistoryData("人民")
return this.searchHistoryData
}
...
...
@@ -278,6 +281,44 @@ class SearcherAboutDataModel{
return compRes.data
}
/**
* 搜索结果 展示列表(交互详情 评论收藏点赞分享数量)
*/
getInteractListData(data : contentListParams,context: Context): Promise<InteractDataDTO[]> {
return new Promise<InteractDataDTO[]>((success, error) => {
Logger.info(TAG, `getInteractListData start`);
this.fetchInteractListData(data).then((navResDTO: ResponseDTO<InteractDataDTO[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getInteractListDataLocal(context))
return
}
Logger.info(TAG, "getInteractListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as InteractDataDTO[]
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getInteractListData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getInteractListDataLocal(context))
})
})
}
fetchInteractListData(data : contentListParams) {
let url = HttpUrlUtils.getInteractListDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url,data, headers)
};
async getInteractListDataLocal(context: Context): Promise<InteractDataDTO[]> {
Logger.info(TAG, `getInteractListDataLocal start`);
let compRes: ResponseDTO<InteractDataDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<InteractDataDTO[]>>(context,'search_result_interact_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getInteractListDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getInteractListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/SearchResultContentData.ets
View file @
ffb1f07
...
...
@@ -4,6 +4,7 @@ import { SearchResultContentItem } from './SearchResultContentItem'
export class SearchResultContentData{
list:SearchResultContentItem[] = []
keyword:string = ""
pageNum: number = 0
pageSize: number = 20
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/SearchResultContentItem.ets
View file @
ffb1f07
export class SearchResultContentItem{
data:SearchDescription = new SearchDescription()
dataList:SearchRmhDescription[] = []
resultType:string = ""
}
...
...
@@ -172,6 +173,180 @@ class SearchDescription{
sourceName: string = ""
shareImageBucket: string = ""
landscape: string = ""
collectNum: string = ""
commentNum: string = ""
likeNum: string= ""
readNum: string= ""
shareNum: string= ""
}
export class SearchRmhDescription{
likeEnable: string= ""
previewUri: string= ""
firstFrameImageBucket: string= ""
appImg: string= ""
onlineStatus: string= ""
createUserName: string= ""
contentCheck: string= ""
type: string= ""
titleOsst: string= ""
coverHImageBucket: string= ""
shareImageUri: string= ""
searchTypeInt: string= ""
authIcon: string= ""
id: string= ""
newOld: string= ""
seoTags: string= ""
publishTime: string= ""
feedControl: string= ""
saveType: string= ""
userTypeInt: string= ""
userOrigin: string= ""
creatorType: string= ""
planStartTime: string= ""
waresSwitch: string= ""
introductionLiteral: string= ""
topicType: string= ""
hotFlag: string= ""
coverUrl: string= ""
itemId: string= ""
titleEn: string= ""
matrixId: string= ""
tplId: string= ""
joinActivity: string= ""
status: string= ""
headerPhotoUrl: string= ""
zhSearch: string= ""
activityControl: string= ""
city: string= ""
showTitleIng: string= ""
shareFlag: string= ""
creatorName: string= ""
className: string= ""
showTitleNo: string= ""
liveSwitch: string= ""
likesStyle: string= ""
dataKey: string= ""
search: string= ""
puserId: string= ""
top: string= ""
titleLiteral: string= ""
countryCode: string= ""
startTime: string= ""
shareDescription: string= ""
channelId: string= ""
openComment: string= ""
creatorClassify: string= ""
previewBucket: string= ""
picCount: string= ""
recommendControl: string= ""
creatorNameLiteral: string= ""
subjects: string= ""
updateUser: string= ""
i: string= ""
updateTime: string= ""
userId: string= ""
showTitleEd: string= ""
authTo: string= ""
rmhPlatformInt: string= ""
giftEnable: string= ""
titleEnosst: string= ""
shareCoverUrl: string= ""
deleted: string= ""
zhOperateFlag: string= ""
shareTitle: string= ""
scrollUpdated: string= ""
createTime: string= ""
creatorBan: string= ""
publishTimeInt: string= ""
organization: string= ""
channelName: string= ""
createUser: string= ""
currentPoliticsFlag: string= ""
endTime: string= ""
sourceId: string= ""
country: string= ""
secondClassify: string= ""
createUserId: string= ""
firstFrameImageUri: string= ""
pubTime: string= ""
openLikes: string= ""
contentText: string= ""
relType: string= ""
authImg: string= ""
roomId: string= ""
nameLiteral: string= ""
mainControl: string= ""
coverVImageBucket: string= ""
linkUrl: string= ""
openDownload: string= ""
zhChannelPageImg: string= ""
appStandImg: string= ""
shareSummary: string= ""
firstPublishTimeInt: string= ""
rmhPlatform: string= ""
creatorNameOsst: string= ""
searchType: string= ""
author: string= ""
askAnswerFlag: string= ""
seoTagName: string= ""
weight: string= ""
pageId: string= ""
firstPublishTime: string= ""
coverVImageUri: string= ""
publishType: string= ""
isVr: string= ""
name: string= ""
shareUrl: string= ""
userType: string= ""
firstProcessTime: string= ""
hasRecord: string= ""
shareTitleOsst: string= ""
classify: string= ""
itemType: string= ""
nameOsst: string= ""
districtCode: string= ""
hidden: string= ""
cityCode: string= ""
liveType: string= ""
appStyleImages: string= ""
titleShow: string= ""
cornerMark: string= ""
creatorId: string= ""
levelScore: string= ""
description: string= ""
liveStartTime: string= ""
likeStyle: string= ""
title: string= ""
content: string= ""
platform: string= ""
duration: string= ""
shareDescriptionLiteral: string= ""
createTimeInt: string= ""
liveEndTime: string= ""
topicTemplate: string= ""
barrageEnable: string= ""
introduction: string= ""
notice: string= ""
shareTitleLiteral: string= ""
coverHImageUri: string= ""
relId: string= ""
classCode: string= ""
grayScale: string= ""
appStyle: string= ""
authTitle: string= ""
provinceCode: string= ""
tenancy: string= ""
platformId: string= ""
classSubName: string= ""
recommended: string= ""
descriptionLiteral: string= ""
banControl: string= ""
auditingStatus: string= ""
planEndTime: string= ""
speakControl: string= ""
sourceName: string= ""
shareImageBucket: string= ""
landscape: string= ""
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/resources/rawfile/search_result_interact_list_data.json
0 → 100644
View file @
ffb1f07
{
"code"
:
"0"
,
"data"
:
[
{
"collectNum"
:
1
,
"commentNum"
:
1
,
"contentId"
:
"30044118767"
,
"contentType"
:
8
,
"likeNum"
:
20
,
"readNum"
:
7839
,
"shareNum"
:
1
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30043914123"
,
"contentType"
:
8
,
"likeNum"
:
20
,
"readNum"
:
4986
,
"shareNum"
:
2
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044329241"
,
"contentType"
:
8
,
"likeNum"
:
0
,
"readNum"
:
416
,
"shareNum"
:
0
},
{
"collectNum"
:
0
,
"commentNum"
:
2
,
"contentId"
:
"30044323528"
,
"contentType"
:
8
,
"likeNum"
:
3
,
"readNum"
:
1139
,
"shareNum"
:
4
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044318896"
,
"contentType"
:
8
,
"likeNum"
:
0
,
"readNum"
:
1266
,
"shareNum"
:
1
},
{
"collectNum"
:
11
,
"commentNum"
:
13
,
"contentId"
:
"30044318735"
,
"contentType"
:
8
,
"likeNum"
:
12
,
"readNum"
:
3842
,
"shareNum"
:
0
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044303875"
,
"contentType"
:
8
,
"likeNum"
:
0
,
"readNum"
:
2689
,
"shareNum"
:
0
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044210715"
,
"contentType"
:
8
,
"likeNum"
:
0
,
"readNum"
:
173
,
"shareNum"
:
0
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30002401426"
,
"contentType"
:
8
,
"likeNum"
:
0
,
"readNum"
:
9002
,
"shareNum"
:
1
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044297214"
,
"contentType"
:
8
,
"likeNum"
:
20
,
"readNum"
:
3079
,
"shareNum"
:
6
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30002735426"
,
"contentType"
:
8
,
"likeNum"
:
0
,
"readNum"
:
3816
,
"shareNum"
:
0
},
{
"collectNum"
:
5
,
"commentNum"
:
1
,
"contentId"
:
"30002891779"
,
"contentType"
:
8
,
"likeNum"
:
2
,
"readNum"
:
30474
,
"shareNum"
:
4
},
{
"collectNum"
:
0
,
"commentNum"
:
4
,
"contentId"
:
"30044242849"
,
"contentType"
:
8
,
"likeNum"
:
4
,
"readNum"
:
1099
,
"shareNum"
:
4
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044064967"
,
"contentType"
:
8
,
"likeNum"
:
9
,
"readNum"
:
63139
,
"shareNum"
:
5
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044214313"
,
"contentType"
:
8
,
"likeNum"
:
1
,
"readNum"
:
5966
,
"shareNum"
:
1
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044174144"
,
"contentType"
:
8
,
"likeNum"
:
20
,
"readNum"
:
5150
,
"shareNum"
:
0
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044036728"
,
"contentType"
:
8
,
"likeNum"
:
20
,
"readNum"
:
4217
,
"shareNum"
:
0
},
{
"collectNum"
:
3
,
"commentNum"
:
0
,
"contentId"
:
"30044123091"
,
"contentType"
:
8
,
"likeNum"
:
20
,
"readNum"
:
16697
,
"shareNum"
:
0
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30044055254"
,
"contentType"
:
8
,
"likeNum"
:
20
,
"readNum"
:
11551
,
"shareNum"
:
0
},
{
"collectNum"
:
0
,
"commentNum"
:
0
,
"contentId"
:
"30043994115"
,
"contentType"
:
8
,
"likeNum"
:
0
,
"readNum"
:
2370
,
"shareNum"
:
3
}
],
"message"
:
"Success"
,
"meta"
:
null
,
"requestId"
:
""
,
"success"
:
true
,
"timestamp"
:
1712889166521
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment