Showing
2 changed files
with
273 additions
and
158 deletions
| 1 | import { SpConstants } from 'wdConstant/Index' | 1 | import { SpConstants } from 'wdConstant/Index' |
| 2 | -import { DateTimeUtils, SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' | 2 | +import { SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' |
| 3 | import { HttpUtils } from 'wdNetwork/Index' | 3 | import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | 4 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' |
| 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| @@ -116,9 +116,14 @@ export struct FollowChildComponent{ | @@ -116,9 +116,14 @@ export struct FollowChildComponent{ | ||
| 116 | }.height('202lpx') | 116 | }.height('202lpx') |
| 117 | .justifyContent(FlexAlign.Start) | 117 | .justifyContent(FlexAlign.Start) |
| 118 | 118 | ||
| 119 | - Text().backgroundColor($r('app.color.color_EDEDED')) | 119 | + // Text().backgroundColor($r('app.color.color_EDEDED')) |
| 120 | + // .width('100%') | ||
| 121 | + // .height('2lpx') | ||
| 122 | + Divider() | ||
| 120 | .width('100%') | 123 | .width('100%') |
| 121 | .height('2lpx') | 124 | .height('2lpx') |
| 125 | + .color($r('app.color.color_F5F5F5')) | ||
| 126 | + .strokeWidth('1lpx') | ||
| 122 | }.width('100%') | 127 | }.width('100%') |
| 123 | 128 | ||
| 124 | }else { | 129 | }else { |
| @@ -230,9 +235,15 @@ export struct FollowChildComponent{ | @@ -230,9 +235,15 @@ export struct FollowChildComponent{ | ||
| 230 | }.height('146lpx') | 235 | }.height('146lpx') |
| 231 | .justifyContent(FlexAlign.Center) | 236 | .justifyContent(FlexAlign.Center) |
| 232 | 237 | ||
| 233 | - Text().backgroundColor($r('app.color.color_EDEDED')) | 238 | + // Text().backgroundColor($r('app.color.color_EDEDED')) |
| 239 | + // .width('100%') | ||
| 240 | + // .height('2lpx') | ||
| 241 | + | ||
| 242 | + Divider() | ||
| 234 | .width('100%') | 243 | .width('100%') |
| 235 | .height('2lpx') | 244 | .height('2lpx') |
| 245 | + .color($r('app.color.color_F5F5F5')) | ||
| 246 | + .strokeWidth('1lpx') | ||
| 236 | }.width('100%') | 247 | }.width('100%') |
| 237 | 248 | ||
| 238 | } | 249 | } |
| @@ -255,12 +266,6 @@ export struct FollowChildComponent{ | @@ -255,12 +266,6 @@ export struct FollowChildComponent{ | ||
| 255 | this.data.status = this.data.status ==="0"?"1":"0" | 266 | this.data.status = this.data.status ==="0"?"1":"0" |
| 256 | 267 | ||
| 257 | UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status) | 268 | UserDataLocal.setUserFollowOperation(this.data.creatorId+","+this.data.status) |
| 258 | - | ||
| 259 | - // if(this.data.status === "1"){ | ||
| 260 | - // UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+"") | ||
| 261 | - // }else{ | ||
| 262 | - // UserDataLocal.setUserFollowOperation(DateTimeUtils.getTimeStamp()+","+this.data.creatorId) | ||
| 263 | - // } | ||
| 264 | } | 269 | } |
| 265 | } | 270 | } |
| 266 | }) | 271 | }) |
| 1 | -import { ContentDTO, | 1 | +import { |
| 2 | + ContentDTO, | ||
| 2 | contentListParams, | 3 | contentListParams, |
| 3 | - FullColumnImgUrlDTO, InteractDataDTO, | 4 | + FullColumnImgUrlDTO, |
| 5 | + InteractDataDTO, | ||
| 4 | Params, | 6 | Params, |
| 5 | - RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index' | 7 | + RmhInfoDTO, |
| 8 | + VideoInfoDTO | ||
| 9 | +} from 'wdBean/Index' | ||
| 6 | import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' | 10 | import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' |
| 7 | import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' | 11 | import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' |
| 8 | -import { LazyDataSource, Logger, StringUtils, ToastUtils } from 'wdKit/Index' | 12 | +import { LazyDataSource, Logger, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' |
| 9 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 13 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 14 | +import MinePageDatasModel from '../../model/MinePageDatasModel' | ||
| 10 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 15 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 11 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' | 16 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' |
| 17 | +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem' | ||
| 18 | +import { FollowListStatusRequestItem } from '../../viewmodel/FollowListStatusRequestItem' | ||
| 19 | +import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' | ||
| 12 | import { SearchResultContentData } from '../../viewmodel/SearchResultContentData' | 20 | import { SearchResultContentData } from '../../viewmodel/SearchResultContentData' |
| 13 | import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' | 21 | import { SearchResultContentItem, SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' |
| 14 | import { CardParser } from '../CardParser' | 22 | import { CardParser } from '../CardParser' |
| 23 | +import { FollowChildComponent } from '../mine/follow/FollowChildComponent' | ||
| 15 | import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' | 24 | import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' |
| 16 | import { ActivityItemComponent } from './ActivityItemComponent' | 25 | import { ActivityItemComponent } from './ActivityItemComponent' |
| 17 | import { SearchCreatorComponent } from './SearchCreatorComponent' | 26 | import { SearchCreatorComponent } from './SearchCreatorComponent' |
| @@ -19,27 +28,28 @@ import { SearchCreatorComponent } from './SearchCreatorComponent' | @@ -19,27 +28,28 @@ import { SearchCreatorComponent } from './SearchCreatorComponent' | ||
| 19 | const TAG = "SearchResultContentComponent" | 28 | const TAG = "SearchResultContentComponent" |
| 20 | 29 | ||
| 21 | @Component | 30 | @Component |
| 22 | -export struct SearchResultContentComponent{ | ||
| 23 | - @State keywords:string = "" | ||
| 24 | - @State searchType:string = "" | 31 | +export struct SearchResultContentComponent { |
| 32 | + @State keywords: string = "" | ||
| 33 | + @State searchType: string = "" | ||
| 25 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | 34 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 26 | @State data_rmh: SearchRmhDescription[] = [] | 35 | @State data_rmh: SearchRmhDescription[] = [] |
| 27 | - @State count:number = -1; | ||
| 28 | - @State isLoading:boolean = false | ||
| 29 | - @State hasMore:boolean = true | ||
| 30 | - curPageNum:number = 1; | ||
| 31 | - | 36 | + @State count: number = -1; |
| 37 | + @State isLoading: boolean = false | ||
| 38 | + @State hasMore: boolean = true | ||
| 39 | + curPageNum: number = 1; | ||
| 40 | + @State bean: FollowListDetailItem = new FollowListDetailItem("", "", "", "", "", "", "", "", "", -1, -1, "") | ||
| 41 | + scroller: Scroller = new Scroller() | ||
| 32 | 42 | ||
| 33 | aboutToAppear(): void { | 43 | aboutToAppear(): void { |
| 34 | - if(this.searchType == "全部"){ | 44 | + if (this.searchType == "全部") { |
| 35 | this.searchType = "all" | 45 | this.searchType = "all" |
| 36 | - }else if(this.searchType == "精选"){ | 46 | + } else if (this.searchType == "精选") { |
| 37 | this.searchType = "cms" | 47 | this.searchType = "cms" |
| 38 | - }else if(this.searchType == "人民号"){ | 48 | + } else if (this.searchType == "人民号") { |
| 39 | this.searchType = "rmh" | 49 | this.searchType = "rmh" |
| 40 | - }else if(this.searchType == "视频"){ | 50 | + } else if (this.searchType == "视频") { |
| 41 | this.searchType = "video" | 51 | this.searchType = "video" |
| 42 | - }else if(this.searchType == "活动"){ | 52 | + } else if (this.searchType == "活动") { |
| 43 | this.searchType = "activity" | 53 | this.searchType = "activity" |
| 44 | } | 54 | } |
| 45 | 55 | ||
| @@ -47,93 +57,135 @@ export struct SearchResultContentComponent{ | @@ -47,93 +57,135 @@ export struct SearchResultContentComponent{ | ||
| 47 | this.getNewSearchResultData() | 57 | this.getNewSearchResultData() |
| 48 | } | 58 | } |
| 49 | 59 | ||
| 50 | - getNewSearchResultData(){ | 60 | + getNewSearchResultData() { |
| 51 | this.isLoading = true | 61 | this.isLoading = true |
| 52 | - if(this.hasMore){ | ||
| 53 | - SearcherAboutDataModel.getSearchResultListData("10",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{ | ||
| 54 | - if (!this.data || value.list.length == 0){ | 62 | + if (this.hasMore) { |
| 63 | + SearcherAboutDataModel.getSearchResultListData("15", `${this.curPageNum}`, this.searchType, this.keywords, | ||
| 64 | + getContext(this)).then((value) => { | ||
| 65 | + if (!this.data || value.list.length == 0) { | ||
| 55 | this.hasMore = false | 66 | this.hasMore = false |
| 56 | this.isLoading = false | 67 | this.isLoading = false |
| 57 | - this.count = this.count===-1?0:this.count | ||
| 58 | - }else{ | ||
| 59 | - if(value.list[0].dataList!=null){ | 68 | + this.count = this.count === -1 ? 0 : this.count |
| 69 | + } else { | ||
| 70 | + if (value.list[0].dataList != null) { | ||
| 60 | let data_temp: SearchRmhDescription[] = [] | 71 | let data_temp: SearchRmhDescription[] = [] |
| 72 | + | ||
| 61 | data_temp = value.list[0].dataList | 73 | data_temp = value.list[0].dataList |
| 62 | 74 | ||
| 63 | //TODO 查询创作者详情接口 | 75 | //TODO 查询创作者详情接口 |
| 64 | let request = new CreatorDetailRequestItem() | 76 | let request = new CreatorDetailRequestItem() |
| 65 | 77 | ||
| 66 | - data_temp.forEach((data)=>{ | 78 | + data_temp.forEach((data) => { |
| 67 | request.creatorIdList.push(data.creatorId) | 79 | request.creatorIdList.push(data.creatorId) |
| 68 | }) | 80 | }) |
| 69 | 81 | ||
| 70 | - SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{ | ||
| 71 | - if(value!=null && value.length>0){ | ||
| 72 | - data_temp.forEach((data)=>{ | ||
| 73 | - value.forEach((item)=>{ | ||
| 74 | - if(data.creatorId == item.creatorId){ | 82 | + SearcherAboutDataModel.getCreatorDetailListData(request).then((value) => { |
| 83 | + if (value != null && value.length > 0) { | ||
| 84 | + data_temp.forEach((data) => { | ||
| 85 | + value.forEach((item) => { | ||
| 86 | + if (data.creatorId == item.creatorId) { | ||
| 75 | data.headerPhotoUrl = item.headPhotoUrl.split("?")[0] | 87 | data.headerPhotoUrl = item.headPhotoUrl.split("?")[0] |
| 76 | - data.mainControl = item.mainControl+"" | 88 | + data.mainControl = item.mainControl + "" |
| 89 | + | ||
| 90 | + if(data_temp.length === 1){ | ||
| 91 | + this.bean.headPhotoUrl = item.headPhotoUrl.split("?")[0] | ||
| 92 | + this.bean.cnUserName = item.userName | ||
| 93 | + this.bean.creatorId = item.creatorId | ||
| 94 | + this.bean.authIcon = item.authIcon | ||
| 95 | + | ||
| 96 | + if (value[0].fansNum > 10000) { | ||
| 97 | + let temp = (value[0].fansNum / 10000) + "" | ||
| 98 | + let index = temp.indexOf('.') | ||
| 99 | + if (index != -1) { | ||
| 100 | + temp = temp.substring(0, index + 2) | ||
| 101 | + } else { | ||
| 102 | + temp = temp | ||
| 103 | + } | ||
| 104 | + this.bean.cnFansNum = temp + "万" | ||
| 105 | + } else { | ||
| 106 | + this.bean.cnFansNum = item.fansNum + "" | ||
| 107 | + } | ||
| 108 | + this.bean.introduction = item.introduction | ||
| 109 | + this.bean.mainControl = item.mainControl | ||
| 110 | + this.bean.banControl = item.banControl | ||
| 111 | + this.bean.cnUserType = item.userType | ||
| 112 | + this.bean.cnUserId = item.userId | ||
| 113 | + } | ||
| 77 | } | 114 | } |
| 78 | }) | 115 | }) |
| 79 | }) | 116 | }) |
| 80 | } | 117 | } |
| 81 | - data_temp.forEach((data)=>{ | 118 | + data_temp.forEach((data) => { |
| 82 | this.data_rmh.push(data) | 119 | this.data_rmh.push(data) |
| 83 | }) | 120 | }) |
| 84 | 121 | ||
| 85 | - }).catch((err:Error)=>{ | ||
| 86 | - console.log(TAG,JSON.stringify(err)) | 122 | + //只有一条创作者,获取 创作者信息 |
| 123 | + if (this.data_rmh.length === 1) { | ||
| 124 | + if(StringUtils.isNotEmpty(UserDataLocal.getUserId())){ | ||
| 125 | + //查询是否被关注 | ||
| 126 | + let status = new FollowListStatusRequestItem() | ||
| 127 | + status.creatorIds.push(new QueryListIsFollowedItem(this.data_rmh[0].creatorId)) | ||
| 128 | + MinePageDatasModel.getFollowListStatusData(status, getContext(this)).then((newValue) => { | ||
| 129 | + this.bean.status = newValue[0].status | ||
| 130 | + }).catch((err: Error) => { | ||
| 131 | + console.log(TAG, "请求失败") | ||
| 132 | + }) | ||
| 133 | + }else{ | ||
| 134 | + this.bean.status = "" | ||
| 135 | + } | ||
| 136 | + } | ||
| 137 | + }).catch((err: Error) => { | ||
| 138 | + console.log(TAG, JSON.stringify(err)) | ||
| 87 | }) | 139 | }) |
| 88 | } | 140 | } |
| 89 | this.getInteractData(value) | 141 | this.getInteractData(value) |
| 90 | } | 142 | } |
| 91 | - }).catch((err:Error)=>{ | ||
| 92 | - console.log(TAG,JSON.stringify(err)) | 143 | + }).catch((err: Error) => { |
| 144 | + console.log(TAG, JSON.stringify(err)) | ||
| 93 | this.isLoading = false | 145 | this.isLoading = false |
| 94 | - this.count = this.count===-1?0:this.count | 146 | + this.count = this.count === -1 ? 0 : this.count |
| 95 | }) | 147 | }) |
| 96 | } | 148 | } |
| 97 | } | 149 | } |
| 98 | 150 | ||
| 99 | - getInteractData(resultData:SearchResultContentData){ | ||
| 100 | - if(resultData.list[0].dataList!=null){ | ||
| 101 | - resultData.list.splice(0,1) | 151 | + getInteractData(resultData: SearchResultContentData) { |
| 152 | + if (resultData.list[0].dataList != null) { | ||
| 153 | + resultData.list.splice(0, 1) | ||
| 102 | } | 154 | } |
| 103 | 155 | ||
| 104 | - let data : contentListParams = { | 156 | + let data: contentListParams = { |
| 105 | contentList: [] | 157 | contentList: [] |
| 106 | } | 158 | } |
| 107 | - resultData.list.forEach((item)=>{ | 159 | + resultData.list.forEach((item) => { |
| 108 | data.contentList.push({ | 160 | data.contentList.push({ |
| 109 | contentId: item.data.id + '', | 161 | contentId: item.data.id + '', |
| 110 | contentType: Number.parseInt(item.data.type) | 162 | contentType: Number.parseInt(item.data.type) |
| 111 | }) | 163 | }) |
| 112 | }) | 164 | }) |
| 113 | 165 | ||
| 114 | - SearcherAboutDataModel.getInteractListData(data,getContext(this)).then((newValue)=>{ | ||
| 115 | - newValue.forEach((item)=>{ | ||
| 116 | - resultData.list.forEach((data)=>{ | 166 | + SearcherAboutDataModel.getInteractListData(data, getContext(this)).then((newValue) => { |
| 167 | + newValue.forEach((item) => { | ||
| 168 | + resultData.list.forEach((data) => { | ||
| 117 | if (item.contentId == data.data.id) { | 169 | if (item.contentId == data.data.id) { |
| 118 | - data.data.collectNum = item.collectNum+"" | ||
| 119 | - data.data.commentNum = item.commentNum+"" | ||
| 120 | - data.data.likeNum = item.likeNum+"" | ||
| 121 | - data.data.readNum = item.readNum+"" | ||
| 122 | - data.data.shareNum = item.shareNum+"" | 170 | + data.data.collectNum = item.collectNum + "" |
| 171 | + data.data.commentNum = item.commentNum + "" | ||
| 172 | + data.data.likeNum = item.likeNum + "" | ||
| 173 | + data.data.readNum = item.readNum + "" | ||
| 174 | + data.data.shareNum = item.shareNum + "" | ||
| 123 | } | 175 | } |
| 124 | }) | 176 | }) |
| 125 | }) | 177 | }) |
| 126 | 178 | ||
| 127 | - resultData.list.forEach((value)=>{ | ||
| 128 | - let photos:FullColumnImgUrlDTO[] = [] | ||
| 129 | - if(value.data.appStyle === 4){ | ||
| 130 | - value.data.appStyleImages.split("&&").forEach((value)=>{ | ||
| 131 | - photos.push({url:value} as FullColumnImgUrlDTO) | 179 | + resultData.list.forEach((value) => { |
| 180 | + let photos: FullColumnImgUrlDTO[] = [] | ||
| 181 | + if (value.data.appStyle === 4) { | ||
| 182 | + value.data.appStyleImages.split("&&").forEach((value) => { | ||
| 183 | + photos.push({ url: value } as FullColumnImgUrlDTO) | ||
| 132 | }) | 184 | }) |
| 133 | } | 185 | } |
| 134 | 186 | ||
| 135 | - let contentDTO = this.dataTransform(value,photos); | ||
| 136 | - if(contentDTO.appStyle != "13"){ | 187 | + let contentDTO = this.dataTransform(value, photos); |
| 188 | + if (contentDTO.appStyle != "13") { | ||
| 137 | this.data.push(contentDTO) | 189 | this.data.push(contentDTO) |
| 138 | } | 190 | } |
| 139 | 191 | ||
| @@ -142,131 +194,189 @@ export struct SearchResultContentComponent{ | @@ -142,131 +194,189 @@ export struct SearchResultContentComponent{ | ||
| 142 | this.count = this.data.totalCount() | 194 | this.count = this.data.totalCount() |
| 143 | if (this.data.totalCount() < resultData.totalCount) { | 195 | if (this.data.totalCount() < resultData.totalCount) { |
| 144 | this.curPageNum++ | 196 | this.curPageNum++ |
| 145 | - }else { | 197 | + } else { |
| 146 | this.hasMore = false | 198 | this.hasMore = false |
| 147 | } | 199 | } |
| 148 | this.isLoading = false | 200 | this.isLoading = false |
| 149 | 201 | ||
| 150 | - if(this.count === 0 && resultData.list.length > 0){ | 202 | + if (this.count === 0 && resultData.list.length > 0) { |
| 151 | this.count = -1 | 203 | this.count = -1 |
| 152 | - if(!this.isLoading){ | 204 | + if (!this.isLoading) { |
| 153 | //加载分页数据 | 205 | //加载分页数据 |
| 154 | this.getNewSearchResultData() | 206 | this.getNewSearchResultData() |
| 155 | } | 207 | } |
| 156 | - }else if(this.count <= 20 && resultData.list.length > 0){ | ||
| 157 | - if(!this.isLoading){ | 208 | + } else if (this.count <= 10 && resultData.list.length > 0) { |
| 209 | + if (!this.isLoading) { | ||
| 158 | //加载分页数据 | 210 | //加载分页数据 |
| 159 | this.getNewSearchResultData() | 211 | this.getNewSearchResultData() |
| 160 | } | 212 | } |
| 161 | } | 213 | } |
| 162 | - }).catch((err:Error)=>{ | ||
| 163 | - console.log(TAG,"请求失败") | 214 | + }).catch((err: Error) => { |
| 215 | + console.log(TAG, "请求失败") | ||
| 164 | this.isLoading = false | 216 | this.isLoading = false |
| 165 | - this.count = this.count===-1?0:this.count | 217 | + this.count = this.count === -1 ? 0 : this.count |
| 166 | }) | 218 | }) |
| 167 | } | 219 | } |
| 168 | 220 | ||
| 169 | build() { | 221 | build() { |
| 170 | Column() { | 222 | Column() { |
| 171 | - if(this.count == 0){ | ||
| 172 | - ListHasNoMoreDataUI({style:2}) | ||
| 173 | - }else{ | ||
| 174 | - Column(){ | ||
| 175 | - if (this.data_rmh!=null && this.data_rmh.length > 0) { | ||
| 176 | - //List | ||
| 177 | - List({space:'8lpx'}) { | ||
| 178 | - ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { | ||
| 179 | - ListItem() { | ||
| 180 | - SearchCreatorComponent({item:item}) | ||
| 181 | - }.onClick(()=>{ | ||
| 182 | - //TODO 跳转 | ||
| 183 | - }) | ||
| 184 | - .width('150lpx') | ||
| 185 | - .height('100%') | ||
| 186 | - }) | ||
| 187 | - | 223 | + if (this.count == 0) { |
| 224 | + ListHasNoMoreDataUI({ style: 2 }) | ||
| 225 | + } else { | ||
| 226 | + List() { | ||
| 227 | + if (this.data_rmh != null && this.data_rmh.length > 0){ | ||
| 228 | + if (this.data_rmh.length === 1){ | ||
| 229 | + ListItem(){ | ||
| 230 | + FollowChildComponent({ data: this.bean, type: 1 }) | ||
| 231 | + }.padding({left:"31lpx",right:"31lpx"}) | ||
| 232 | + }else{ | ||
| 188 | ListItem(){ | 233 | ListItem(){ |
| 189 | Column(){ | 234 | Column(){ |
| 190 | - Text("查看更多") | ||
| 191 | - .width('19lpx') | ||
| 192 | - .fontSize('19lpx') | ||
| 193 | - .fontWeight('400lpx') | ||
| 194 | - .lineHeight('27lpx') | ||
| 195 | - .fontColor($r('app.color.color_9E9E9E')) | ||
| 196 | - }.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'}) | ||
| 197 | - .height('180lpx') | ||
| 198 | - .width('77lpx') | ||
| 199 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 200 | - .justifyContent(FlexAlign.Center) | ||
| 201 | - | ||
| 202 | - }.height('100%') | ||
| 203 | - .margin({left:'23lpx'}) | ||
| 204 | - .onClick(()=>{ | ||
| 205 | - let params: Params = { | ||
| 206 | - pageID: this.keywords | 235 | + this.SearchListUI() |
| 207 | } | 236 | } |
| 208 | - WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params) | ||
| 209 | - }) | 237 | + } |
| 210 | } | 238 | } |
| 211 | - .cachedCount(6) | ||
| 212 | - .edgeEffect(EdgeEffect.Spring) | ||
| 213 | - .scrollBar(BarState.Off) | ||
| 214 | - .listDirection(Axis.Horizontal) | ||
| 215 | - .width('100%') | ||
| 216 | - .height('219lpx') | ||
| 217 | - | ||
| 218 | - Divider() | ||
| 219 | - .width('100%') | ||
| 220 | - .height('12lpx') | ||
| 221 | - .color($r('app.color.color_F5F5F5')) | ||
| 222 | - .strokeWidth('12lpx') | ||
| 223 | } | 239 | } |
| 224 | - //List | ||
| 225 | - List({ space: '6lpx' }) { | ||
| 226 | - LazyForEach(this.data, (item: ContentDTO, index: number) => { | ||
| 227 | - ListItem() { | ||
| 228 | - Column(){ | ||
| 229 | - if(this.searchType == "activity"){ | ||
| 230 | - ActivityItemComponent({contentDTO:item}) | ||
| 231 | - }else{ | ||
| 232 | - CardParser({contentDTO:item}) | ||
| 233 | - } | ||
| 234 | - if(index != this.data.totalCount()-1 ){ | ||
| 235 | - Divider() | ||
| 236 | - .width('100%') | ||
| 237 | - .height('1lpx') | ||
| 238 | - .color($r('app.color.color_F5F5F5')) | ||
| 239 | - .strokeWidth('1lpx') | ||
| 240 | - } | 240 | + LazyForEach(this.data, (item: ContentDTO, index: number) => { |
| 241 | + ListItem() { | ||
| 242 | + Column() { | ||
| 243 | + if (this.searchType == "activity") { | ||
| 244 | + ActivityItemComponent({ contentDTO: item }) | ||
| 245 | + } else { | ||
| 246 | + CardParser({ contentDTO: item }) | ||
| 247 | + } | ||
| 248 | + if (index != this.data.totalCount() - 1) { | ||
| 249 | + Divider() | ||
| 250 | + .width('100%') | ||
| 251 | + .height('1lpx') | ||
| 252 | + .color($r('app.color.color_F5F5F5')) | ||
| 253 | + .strokeWidth('1lpx') | ||
| 241 | } | 254 | } |
| 242 | - } | ||
| 243 | - }, (item: ContentDTO, index: number) => index.toString()) | ||
| 244 | - | ||
| 245 | - //没有更多数据 显示提示 | ||
| 246 | - if(!this.hasMore && this.data.totalCount() > 0){ | ||
| 247 | - ListItem(){ | ||
| 248 | - ListHasNoMoreDataUI() | ||
| 249 | } | 255 | } |
| 250 | } | 256 | } |
| 251 | - }.cachedCount(6) | ||
| 252 | - .edgeEffect(EdgeEffect.None) | ||
| 253 | - .scrollBar(BarState.Off) | ||
| 254 | - .layoutWeight(1) | ||
| 255 | - .onReachEnd(()=>{ | ||
| 256 | - console.log(TAG,"触底了"); | ||
| 257 | - if(!this.isLoading){ | ||
| 258 | - //加载分页数据 | ||
| 259 | - this.getNewSearchResultData() | 257 | + }, (item: ContentDTO, index: number) => index.toString()) |
| 258 | + | ||
| 259 | + //没有更多数据 显示提示 | ||
| 260 | + if (!this.hasMore && this.data.totalCount() > 0) { | ||
| 261 | + ListItem() { | ||
| 262 | + ListHasNoMoreDataUI() | ||
| 260 | } | 263 | } |
| 261 | - }) | ||
| 262 | - }.layoutWeight(1) | 264 | + } |
| 265 | + }.cachedCount(10) | ||
| 266 | + .edgeEffect(EdgeEffect.None) | ||
| 267 | + .scrollBar(BarState.Off) | ||
| 268 | + .onReachEnd(() => { | ||
| 269 | + console.log(TAG, "触底了"); | ||
| 270 | + if (!this.isLoading) { | ||
| 271 | + //加载分页数据 | ||
| 272 | + this.getNewSearchResultData() | ||
| 273 | + } | ||
| 274 | + }) | ||
| 263 | } | 275 | } |
| 264 | } | 276 | } |
| 265 | .backgroundColor($r('app.color.white')) | 277 | .backgroundColor($r('app.color.white')) |
| 266 | - .layoutWeight(1) | ||
| 267 | .width('100%') | 278 | .width('100%') |
| 268 | } | 279 | } |
| 269 | 280 | ||
| 281 | + @Builder | ||
| 282 | + multiCreatorUI() { | ||
| 283 | + Column() { | ||
| 284 | + List() { | ||
| 285 | + ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { | ||
| 286 | + ListItem() { | ||
| 287 | + SearchCreatorComponent({ item: item }) | ||
| 288 | + } | ||
| 289 | + .width('150lpx') | ||
| 290 | + .height('100%') | ||
| 291 | + }) | ||
| 292 | + | ||
| 293 | + ListItem() { | ||
| 294 | + Column() { | ||
| 295 | + Text("查看更多") | ||
| 296 | + .width('19lpx') | ||
| 297 | + .fontSize('19lpx') | ||
| 298 | + .fontWeight('400lpx') | ||
| 299 | + .lineHeight('27lpx') | ||
| 300 | + .fontColor($r('app.color.color_9E9E9E')) | ||
| 301 | + } | ||
| 302 | + .borderRadius({ topLeft: '4lpx', bottomLeft: '4lpx' }) | ||
| 303 | + .height('180lpx') | ||
| 304 | + .width('77lpx') | ||
| 305 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 306 | + .justifyContent(FlexAlign.Center) | ||
| 307 | + | ||
| 308 | + }.height('100%') | ||
| 309 | + .margin({ left: '23lpx' }) | ||
| 310 | + .onClick(() => { | ||
| 311 | + let params: Params = { | ||
| 312 | + pageID: this.keywords | ||
| 313 | + } | ||
| 314 | + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage, params) | ||
| 315 | + }) | ||
| 316 | + } | ||
| 317 | + .cachedCount(6) | ||
| 318 | + .edgeEffect(EdgeEffect.None) | ||
| 319 | + .scrollBar(BarState.Off) | ||
| 320 | + .listDirection(Axis.Horizontal) | ||
| 321 | + .width('100%') | ||
| 322 | + .height('219lpx') | ||
| 323 | + | ||
| 324 | + Divider() | ||
| 325 | + .width('100%') | ||
| 326 | + .height('12lpx') | ||
| 327 | + .color($r('app.color.color_F5F5F5')) | ||
| 328 | + .strokeWidth('12lpx') | ||
| 329 | + } | ||
| 330 | + } | ||
| 331 | + | ||
| 332 | + @Builder | ||
| 333 | + SearchListUI() { | ||
| 334 | + List({space:'8lpx'}) { | ||
| 335 | + ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { | ||
| 336 | + ListItem() { | ||
| 337 | + SearchCreatorComponent({item:item}) | ||
| 338 | + } | ||
| 339 | + .width('150lpx') | ||
| 340 | + .height('100%') | ||
| 341 | + }) | ||
| 342 | + | ||
| 343 | + ListItem(){ | ||
| 344 | + Column(){ | ||
| 345 | + Text("查看更多") | ||
| 346 | + .width('19lpx') | ||
| 347 | + .fontSize('19lpx') | ||
| 348 | + .fontWeight('400lpx') | ||
| 349 | + .lineHeight('27lpx') | ||
| 350 | + .fontColor($r('app.color.color_9E9E9E')) | ||
| 351 | + }.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'}) | ||
| 352 | + .height('180lpx') | ||
| 353 | + .width('77lpx') | ||
| 354 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 355 | + .justifyContent(FlexAlign.Center) | ||
| 356 | + | ||
| 357 | + }.height('100%') | ||
| 358 | + .margin({left:'23lpx'}) | ||
| 359 | + .onClick(()=>{ | ||
| 360 | + let params: Params = { | ||
| 361 | + pageID: this.keywords | ||
| 362 | + } | ||
| 363 | + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params) | ||
| 364 | + }) | ||
| 365 | + } | ||
| 366 | + .cachedCount(6) | ||
| 367 | + .edgeEffect(EdgeEffect.None) | ||
| 368 | + .scrollBar(BarState.Off) | ||
| 369 | + .listDirection(Axis.Horizontal) | ||
| 370 | + .width('100%') | ||
| 371 | + .height('219lpx') | ||
| 372 | + | ||
| 373 | + Divider() | ||
| 374 | + .width('100%') | ||
| 375 | + .height('12lpx') | ||
| 376 | + .color($r('app.color.color_F5F5F5')) | ||
| 377 | + .strokeWidth('12lpx') | ||
| 378 | + } | ||
| 379 | + | ||
| 270 | private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { | 380 | private dataTransform(value: SearchResultContentItem, photos: FullColumnImgUrlDTO[]): ContentDTO { |
| 271 | let contentDTO = new ContentDTO(); | 381 | let contentDTO = new ContentDTO(); |
| 272 | contentDTO.appStyle = value.data.appStyle + "" | 382 | contentDTO.appStyle = value.data.appStyle + "" |
-
Please register or login to post a comment