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-05-13 14:55:50 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2e60ef58d16278c0a9793ee7c7c51d410e9aa73c
2e60ef58
1 parent
9ca7dfab
fix:bug[17204] 搜索结果>人民号,只有1个号主信息,不应展示更多
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
273 additions
and
158 deletions
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
View file @
2e60ef5
import { SpConstants } from 'wdConstant/Index'
import {
DateTimeUtils,
SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
import { SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'
import { HttpUtils } from 'wdNetwork/Index'
import { WDRouterRule, WDRouterPage } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
...
...
@@ -116,9 +116,14 @@ export struct FollowChildComponent{
}.height('202lpx')
.justifyContent(FlexAlign.Start)
Text().backgroundColor($r('app.color.color_EDEDED'))
// Text().backgroundColor($r('app.color.color_EDEDED'))
// .width('100%')
// .height('2lpx')
Divider()
.width('100%')
.height('2lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}.width('100%')
}else {
...
...
@@ -230,9 +235,15 @@ export struct FollowChildComponent{
}.height('146lpx')
.justifyContent(FlexAlign.Center)
Text().backgroundColor($r('app.color.color_EDEDED'))
// Text().backgroundColor($r('app.color.color_EDEDED'))
// .width('100%')
// .height('2lpx')
Divider()
.width('100%')
.height('2lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}.width('100%')
}
...
...
@@ -255,12 +266,6 @@ export struct FollowChildComponent{
this.data.status = this.data.status ==="0"?"1":"0"
UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status)
// if(this.data.status === "1"){
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"")
// }else{
// UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId)
// }
}
}
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
2e60ef5
import { ContentDTO,
import {
ContentDTO,
contentListParams,
FullColumnImgUrlDTO, InteractDataDTO,
FullColumnImgUrlDTO,
InteractDataDTO,
Params,
RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
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, Logger, StringUtils, ToastUtils } from 'wdKit/Index'
import { LazyDataSource, Logger, StringUtils, ToastUtils
, UserDataLocal
} from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import MinePageDatasModel from '../../model/MinePageDatasModel'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'
import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem'
import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { FollowChildComponent } from '../mine/follow/FollowChildComponent'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
import { ActivityItemComponent } from './ActivityItemComponent'
import { SearchCreatorComponent } from './SearchCreatorComponent'
...
...
@@ -19,27 +28,28 @@ import { SearchCreatorComponent } from './SearchCreatorComponent'
const TAG = "SearchResultContentComponent"
@Component
export struct SearchResultContentComponent{
@State keywords:string = ""
@State searchType:string = ""
export struct SearchResultContentComponent {
@State keywords: string = ""
@State searchType: string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
@State data_rmh: SearchRmhDescription[] = []
@State count:number = -1;
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
@State count: number = -1;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
@State bean: FollowListDetailItem = new FollowListDetailItem("", "", "", "", "", "", "", "", "", -1, -1, "")
scroller: Scroller = new Scroller()
aboutToAppear(): void {
if
(this.searchType == "全部")
{
if
(this.searchType == "全部")
{
this.searchType = "all"
}
else if(this.searchType == "精选")
{
}
else if (this.searchType == "精选")
{
this.searchType = "cms"
}
else if(this.searchType == "人民号")
{
}
else if (this.searchType == "人民号")
{
this.searchType = "rmh"
}
else if(this.searchType == "视频")
{
}
else if (this.searchType == "视频")
{
this.searchType = "video"
}
else if(this.searchType == "活动")
{
}
else if (this.searchType == "活动")
{
this.searchType = "activity"
}
...
...
@@ -47,93 +57,135 @@ export struct SearchResultContentComponent{
this.getNewSearchResultData()
}
getNewSearchResultData(){
getNewSearchResultData()
{
this.isLoading = true
if(this.hasMore){
SearcherAboutDataModel.getSearchResultListData("10",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
if (this.hasMore) {
SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords,
getContext(this)).then((value) => {
if (!this.data || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
this.count = this.count===-1?0:this.count
}else{
if(value.list[0].dataList!=null){
this.count = this.count === -1 ? 0 : this.count
} else {
if (value.list[0].dataList != null) {
let data_temp: SearchRmhDescription[] = []
data_temp = value.list[0].dataList
//TODO 查询创作者详情接口
let request = new CreatorDetailRequestItem()
data_temp.forEach((data)
=>
{
data_temp.forEach((data)
=>
{
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
data_temp.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
SearcherAboutDataModel.getCreatorDetailListData(request).then((value) => {
if (value != null && value.length > 0) {
data_temp.forEach((data) => {
value.forEach((item) => {
if (data.creatorId == item.creatorId) {
data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
data.mainControl = item.mainControl+""
data.mainControl = item.mainControl + ""
if(data_temp.length === 1){
this.bean.headPhotoUrl = item.headPhotoUrl.split("?")[0]
this.bean.cnUserName = item.userName
this.bean.creatorId = item.creatorId
this.bean.authIcon = item.authIcon
if (value[0].fansNum > 10000) {
let temp = (value[0].fansNum / 10000) + ""
let index = temp.indexOf('.')
if (index != -1) {
temp = temp.substring(0, index + 2)
} else {
temp = temp
}
this.bean.cnFansNum = temp + "万"
} else {
this.bean.cnFansNum = item.fansNum + ""
}
this.bean.introduction = item.introduction
this.bean.mainControl = item.mainControl
this.bean.banControl = item.banControl
this.bean.cnUserType = item.userType
this.bean.cnUserId = item.userId
}
}
})
})
}
data_temp.forEach((data)
=>
{
data_temp.forEach((data)
=>
{
this.data_rmh.push(data)
})
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
//只有一条创作者,获取 创作者信息
if (this.data_rmh.length === 1) {
if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){
//查询是否被关注
let status = new FollowListStatusRequestItem()
status.creatorIds.push(new QueryListIsFollowedItem(this.data_rmh[0].creatorId))
MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => {
this.bean.status = newValue[0].status
}).catch((err: Error) => {
console.log(TAG, "请求失败")
})
}else{
this.bean.status = ""
}
}
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
})
}
this.getInteractData(value)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isLoading = false
this.count = this.count
===-1?0:
this.count
this.count = this.count
=== -1 ? 0 :
this.count
})
}
}
getInteractData(resultData:SearchResultContentData){
if(resultData.list[0].dataList!=null){
resultData.list.splice(0,1)
getInteractData(resultData: SearchResultContentData) {
if (resultData.list[0].dataList != null) {
resultData.list.splice(0, 1)
}
let data
: contentListParams = {
let data: contentListParams = {
contentList: []
}
resultData.list.forEach((item)
=>
{
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)=>{
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+""
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)=>{
photos.push({url:value} as FullColumnImgUrlDTO)
resultData.list.forEach((value) => {
let photos: FullColumnImgUrlDTO[] = []
if (value.data.appStyle === 4) {
value.data.appStyleImages.split("&&").forEach((value) => {
photos.push({ url: value } as FullColumnImgUrlDTO)
})
}
let contentDTO = this.dataTransform(value,photos);
if(contentDTO.appStyle != "13"){
let contentDTO = this.dataTransform(value, photos);
if (contentDTO.appStyle != "13") {
this.data.push(contentDTO)
}
...
...
@@ -142,131 +194,189 @@ export struct SearchResultContentComponent{
this.count = this.data.totalCount()
if (this.data.totalCount() < resultData.totalCount) {
this.curPageNum++
}else {
}
else {
this.hasMore = false
}
this.isLoading = false
if
(this.count === 0 && resultData.list.length > 0)
{
if
(this.count === 0 && resultData.list.length > 0)
{
this.count = -1
if
(!this.isLoading)
{
if
(!this.isLoading)
{
//加载分页数据
this.getNewSearchResultData()
}
}else if(this.count <= 20 && resultData.list.length > 0){
if(!this.isLoading){
} else if (this.count <= 10 && resultData.list.length > 0) {
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
}
}
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
}).catch((err: Error) => {
console.log(TAG, "请求失败")
this.isLoading = false
this.count = this.count
===-1?0:
this.count
this.count = this.count
=== -1 ? 0 :
this.count
})
}
build() {
Column() {
if(this.count == 0){
ListHasNoMoreDataUI({style:2})
}else{
Column(){
if (this.data_rmh!=null && this.data_rmh.length > 0) {
//List
List({space:'8lpx'}) {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({item:item})
}.onClick(()=>{
//TODO 跳转
})
.width('150lpx')
.height('100%')
})
if (this.count == 0) {
ListHasNoMoreDataUI({ style: 2 })
} else {
List() {
if (this.data_rmh != null && this.data_rmh.length > 0){
if (this.data_rmh.length === 1){
ListItem(){
FollowChildComponent({ data: this.bean, type: 1 })
}.padding({left:"31lpx",right:"31lpx"})
}else{
ListItem(){
Column(){
Text("查看更多")
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
.lineHeight('27lpx')
.fontColor($r('app.color.color_9E9E9E'))
}.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
.height('180lpx')
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.justifyContent(FlexAlign.Center)
}.height('100%')
.margin({left:'23lpx'})
.onClick(()=>{
let params: Params = {
pageID: this.keywords
this.SearchListUI()
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
})
}
}
.cachedCount(6)
.edgeEffect(EdgeEffect.Spring)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height('219lpx')
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%')
.height('1lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}
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%')
.height('1lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}
}
}, (item: ContentDTO, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore && this.data.totalCount() > 0){
ListItem(){
ListHasNoMoreDataUI()
}
}
}.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.layoutWeight(1)
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
//加载分页数据
this.getNewSearchResultData()
}, (item: ContentDTO, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore && this.data.totalCount() > 0) {
ListItem() {
ListHasNoMoreDataUI()
}
})
}.layoutWeight(1)
}
}.cachedCount(10)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
//加载分页数据
this.getNewSearchResultData()
}
})
}
}
.backgroundColor($r('app.color.white'))
.layoutWeight(1)
.width('100%')
}
@Builder
multiCreatorUI() {
Column() {
List() {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({ item: item })
}
.width('150lpx')
.height('100%')
})
ListItem() {
Column() {
Text("查看更多")
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
.lineHeight('27lpx')
.fontColor($r('app.color.color_9E9E9E'))
}
.borderRadius({ topLeft: '4lpx', bottomLeft: '4lpx' })
.height('180lpx')
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.justifyContent(FlexAlign.Center)
}.height('100%')
.margin({ left: '23lpx' })
.onClick(() => {
let params: Params = {
pageID: this.keywords
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage, params)
})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height('219lpx')
Divider()
.width('100%')
.height('12lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('12lpx')
}
}
@Builder
SearchListUI() {
List({space:'8lpx'}) {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({item:item})
}
.width('150lpx')
.height('100%')
})
ListItem(){
Column(){
Text("查看更多")
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
.lineHeight('27lpx')
.fontColor($r('app.color.color_9E9E9E'))
}.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
.height('180lpx')
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.justifyContent(FlexAlign.Center)
}.height('100%')
.margin({left:'23lpx'})
.onClick(()=>{
let params: Params = {
pageID: this.keywords
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height('219lpx')
Divider()
.width('100%')
.height('12lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('12lpx')
}
private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO {
let contentDTO = new ContentDTO();
contentDTO.appStyle = value.data.appStyle + ""
...
...
Please
register
or
login
to post a comment