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
liyubing
2024-06-24 17:50:20 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a7f4a7e6c205aa60519bf528d99a3357a52a33aa
a7f4a7e6
1 parent
dbeb9e10
fix:1)搜索 输入wuhuhuan,人民号提示暂无内容,android显示对应结果
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
84 deletions
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchResultContentComponent.ets
View file @
a7f4a7e
...
...
@@ -19,8 +19,7 @@ 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 { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { FollowChildComponent } from '../mine/follow/FollowChildComponent'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
...
...
@@ -38,7 +37,7 @@ export struct SearchResultContentComponent {
@State keywords: string = ""
@State searchType: string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
tempList
: ContentDTO[] = []
tempList: ContentDTO[] = []
@State data_rmh: SearchRmhDescription[] = []
@State count: number = -1;
@State isLoading: boolean = false
...
...
@@ -48,14 +47,14 @@ export struct SearchResultContentComponent {
scroller: Scroller = new Scroller()
private scroller2: Scroller = new Scroller()
@State ellipseW: number = 0
@State moreWidth:number = 20
@State moreWidth:
number = 20
@State listLeft: number = 0
@State isEnd: boolean = false
@Watch('updateData') @Prop sameSearch:number = 0
@Prop isCurrentShow:boolean = false;
@Watch('updateData') @Prop sameSearch: number = 0
@Prop isCurrentShow: boolean = false;
updateData(){
if(this.isCurrentShow){
updateData() {
if (this.isCurrentShow) {
this.data_rmh = []
this.data.clearAllData()
...
...
@@ -115,7 +114,7 @@ export struct SearchResultContentComponent {
data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
data.mainControl = item.mainControl + ""
if
(data_temp.length === 1)
{
if
(data_temp.length === 1)
{
this.bean.headPhotoUrl = item.headPhotoUrl.split("?")[0]
this.bean.cnUserName = item.userName
this.bean.creatorId = item.creatorId
...
...
@@ -133,8 +132,8 @@ export struct SearchResultContentComponent {
} else {
this.bean.cnFansNum = item.fansNum + ""
}
let regex:RegExp = new RegExp('\n','g')
this.bean.introduction = item.introduction.replace(regex,'')
let regex: RegExp = new RegExp('\n', 'g')
this.bean.introduction = item.introduction.replace(regex, '')
this.bean.mainControl = item.mainControl
this.bean.banControl = item.banControl
...
...
@@ -148,9 +147,13 @@ export struct SearchResultContentComponent {
data_temp.forEach((data) => {
this.data_rmh.push(data)
})
if(this.data_rmh.length > 0){
this.count = 1
}
//只有一条创作者,获取 创作者信息
if (this.data_rmh.length === 1) {
if
(StringUtils.isNotEmpty(UserDataLocal.getUserId()))
{
if
(StringUtils.isNotEmpty(UserDataLocal.getUserId()))
{
//查询是否被关注
let status = new FollowListStatusRequestItem()
status.creatorIds.push(new QueryListIsFollowedItem(this.data_rmh[0].creatorId))
...
...
@@ -159,7 +162,7 @@ export struct SearchResultContentComponent {
}).catch((err: Error) => {
console.log(TAG, "请求失败")
})
}
else
{
}
else
{
this.bean.status = ""
}
}
...
...
@@ -192,6 +195,8 @@ export struct SearchResultContentComponent {
})
})
if (data.contentList.length > 0) {
SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => {
newValue.forEach((item) => {
resultData.list.forEach((data) => {
...
...
@@ -206,32 +211,32 @@ export struct SearchResultContentComponent {
})
// 批量号主信息
let creatorIdList: string[] = []
resultData.list.forEach((value:
SearchResultContentItem) => {
resultData.list.forEach((value:
SearchResultContentItem) => {
creatorIdList.push(value.data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData({creatorIdList:creatorIdList
}).then((rem) => {
SearcherAboutDataModel.getCreatorDetailListData({ creatorIdList: creatorIdList
}).then((rem) => {
resultData.list.forEach((value: SearchResultContentItem) => {
const landscape = value.data.landscape
let photos: FullColumnImgUrlDTO[] = []
// if (value.data.appStyle === 4) {
value.data.appStyleImages.split("&&").forEach((value) => {
let resizeParams = MinePageDatasModel.extractResizeParams(value)
if
(resizeParams && resizeParams.length === 2)
{
if
(resizeParams && resizeParams.length === 2)
{
photos.push(
{
fullUrl: value,
weight:resizeParams[0],
height:resizeParams[1],
weight: resizeParams[0],
height: resizeParams[1],
landscape: Number(landscape),
} as FullColumnImgUrlDTO
)
}
})
// }
let contentDTO = this.dataTransform(rem,value, photos);
if(value.data.type != "13"){
let contentDTO = this.dataTransform(rem, value, photos);
if (value.data.type != "13") {
this.data.push(contentDTO)
if
(value.data.sameContentList != null && value.data.sameContentList.length > 0) {
if
(value.data.sameContentList != null && value.data.sameContentList.length > 0) {
let contentDTO2 = new ContentDTO();
contentDTO2.sameContentListJson = JSON.stringify(value.data.sameContentList)
contentDTO2.sameContentListSize = value.data.sameContentList.length
...
...
@@ -257,6 +262,9 @@ export struct SearchResultContentComponent {
this.isLoading = false
this.count = this.count === -1 ? 0 : this.count
})
}else {
this.hasMore = false
}
}
build() {
...
...
@@ -264,15 +272,15 @@ export struct SearchResultContentComponent {
if (this.count == 0) {
ListHasNoMoreDataUI({ style: 2 })
} else {
List({scroller:this.scroller2}) {
if (this.data_rmh != null && this.data_rmh.length > 0){
if (this.data_rmh.length === 1){
ListItem(){
List({ scroller: this.scroller2 }) {
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(){
}.padding({ left: "31lpx", right: "31lpx" })
} else {
ListItem() {
Column() {
this.SearchListUI()
}
}
...
...
@@ -283,21 +291,26 @@ export struct SearchResultContentComponent {
Column() {
if (this.searchType == "activity") {
ActivityItemComponent({ contentDTO: item })
}
else if(item.sameContentListSize > 0)
{
}
else if (item.sameContentListSize > 0)
{
MoreComponent({ contentDTO: item })
}else if(item.appStyle == "9"){
Column(){
Card9Component({ compDTO: new CompDTO, contentDTO:item, pageId: "", pageName: "" })
} else if (item.appStyle == "9") {
Column() {
Card9Component({
compDTO: new CompDTO,
contentDTO: item,
pageId: "",
pageName: ""
})
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
}
} else {
if(this.data?.get(index + 1)?.sameContentListSize > 0) {
if
(this.data?.get(index + 1)?.sameContentListSize > 0) {
Divider()
.width('100%')
.color($r('app.color.color_F5F5F5'))
.strokeWidth(4)
}
CardParser({
compDTO:
new CompDTO, contentDTO: item })
CardParser({
compDTO:
new CompDTO, contentDTO: item })
}
if (index != this.data.totalCount() - 1) {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
...
...
@@ -312,7 +325,7 @@ export struct SearchResultContentComponent {
}, (item: ContentDTO, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore &&
this.data.totalCount() > 0
) {
if (!this.hasMore &&
(this.data.totalCount() > 0|| (this.data_rmh != null && this.data_rmh.length > 0))
) {
ListItem() {
ListHasNoMoreDataUI()
}
...
...
@@ -320,6 +333,7 @@ export struct SearchResultContentComponent {
}.cachedCount(5)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.height('100%')
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
...
...
@@ -334,23 +348,23 @@ export struct SearchResultContentComponent {
@Builder
SearchListUI() {
List({initialIndex: 0,space:'8lpx',scroller: this.scroller}) {
ListItemGroup(){
List({ initialIndex: 0, space: '8lpx', scroller: this.scroller }) {
ListItemGroup() {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
SearchCreatorComponent({
item:item
})
SearchCreatorComponent({
item: item
})
}
.width('150lpx')
.height('100%')
})
}.offset({ left: this.listLeft })
ListItem(){
if (this.data_rmh.length === 10){
ListItem() {
if (this.data_rmh.length === 10) {
this.itemEnd()
}
}.height('100%')
.margin({
left:'23lpx'
})
.margin({
left: '23lpx'
})
}
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
...
...
@@ -359,10 +373,10 @@ export struct SearchResultContentComponent {
.height('219lpx')
.onReachEnd(() => {
this.isEnd = true
console.log(TAG,'is end')
console.log(TAG,
'is end')
})
.onScrollFrameBegin((offset: number, state: ScrollState) => {
console.log(TAG,'offset', offset)
console.log(TAG,
'offset', offset)
if (!this.scroller.isAtEnd()) {
this.isEnd = false
}
...
...
@@ -374,31 +388,35 @@ export struct SearchResultContentComponent {
.parallelGesture(
PanGesture({ direction: PanDirection.Horizontal, distance: 1 })
.onActionStart((event: GestureEvent) => {
console.info(TAG,'Pan start')
console.info(TAG,
'Pan start')
})
.onActionUpdate((event: GestureEvent) => {
///小于10个不展示滑动
if (this.data_rmh.length < 10) return;
if (this.data_rmh.length < 10) {
return;
}
if (event && this.isEnd) {
// console.log('event.offsetX',event.offsetX)
this.listLeft = event.offsetX < -60 ? -60 : event.offsetX > 0 ? 0 : event.offsetX
this.ellipseW = (-this.listLeft) / 1.5
console.log(TAG,"this.ellipseW==>" + this.ellipseW)
console.log(TAG,
"this.ellipseW==>" + this.ellipseW)
}
})
.onActionEnd((event: GestureEvent) => {
if (this.data_rmh.length < 10) return;
console.info(TAG,'Pan end')
if (this.data_rmh.length < 10) {
return;
}
console.info(TAG, 'Pan end')
this.listLeft = 0
// this.moreWidth = 20
if (event.offsetX < 0 && this.ellipseW >=20) {
console.log(TAG,'跳转')
if (event.offsetX < 0 && this.ellipseW >= 20) {
console.log(TAG, '跳转')
let params: Params = {
pageID: this.keywords
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,
params)
}
this.ellipseW = 0
})
...
...
@@ -411,18 +429,17 @@ export struct SearchResultContentComponent {
.strokeWidth('12lpx')
}
@Builder
itemEnd() {
Row() {
Ellipse()
.width(2* this.ellipseW)
.width(2
* this.ellipseW)
.height('100%')
.fill('rgb(240,235,238)')
.position({ left: -this.ellipseW, top: 0 })
Column(){
Text(this.ellipseW === 0 ? '' : this.ellipseW < 20? '查看更多' : '松手查看')
Column() {
Text(this.ellipseW === 0 ? '' : this.ellipseW < 20 ? '查看更多' : '松手查看')
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
...
...
@@ -437,17 +454,18 @@ export struct SearchResultContentComponent {
.height('100%')
}
private dataTransform(rem:CreatorDetailResponseItem[],value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo(rem,value)
console.log('获取photos',JSON.stringify(photos))
console.log('获取value2',JSON.stringify(value))
private dataTransform(rem: CreatorDetailResponseItem[], value: SearchResultContentItem,
photos: FullColumnImgUrlDTO[]): ContentDTO {
let rmhInfo = this.getRmhInfo(rem, value)
console.log('获取photos', JSON.stringify(photos))
console.log('获取value2', JSON.stringify(value))
let liveType = value.data?.liveType;
let seoTags = value.data?.seoTags
let cornerMark = value.data?.cornerMark
let contentDTO = new ContentDTO();
contentDTO.liveType = liveType?liveType: ""
contentDTO.seoTags = seoTags?seoTags: ""
contentDTO.cornerMark = cornerMark?cornerMark: ""
contentDTO.liveType = liveType ? liveType : ""
contentDTO.seoTags = seoTags ? seoTags : ""
contentDTO.cornerMark = cornerMark ? cornerMark : ""
contentDTO.appStyle = value.data.appStyle + ""
contentDTO.cityCode = value.data.cityCode
contentDTO.coverSize = ""
...
...
@@ -529,13 +547,13 @@ export struct SearchResultContentComponent {
}
// 搜索数据转化rmhInfo
private getRmhInfo(rem:CreatorDetailResponseItem[],value:SearchResultContentItem)
{
private getRmhInfo(rem: CreatorDetailResponseItem[], value: SearchResultContentItem)
{
let obj = value.data
let rmhInfo:RmhInfoDTO = {
rmhHeadUrl:obj.headerPhotoUrl,
rmhName:obj.creatorName,
rmhId:obj.creatorId,
authIcon:obj.authIcon,
let rmhInfo: RmhInfoDTO = {
rmhHeadUrl: obj.headerPhotoUrl,
rmhName: obj.creatorName,
rmhId: obj.creatorId,
authIcon: obj.authIcon,
authTitle: obj.authTitle,
authTitle2: '',
banControl: 0,
...
...
@@ -546,44 +564,43 @@ export struct SearchResultContentComponent {
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:
0,
cnIsLike:
0,
posterShareControl: 0,
rmhDesc: obj.introduction,
userId: obj.userId,
userType: obj.userType,
honoraryIcon:'',
rmhPlatform:0
honoraryIcon: '',
rmhPlatform: 0
}
if(rem.length>0){
rem.forEach(item=>{
if(item.creatorId === obj.creatorId){
if (rem.length > 0) {
rem.forEach(item => {
if (item.creatorId === obj.creatorId) {
rmhInfo = {
rmhHeadUrl:item.headPhotoUrl,
rmhName:item.userName,
rmhId:item.creatorId,
authIcon:item.authIcon,
rmhHeadUrl: item.headPhotoUrl,
rmhName: item.userName,
rmhId: item.creatorId,
authIcon: item.authIcon,
authTitle: item.authTitle,
authTitle2: '',
banControl: 0,
cnIsAttention:
item.isAttention,
cnIsAttention:
item.isAttention,
cnAttention: 0,
cnlsComment: 0,
cnlsLike: 0,
cnMainControl: 0,
cnShareControl: 0,
cnIsComment: 0,
cnIsLike:
0,
cnIsLike:
0,
posterShareControl: 0,
rmhDesc: item.introduction,
userId: item.userId,
userType: item.userType,
honoraryIcon:'',
rmhPlatform:0
honoraryIcon: '',
rmhPlatform: 0
}
}
})
}
return rmhInfo
}
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment