Showing
2 changed files
with
28 additions
and
10 deletions
| @@ -23,25 +23,34 @@ export struct MoreComponent { | @@ -23,25 +23,34 @@ export struct MoreComponent { | ||
| 23 | 23 | ||
| 24 | build() { | 24 | build() { |
| 25 | if (this.showDetail) { | 25 | if (this.showDetail) { |
| 26 | + Column(){ | ||
| 26 | ForEach(this.contentDTO.sameContentList, (item: ContentDTO, index: number) => { | 27 | ForEach(this.contentDTO.sameContentList, (item: ContentDTO, index: number) => { |
| 27 | if (item.appStyle !== "9") { | 28 | if (item.appStyle !== "9") { |
| 28 | - CardParser({compDTO:new CompDTO, contentDTO: item }) | ||
| 29 | - .padding({left: 10, right: 10}) | 29 | + CardParser({compDTO:new CompDTO, contentDTO: item ,isNeedDivider:index === this.contentDTO.sameContentList.length -1 ? false:true}) |
| 30 | + .padding({left: 6, right: 6}) | ||
| 30 | } else { | 31 | } else { |
| 31 | Column(){ | 32 | Column(){ |
| 32 | Card9Component({ compDTO: new CompDTO, contentDTO:item, pageId: "", pageName: "" }) | 33 | Card9Component({ compDTO: new CompDTO, contentDTO:item, pageId: "", pageName: "" }) |
| 33 | 34 | ||
| 35 | + if(index != this.contentDTO.sameContentList.length -1){ | ||
| 34 | Divider() | 36 | Divider() |
| 35 | .width('100%') | 37 | .width('100%') |
| 36 | .color($r('app.color.color_F5F5F5')) | 38 | .color($r('app.color.color_F5F5F5')) |
| 37 | .strokeWidth(4) | 39 | .strokeWidth(4) |
| 38 | } | 40 | } |
| 39 | - .padding({left: 10, right: 10}) | 41 | + } |
| 42 | + .padding({left: 6, right: 6}) | ||
| 40 | } | 43 | } |
| 41 | }) | 44 | }) |
| 42 | 45 | ||
| 46 | + Divider() | ||
| 47 | + .width('100%' ) | ||
| 48 | + .color($r('app.color.color_F5F5F5')) | ||
| 49 | + .strokeWidth(5) | ||
| 50 | + } | ||
| 43 | 51 | ||
| 44 | } else { | 52 | } else { |
| 53 | + Column(){ | ||
| 45 | Column() { | 54 | Column() { |
| 46 | 55 | ||
| 47 | Row() { | 56 | Row() { |
| @@ -60,14 +69,14 @@ export struct MoreComponent { | @@ -60,14 +69,14 @@ export struct MoreComponent { | ||
| 60 | .onClick(() => { | 69 | .onClick(() => { |
| 61 | this.showDetail = true; | 70 | this.showDetail = true; |
| 62 | }) | 71 | }) |
| 72 | + } | ||
| 73 | + .padding({left: 10 + 6 , right: 10 + 6}) | ||
| 74 | + } | ||
| 63 | 75 | ||
| 64 | Divider() | 76 | Divider() |
| 65 | - .width('100%') | 77 | + .width('100%' ) |
| 66 | .color($r('app.color.color_F5F5F5')) | 78 | .color($r('app.color.color_F5F5F5')) |
| 67 | .strokeWidth(5) | 79 | .strokeWidth(5) |
| 68 | - | ||
| 69 | - } | ||
| 70 | - .padding({left: 10, right: 10}) | ||
| 71 | } | 80 | } |
| 72 | 81 | ||
| 73 | 82 | ||
| @@ -75,6 +84,11 @@ export struct MoreComponent { | @@ -75,6 +84,11 @@ export struct MoreComponent { | ||
| 75 | } | 84 | } |
| 76 | 85 | ||
| 77 | dealSearchSameList() { | 86 | dealSearchSameList() { |
| 87 | + //来回返回,会重新触发 dealSearchSameList,如果已经获取过 sameList 不再重新获取 | ||
| 88 | + if(this.contentDTO.sameContentList.length > 0){ | ||
| 89 | + return | ||
| 90 | + } | ||
| 91 | + | ||
| 78 | let resultData : SearchDescription[] = JSON.parse(this.contentDTO.sameContentListJson) as SearchDescription[] | 92 | let resultData : SearchDescription[] = JSON.parse(this.contentDTO.sameContentListJson) as SearchDescription[] |
| 79 | 93 | ||
| 80 | let data: contentListParams = { | 94 | let data: contentListParams = { |
| @@ -283,13 +283,13 @@ export struct SearchResultContentComponent { | @@ -283,13 +283,13 @@ export struct SearchResultContentComponent { | ||
| 283 | if (this.data_rmh.length === 1) { | 283 | if (this.data_rmh.length === 1) { |
| 284 | ListItem() { | 284 | ListItem() { |
| 285 | FollowChildComponent({ data: this.bean, type: 1 ,searchText: decodeURI(this.keywords)}) | 285 | FollowChildComponent({ data: this.bean, type: 1 ,searchText: decodeURI(this.keywords)}) |
| 286 | - }.padding({ left: 10, right: 10 }) | 286 | + }.padding({ left: 10 + 6 , right: 10 + 6}) |
| 287 | } else { | 287 | } else { |
| 288 | ListItem() { | 288 | ListItem() { |
| 289 | Column() { | 289 | Column() { |
| 290 | this.SearchListUI() | 290 | this.SearchListUI() |
| 291 | } | 291 | } |
| 292 | - } | 292 | + }.padding({left: 6, right: 6}) |
| 293 | } | 293 | } |
| 294 | } | 294 | } |
| 295 | LazyForEach(this.data, (item: ContentDTO, index: number) => { | 295 | LazyForEach(this.data, (item: ContentDTO, index: number) => { |
| @@ -297,6 +297,7 @@ export struct SearchResultContentComponent { | @@ -297,6 +297,7 @@ export struct SearchResultContentComponent { | ||
| 297 | Column() { | 297 | Column() { |
| 298 | if (this.searchType == "activity") { | 298 | if (this.searchType == "activity") { |
| 299 | ActivityItemComponent({ contentDTO: item }) | 299 | ActivityItemComponent({ contentDTO: item }) |
| 300 | + .padding({left: 6, right: 6}) | ||
| 300 | } else if (item.sameContentListSize > 0) { | 301 | } else if (item.sameContentListSize > 0) { |
| 301 | MoreComponent({ contentDTO: item }) | 302 | MoreComponent({ contentDTO: item }) |
| 302 | } else if (item.appStyle == "9") { | 303 | } else if (item.appStyle == "9") { |
| @@ -309,8 +310,10 @@ export struct SearchResultContentComponent { | @@ -309,8 +310,10 @@ export struct SearchResultContentComponent { | ||
| 309 | }) | 310 | }) |
| 310 | Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) | 311 | Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 }) |
| 311 | } | 312 | } |
| 313 | + .padding({left: 6, right: 6}) | ||
| 312 | } else { | 314 | } else { |
| 313 | CardParser({ compDTO: new CompDTO, contentDTO: item }) | 315 | CardParser({ compDTO: new CompDTO, contentDTO: item }) |
| 316 | + .padding({left: 6, right: 6}) | ||
| 314 | } | 317 | } |
| 315 | } | 318 | } |
| 316 | } | 319 | } |
| @@ -321,6 +324,7 @@ export struct SearchResultContentComponent { | @@ -321,6 +324,7 @@ export struct SearchResultContentComponent { | ||
| 321 | ListItem() { | 324 | ListItem() { |
| 322 | ListHasNoMoreDataUI() | 325 | ListHasNoMoreDataUI() |
| 323 | } | 326 | } |
| 327 | + .padding({left: 6, right: 6}) | ||
| 324 | } | 328 | } |
| 325 | } | 329 | } |
| 326 | .cachedCount(5) | 330 | .cachedCount(5) |
| @@ -338,7 +342,7 @@ export struct SearchResultContentComponent { | @@ -338,7 +342,7 @@ export struct SearchResultContentComponent { | ||
| 338 | .backgroundColor($r('app.color.white')) | 342 | .backgroundColor($r('app.color.white')) |
| 339 | .height('100%') | 343 | .height('100%') |
| 340 | .width('100%') | 344 | .width('100%') |
| 341 | - .padding({left: 6, right: 6}) | 345 | + |
| 342 | } | 346 | } |
| 343 | 347 | ||
| 344 | @Builder | 348 | @Builder |
-
Please register or login to post a comment