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-24 09:44:05 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1497a91d8b64965d5b236041790c3fd0117375ba
1497a91d
1 parent
49fc142d
desc:搜索推荐跳转
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
115 deletions
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultComponent.ets
sight_harmony/features/wdComponent/src/main/ets/model/SearcherAboutDataModel.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/SearchSuggestData.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchComponent.ets
View file @
1497a91
...
...
@@ -25,6 +25,7 @@ export struct SearchComponent {
@State relatedSearchContentsData: SearchRelatedItem[] = []
scroller: Scroller = new Scroller()
@State count:string[] = []
@State isGetRequest:boolean = false;
aboutToAppear() {
//获取提示滚动
...
...
@@ -112,7 +113,7 @@ export struct SearchComponent {
} else {
if (this.hasChooseSearch) {
//搜索结果
SearchResultComponent({count:this.count,searchText:this.searchText,is
Init:true
})
SearchResultComponent({count:this.count,searchText:this.searchText,is
GetRequest:this.isGetRequest
})
} else {
//联想搜索
SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText})
...
...
@@ -287,8 +288,10 @@ export struct SearchComponent {
this.count.push("活动")
}
}
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultComponent.ets
View file @
1497a91
...
...
@@ -17,7 +17,7 @@ const TAG = "SearchResultComponent"
export struct SearchResultComponent {
@Prop count: string[]
@Prop searchText: string
@
State isIni
t:boolean = false;
@
Prop isGetReques
t:boolean = false;
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
fontColor: string = '#999999'
...
...
@@ -28,7 +28,7 @@ export struct SearchResultComponent {
scroller: Scroller = new Scroller()
aboutToAppear(): void {
if (this.count.length === 0 && this.is
Ini
t == true) {
if (this.count.length === 0 && this.is
GetReques
t == true) {
this.getSuggestData()
}
}
...
...
@@ -40,18 +40,7 @@ export struct SearchResultComponent {
SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => {
value.forEach((item) => {
this.data.push({
appStyle: item.appStyle,
channelId: item.channelId + "",
coverType: item.coverType,
coverUrl: item.coverUrl,
newsTitle: item.newsTitle,
objectId: item.objectId,
publishTime: item.publishTime,
relId: item.relId + "",
relType: item.relType + "",
source: item.source,
} as ContentDTO)
this.data.push(item)
})
this.data.notifyDataReload()
this.suggest_count = this.data.totalCount()
...
...
@@ -61,7 +50,7 @@ export struct SearchResultComponent {
build() {
Column() {
if (this.count != null && this.count.length === 0 && this.is
Ini
t == true) {
if (this.count != null && this.count.length === 0 && this.is
GetReques
t == true) {
List() {
ListItem() {
//缺省图
...
...
sight_harmony/features/wdComponent/src/main/ets/model/SearcherAboutDataModel.ets
View file @
1497a91
...
...
@@ -6,10 +6,9 @@ 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';
import {
ContentDTO,
contentListParams, InteractDataDTO } from 'wdBean/Index';
import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
import { CreatorDetailResponseItem } from '../viewmodel/CreatorDetailResponseItem';
import { SearchSuggestData } from '../viewmodel/SearchSuggestData';
import { SearchSuggestRequestItem } from '../viewmodel/SearchSuggestRequestItem';
const TAG = "SearcherAboutDataModel"
...
...
@@ -354,17 +353,17 @@ class SearcherAboutDataModel{
/**
* 搜索推荐 展示列表
*/
getSearchSuggestData(object:SearchSuggestRequestItem,context: Context): Promise<SearchSuggestData[]> {
return new Promise<SearchSuggestData[]>((success, error) => {
getSearchSuggestData(object:SearchSuggestRequestItem,context: Context): Promise<ContentDTO[]> {
return new Promise<ContentDTO[]>((success, error) => {
Logger.info(TAG, `getSearchSuggestData start`);
this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<
SearchSuggestData
[]>) => {
this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<
ContentDTO
[]>) => {
if (!navResDTO || navResDTO.code != 0 /*|| navResDTO.data == null*/) {
// success(this.getSearchSuggestDataLocal(context))
success([])
return
}
Logger.info(TAG, "getSearchSuggestData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as
SearchSuggestData
[]
let navigationBean = navResDTO.data as
ContentDTO
[]
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getSearchSuggestData catch, error.name : ${err.name}, error.message:${err.message}`);
...
...
@@ -377,12 +376,12 @@ class SearcherAboutDataModel{
fetchSearchSuggestData(object:SearchSuggestRequestItem) {
let url = HttpUrlUtils.getSearchSuggestDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<
SearchSuggestData
[]>>(url,object, headers)
return WDHttp.post<ResponseDTO<
ContentDTO
[]>>(url,object, headers)
};
async getSearchSuggestDataLocal(context: Context): Promise<
SearchSuggestData
[]> {
async getSearchSuggestDataLocal(context: Context): Promise<
ContentDTO
[]> {
Logger.info(TAG, `getInteractListDataLocal start`);
let compRes: ResponseDTO<
SearchSuggestData[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchSuggestData
[]>>(context,'search_suggest_data.json' );
let compRes: ResponseDTO<
ContentDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<ContentDTO
[]>>(context,'search_suggest_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getInteractListDataLocal compRes is empty`);
return []
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/SearchSuggestData.ets
deleted
100644 → 0
View file @
49fc142
@Observed
export class SearchSuggestData{
// activityExt: null
appStyle: string = ""
// askInfo: null
axisColor: string = ""
// bestNoticer: null
// bottomNavId: null
cardItemId: string = ""
channelId: number = -1
// commentInfo: null
corner: string = ""
coverSize: string = ""
coverType: number = -1
coverUrl: string = ""
expIds: string = ""
extra: string = ""
fullColumnImgUrls: Array<FullColumnImgUrls> = []
// hasMore: null
itemId: string = ""
itemType: string = ""
itemTypeCode: string = ""
keyArticle: number = -1
// landscape: null
// likeStyle: null
linkUrl: string = ""
// liveInfo: null
menuShow: number = -1
newTags: string = ""
newsAuthor: string = ""
newsSubTitle: string = ""
newsSummary: string = ""
newsTitle: string = ""
newsTitleColor: string = ""
objectId: string = ""
objectLevel: string = ""
objectType: string = ""
// openComment: null
// openLikes: null
pageId: string = ""
// photoNum: null
// position: null
// productNum: null
publishTime: string = ""
// pushTime: null
// pushUnqueId: null
readFlag: number = -1
recommend: number = -1
relId: number = -1
relObjectId: string = ""
relType: number = -1
// rmhInfo: null
rmhPlatform: number = -1
sceneId: string = ""
// shareInfo: null
// slideShows: Array< unknown >
// sortValue: null
source: string = ""
subObjectType: string = ""
subSceneId: string = ""
// tagIds: Array< unknown >
// tagWord: null
// titleShow: null
// titleShowPolicy: null
// topicTemplate: null
traceId: string = ""
traceInfo: string = ""
// userInfo: null
videoInfo: VideoInfo = new VideoInfo()
visitorComment: number = -1
// voiceInfo: null
}
class FullColumnImgUrls{
// format: null
fullUrl: string = ""
height: number = -1
landscape: number = -1
size: number = -1
url: string = ""
weight: number = -1
}
class VideoInfo{
firstFrameImageUri: string = ""
videoDuration: number = -1
videoLandscape: number = -1
videoUrl: string = ""
}
Please
register
or
login
to post a comment