yangchenggong1_wd

desc:搜索结果展现

... ... @@ -235,6 +235,11 @@ export class HttpUrlUtils {
static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search";
/**
* 创作者详情接口
*/
static readonly CREATOR_DETAIL_LIST_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/master/detailList";
/**
* 早晚报列表
* 根据页面id获取页面楼层列表
* https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927
... ... @@ -717,6 +722,11 @@ export class HttpUrlUtils {
return url
}
static getCreatorDetailListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH
return url
}
// static getYcgCommonHeaders(): HashMap<string, string> {
// let headers: HashMap<string, string> = new HashMap<string, string>()
//
... ...
... ... @@ -16,7 +16,7 @@ export default struct MinePageMoreFunctionUI {
.fontColor($r('app.color.color_666666'))
.fontSize('29lpx')
.margin({ left: "31lpx" })
.fontWeight(600)
.fontWeight('600lpx')
}.height('92lpx')
.width('100%')
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -10,6 +10,8 @@ export default struct MinePagePersonFunctionUI {
loginChange(){
if(this.loginState){
this.isLogin=true
}else{
this.isLogin=false
}
}
... ...
... ... @@ -18,6 +18,8 @@ export default struct MinePageUserSimpleInfoUI {
Logger.debug("isLogin",'MinePageUserSimpleInfoUI')
if(this.loginState){
this.isLogin=true
}else {
this.isLogin=false
}
}
loginStateChange(){
... ...
/**
* 搜索活动 展示组件
*/
import { ContentDTO } from 'wdBean/Index';
@Component
export struct ActivityItemComponent {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Row() {
Stack(){
Image(this.contentDTO.coverUrl)
.width('207lpx')
.height('276lpx')
.objectFit(ImageFit.Auto)
.borderRadius('7lpx')
Row(){
Image(this.contentDTO.programType+"" === "1" ? $r('app.media.activity_is_start_icon') :$r('app.media.activity_not_begin_icon'))
.width('42lpx')
.height('35lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.Medium)
Text(this.contentDTO.programType+"" === "1" ? "进行中" :"未开始")
.fontColor($r('app.color.white'))
.fontSize('21lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
}.margin({right:'19lpx',bottom:'13lpx'})
}.alignContent(Alignment.BottomEnd)
Column() {
Row(){
// Text(){
// // backgroundColor 不生效
// Span(this.contentDTO.objectType == "new_collect" ? "征稿" : this.contentDTO.objectType == "vote" ? "投票":"")
// .fontColor($r('app.color.main_red'))
// .fontSize('23lpx')
// .fontWeight('400lpx')
// .lineHeight('31lpx')
// .padding({left:'10lpx',right:'10lpx',top:'6lpx',bottom:'6lpx'})
// .backgroundColor( "#FF0"/*$r('app.color.color_ED2800')*/)
// .borderRadius('10lpx')
// .margin({ right: '10lpx' })
//
// Span(this.contentDTO.newsTitle)
// .fontColor($r('app.color.color_222222'))
// .fontSize('33lpx')
// .fontWeight('400lpx')
// .lineHeight('48lpx')
// }.textAlign(TextAlign.Start)
// .maxLines(2)
// .textOverflow({ overflow: TextOverflow.Ellipsis })
//TODO 这里的样式(objectType) 只写了两个,其他的需要扩展
Text(this.contentDTO.objectType == "new_collect" ? "征稿" : this.contentDTO.objectType == "vote" ? "投票":"")
.fontColor($r('app.color.white'))
.fontSize('23lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.padding({left:'10lpx',right:'10lpx',top:'6lpx',bottom:'6lpx'})
.backgroundColor( $r('app.color.color_ED2800'))
.borderRadius('10lpx')
.margin({ right: '10lpx' })
Text(this.contentDTO.newsTitle)
.fontColor($r('app.color.color_222222'))
.fontSize('33lpx')
.fontWeight('400lpx')
.lineHeight('48lpx')
.textAlign(TextAlign.Start)
.maxLines(2)
.layoutWeight(1)
}
.margin({ bottom: '15lpx' })
.alignItems(VerticalAlign.Top)
.width('100%')
Row() {
Image($r('app.media.time_icon'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
.margin({ right: '4lpx' })
.interpolation(ImageInterpolation.Medium)
Text("时间:" + this.contentDTO.startTime.split(" ")[0] + "~" + this.contentDTO.endTime.split(" ")[0])
.fontColor($r('app.color.color_999999'))
.fontSize('23lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
}
Blank()
Text(this.contentDTO.programType+"" === "1" ? "立即参与" : "立即查看")
.fontColor($r('app.color.white'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('38lpx')
.width('154lpx')
.height('54lpx')
.textAlign(TextAlign.Center)
.backgroundColor(this.contentDTO.programType+"" == "1" ? $r('app.color.color_ED2800') : $r('app.color.color_F07E47'))
.borderRadius('6lpx')
}.alignItems(HorizontalAlign.Start)
.width('428lpx')
.height('276lpx')
}.height('330lpx')
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
.padding({left:'31lpx',right:'31lpx'})
}
}
\ No newline at end of file
... ...
... ... @@ -253,7 +253,8 @@ export struct SearchComponent {
if(StringUtils.isNotEmpty(this.searchText)){
SearcherAboutDataModel.putSearchHistoryData(this.searchText)
this.getSearchHistoryData()
ToastUtils.shortToast("插入一条搜索记录")
this.getSearchHotResData(this.searchText)
}
}else{
router.back()
... ...
... ... @@ -3,12 +3,14 @@ import { ContentDTO,
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 { LazyDataSource, StringUtils, ToastUtils } from 'wdKit/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
import { ActivityItemComponent } from './ActivityItemComponent'
const TAG = "SearchResultContentComponent"
... ... @@ -20,6 +22,7 @@ export struct SearchResultContentComponent{
@State data_rmh: SearchRmhDescription[] = []
@State count:number = 0;
@State isLoading:boolean = false
@State isLoading2:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
... ... @@ -52,7 +55,25 @@ export struct SearchResultContentComponent{
if(value.list[0].dataList!=null){
this.data_rmh = value.list[0].dataList
//TODO 查询创作者详情接口
let request = new CreatorDetailRequestItem()
this.data_rmh .forEach((data)=>{
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
this.data_rmh.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
data.headerPhotoUrl = item.headPhotoUrl
}
})
})
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
}
this.getInteractData(value)
}
... ... @@ -105,7 +126,7 @@ export struct SearchResultContentComponent{
cityCode: value.data.cityCode,
coverSize: "",
coverType: -1,
coverUrl: value.data.appStyleImages.split("&&")[0],
coverUrl: this.searchType=="activity"?value.data.zhChannelPageImg:value.data.appStyleImages.split("&&")[0],
description: value.data.description,
districtCode: value.data.districtCode,
endTime: value.data.endTime,
... ... @@ -122,7 +143,7 @@ export struct SearchResultContentComponent{
programId: "",
programName: "",
programSource: -1,
programType: -1,
programType: Number.parseInt(value.data.status),
provinceCode: value.data.provinceCode,
showTitleEd: value.data.showTitleEd,
showTitleIng: value.data.showTitleIng,
... ... @@ -186,42 +207,76 @@ export struct SearchResultContentComponent{
Column(){
if (this.data_rmh!=null && this.data_rmh.length > 0) {
//List
List() {
List({space:'8lpx'}) {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
Column(){
Image($r('app.media.default_head'))
.width('84lpx')
.height('84lpx')
Image(item.headerPhotoUrl)
.width('92lpx')
.alt($r('app.media.default_head'))
.height('92lpx')
.margin({bottom:'15lpx'})
.borderRadius(50)
Text(item.creatorName)
.fontSize('20lpx')
.fontSize('25lpx')
.fontWeight('400lpx')
.lineHeight('35lpx')
.constraintSize({maxWidth:'150lpx'})
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
}.onClick(()=>{
//TODO 跳转
})
.width('150lpx')
.height('100%')
})
ListItem(){
Text("查看更多")
.height('180lpx')
.textAlign(TextAlign.Center)
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.fontColor($r('app.color.color_9E9E9E'))
.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
}.height('100%')
.margin({left:'23lpx'})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.edgeEffect(EdgeEffect.Spring)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height('150lpx')
.height('219lpx')
.onReachEnd(()=>{
if(!this.isLoading){
if(!this.isLoading2){
this.isLoading2 = true
//进入更多关注页
ToastUtils.shortToast("进入更多关注页")
}
})
Divider()
.width('100%')
.height('12lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('12lpx')
}
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
Column(){
if(this.searchType == "activity"){
ActivityItemComponent({contentDTO:item})
}else{
CardParser({contentDTO:item})
}
if(index != this.data.totalCount()-1 ){
Divider()
.width('100%')
... ... @@ -245,7 +300,6 @@ export struct SearchResultContentComponent{
}.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.margin({top:'23lpx',left:'23lpx',right:'23lpx'})
.layoutWeight(1)
.onReachEnd(()=>{
console.log(TAG,"触底了");
... ...
... ... @@ -7,6 +7,8 @@ import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
import { SearchResultContentData } from '../viewmodel/SearchResultContentData';
import { contentListParams, InteractDataDTO } from 'wdBean/Index';
import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
import { CreatorDetailResponseItem } from '../viewmodel/CreatorDetailResponseItem';
const TAG = "SearcherAboutDataModel"
... ... @@ -320,6 +322,37 @@ class SearcherAboutDataModel{
}
/**
* 获取关注详情 列表
*/
getCreatorDetailListData(object:CreatorDetailRequestItem): Promise<CreatorDetailResponseItem[]> {
return new Promise<CreatorDetailResponseItem[]>((success, error) => {
Logger.info(TAG, `getCreatorDetailListData start`);
this.fetchCreatorDetailListData(object).then((navResDTO: ResponseDTO<CreatorDetailResponseItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success([])
return
}
Logger.info(TAG, "getCreatorDetailListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as CreatorDetailResponseItem[]
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getCreatorDetailListData catch, error.name : ${err.name}, error.message:${err.message}`);
success([])
})
})
}
fetchCreatorDetailListData(object:CreatorDetailRequestItem) {
let url = HttpUrlUtils.getCreatorDetailListDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<CreatorDetailResponseItem[]>>(url,object, headers)
};
}
const searcherAboutDataModel = SearcherAboutDataModel.getInstance()
... ...
export class CreatorDetailRequestItem{
creatorIdList:string[] = []
}
\ No newline at end of file
... ...
export class CreatorDetailResponseItem{
articleCreation: number = 0
attentionNum: number = 0
authIcon: string = ""
authId: number = 0
authPersonal: string = ""
authTitle: string = ""
banControl: number = 0
categoryAuth: string = ""
city: string = ""
cnContentPublish: number = 0
cnIsComment: number = 0
cnIsLike: number = 0
cnLiveCommentControl: number = 0
cnLiveGiftControl: number = 0
cnLiveLikeControl: number = 0
cnLivePublish: number = 0
cnLiveShareControl: number = 0
cnShareControl: number = 0
collectNum: number = 0
commentNum: number = 0
contentPublish: number = 0
creatorId: string = ""
district: string = ""
dynamicControl: number = 0
dynamicCreation: number = 0
fansNum: number = 0
headPhotoUrl: string = ""
honoraryIcon: string = ""
honoraryTitle: string = ""
introduction: string = ""
isAttention: number = 0
isComment: number = 0
isLike: number = 0
likeNum: number = 0
liveCommentControl: number = 0
liveGiftControl: number = 0
liveLikeControl: number = 0
livePublish: number = 0
liveShareControl: number = 0
liveSwitch: number = 0
mainControl: number = 0
pictureCollectionCreation: number = 0
posterShareControl: number = 0
province: string = ""
region: string = ""
registTime: number = 0
shareControl: number = 0
shareNum: number = 0
subjectType: number = 0
userId: string = ""
userName: string = ""
userType: string = ""
videoCollectionCreation: number = 0
videoCreation: number = 0
}
\ No newline at end of file
... ...
... ... @@ -139,6 +139,14 @@
{
"name": "color_000000",
"value": "#000000"
},
{
"name": "color_F07E47",
"value": "#F07E47"
},
{
"name": "color_9E9E9E",
"value": "#9E9E9E"
}
]
}
\ No newline at end of file
... ...