Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: fix |> 修复搜索页面点击tab没有loading加载效果
Showing
1 changed file
with
90 additions
and
69 deletions
| @@ -30,6 +30,7 @@ import { MoreComponent } from '../cardview/MoreComponent' | @@ -30,6 +30,7 @@ import { MoreComponent } from '../cardview/MoreComponent' | ||
| 30 | import { Card9Component } from '../cardview/Card9Component' | 30 | import { Card9Component } from '../cardview/Card9Component' |
| 31 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | 31 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' |
| 32 | import { EmptyComponent, WDViewDefaultType } from '../view/EmptyComponent' | 32 | import { EmptyComponent, WDViewDefaultType } from '../view/EmptyComponent' |
| 33 | +import { LottieView } from '../../components/lottie/LottieView' | ||
| 33 | 34 | ||
| 34 | const TAG = "SearchResultContentComponent" | 35 | const TAG = "SearchResultContentComponent" |
| 35 | 36 | ||
| @@ -288,92 +289,112 @@ export struct SearchResultContentComponent { | @@ -288,92 +289,112 @@ export struct SearchResultContentComponent { | ||
| 288 | 289 | ||
| 289 | build() { | 290 | build() { |
| 290 | Column() { | 291 | Column() { |
| 291 | - if (this.count == 0) { | ||
| 292 | 292 | ||
| 293 | - EmptyComponent({ | ||
| 294 | - emptyType: WDViewDefaultType.WDViewDefaultType_NoSearchResult, | ||
| 295 | - emptyButton: false, | ||
| 296 | - }).height('70%') | 293 | + // 添加动效refresh |
| 294 | + if (this.isLoading){ | ||
| 295 | + LottieView({ | ||
| 296 | + name: 'refreshing', | ||
| 297 | + path: "lottie/refresh_step2.json", | ||
| 298 | + lottieWidth: 87, | ||
| 299 | + lottieHeight: 87, | ||
| 300 | + autoplay: true, | ||
| 301 | + loop: true | ||
| 302 | + }).margin({top:180}) | ||
| 303 | + }else { | ||
| 304 | + if (this.count == 0) { | ||
| 305 | + EmptyComponent({ | ||
| 306 | + emptyType: WDViewDefaultType.WDViewDefaultType_NoSearchResult, | ||
| 307 | + emptyButton: false, | ||
| 308 | + }).height('70%') | ||
| 297 | 309 | ||
| 298 | - } else { | ||
| 299 | - List({ scroller: this.scroller2 }) { | ||
| 300 | - if (this.data_rmh != null && this.data_rmh.length > 0) { | ||
| 301 | - if (this.data_rmh.length === 1) { | ||
| 302 | - ListItem() { | ||
| 303 | - FollowChildComponent({ data: this.bean, type: 1 ,searchText: decodeURI(this.keywords)}) | ||
| 304 | - }.padding({ left: 10 + 6 , right: 10 + 6}) | ||
| 305 | - } else { | 310 | + } else { |
| 311 | + List({ scroller: this.scroller2 }) { | ||
| 312 | + if (this.data_rmh != null && this.data_rmh.length > 0) { | ||
| 313 | + if (this.data_rmh.length === 1) { | ||
| 314 | + ListItem() { | ||
| 315 | + FollowChildComponent({ data: this.bean, type: 1, searchText: decodeURI(this.keywords) }) | ||
| 316 | + }.padding({ left: 10 + 6, right: 10 + 6 }) | ||
| 317 | + } else { | ||
| 318 | + ListItem() { | ||
| 319 | + Column() { | ||
| 320 | + this.SearchListUI() | ||
| 321 | + } | ||
| 322 | + }.padding({ left: 6, right: 6 }) | ||
| 323 | + } | ||
| 324 | + } | ||
| 325 | + LazyForEach(this.data, (item: ContentDTO, index: number) => { | ||
| 306 | ListItem() { | 326 | ListItem() { |
| 307 | Column() { | 327 | Column() { |
| 308 | - this.SearchListUI() | ||
| 309 | - } | ||
| 310 | - }.padding({left: 6, right: 6}) | ||
| 311 | - } | ||
| 312 | - } | ||
| 313 | - LazyForEach(this.data, (item: ContentDTO, index: number) => { | ||
| 314 | - ListItem() { | ||
| 315 | - Column() { | ||
| 316 | - if (this.searchType == "activity") { | ||
| 317 | - ActivityItemComponent({ contentDTO: item }) | ||
| 318 | - .padding({left: 6, right: 6}) | ||
| 319 | - } else if (item.sameContentListSize > 0) { | ||
| 320 | - MoreComponent({ contentDTO: item , | ||
| 321 | - nextIsAggregateData:(index+1 < this.data.totalCount() && this.data.get(index+1).isAggregateData)}) | ||
| 322 | - } else if (item.appStyle == "9") { | ||
| 323 | - Column(){ | ||
| 324 | - if(item.isAggregateData && index != 0){ | ||
| 325 | - Divider() | ||
| 326 | - .width('100%' ) | ||
| 327 | - .color($r('app.color.color_F5F5F5')) | ||
| 328 | - .strokeWidth(5) | ||
| 329 | - } | 328 | + if (this.searchType == "activity") { |
| 329 | + ActivityItemComponent({ contentDTO: item }) | ||
| 330 | + .padding({ left: 6, right: 6 }) | ||
| 331 | + } else if (item.sameContentListSize > 0) { | ||
| 332 | + MoreComponent({ | ||
| 333 | + contentDTO: item, | ||
| 334 | + nextIsAggregateData: (index + 1 < this.data.totalCount() && | ||
| 335 | + this.data.get(index + 1).isAggregateData) | ||
| 336 | + }) | ||
| 337 | + } else if (item.appStyle == "9") { | ||
| 338 | + Column() { | ||
| 339 | + if (item.isAggregateData && index != 0) { | ||
| 340 | + Divider() | ||
| 341 | + .width('100%') | ||
| 342 | + .color($r('app.color.color_F5F5F5')) | ||
| 343 | + .strokeWidth(5) | ||
| 344 | + } | ||
| 330 | 345 | ||
| 346 | + Column() { | ||
| 347 | + Card9Component({ | ||
| 348 | + compDTO: new CompDTO, | ||
| 349 | + contentDTO: item, | ||
| 350 | + pageId: "", | ||
| 351 | + pageName: "" | ||
| 352 | + }) | ||
| 353 | + Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | ||
| 354 | + } | ||
| 355 | + .padding({ left: 6, right: 6 }) | ||
| 356 | + } | ||
| 357 | + } else { | ||
| 331 | Column() { | 358 | Column() { |
| 332 | - Card9Component({ | 359 | + if (item.isAggregateData && index != 0) { |
| 360 | + Divider() | ||
| 361 | + .width('100%') | ||
| 362 | + .color($r('app.color.color_F5F5F5')) | ||
| 363 | + .strokeWidth(5) | ||
| 364 | + } | ||
| 365 | + CardParser({ | ||
| 333 | compDTO: new CompDTO, | 366 | compDTO: new CompDTO, |
| 334 | contentDTO: item, | 367 | contentDTO: item, |
| 335 | - pageId: "", | ||
| 336 | - pageName: "" | 368 | + isNeedDivider: (index + 1 < this.data.totalCount() && |
| 369 | + this.data.get(index + 1).isAggregateData) ? false : true | ||
| 337 | }) | 370 | }) |
| 338 | - Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 371 | + .padding({ left: 6, right: 6 }) |
| 339 | } | 372 | } |
| 340 | - .padding({left: 6, right: 6}) | ||
| 341 | - } | ||
| 342 | - } else { | ||
| 343 | - Column(){ | ||
| 344 | - if(item.isAggregateData && index != 0){ | ||
| 345 | - Divider() | ||
| 346 | - .width('100%' ) | ||
| 347 | - .color($r('app.color.color_F5F5F5')) | ||
| 348 | - .strokeWidth(5) | ||
| 349 | - } | ||
| 350 | - CardParser({ compDTO: new CompDTO, contentDTO: item ,isNeedDivider: (index+1 < this.data.totalCount() && this.data.get(index+1).isAggregateData) ? false : true}) | ||
| 351 | - .padding({left: 6, right: 6}) | ||
| 352 | - } | ||
| 353 | 373 | ||
| 374 | + } | ||
| 354 | } | 375 | } |
| 355 | } | 376 | } |
| 356 | - } | ||
| 357 | - }, (item: ContentDTO, index: number) => index.toString()) | 377 | + }, (item: ContentDTO, index: number) => index.toString()) |
| 358 | 378 | ||
| 359 | - //没有更多数据 显示提示 | ||
| 360 | - if (!this.hasMore && (this.data.totalCount() > 0 || (this.data_rmh != null && this.data_rmh.length > 0))) { | ||
| 361 | - ListItem() { | ||
| 362 | - ListHasNoMoreDataUI() | 379 | + //没有更多数据 显示提示 |
| 380 | + if (!this.hasMore && (this.data.totalCount() > 0 || (this.data_rmh != null && this.data_rmh.length > 0))) { | ||
| 381 | + ListItem() { | ||
| 382 | + ListHasNoMoreDataUI() | ||
| 383 | + } | ||
| 384 | + .padding({ left: 6, right: 6 }) | ||
| 363 | } | 385 | } |
| 364 | - .padding({left: 6, right: 6}) | ||
| 365 | } | 386 | } |
| 387 | + .cachedCount(5) | ||
| 388 | + .edgeEffect(EdgeEffect.None) | ||
| 389 | + .scrollBar(BarState.Off) | ||
| 390 | + .height('100%') | ||
| 391 | + .onReachEnd(() => { | ||
| 392 | + console.log(TAG, "触底了"); | ||
| 393 | + if (!this.isLoading) { | ||
| 394 | + this.getNewSearchResultData() | ||
| 395 | + } | ||
| 396 | + }) | ||
| 366 | } | 397 | } |
| 367 | - .cachedCount(5) | ||
| 368 | - .edgeEffect(EdgeEffect.None) | ||
| 369 | - .scrollBar(BarState.Off) | ||
| 370 | - .height('100%') | ||
| 371 | - .onReachEnd(() => { | ||
| 372 | - console.log(TAG, "触底了"); | ||
| 373 | - if (!this.isLoading) { | ||
| 374 | - this.getNewSearchResultData() | ||
| 375 | - } | ||
| 376 | - }) | ||
| 377 | } | 398 | } |
| 378 | } | 399 | } |
| 379 | .backgroundColor($r('app.color.white')) | 400 | .backgroundColor($r('app.color.white')) |
-
Please register or login to post a comment