陈剑华

feat: 17158 搜索结果页-点击展开更多相似功能缺失

1 /** 1 /**
2 * More_Comp 2 * More_Comp
3 */ 3 */
4 -import { ContentDTO , contentListParams, FullColumnImgUrlDTO, 4 +import { ContentDTO , contentListParams, FullColumnImgUrlDTO, CompDTO
5 } from 'wdBean/Index'; 5 } from 'wdBean/Index';
6 import MinePageDatasModel from '../../model/MinePageDatasModel'; 6 import MinePageDatasModel from '../../model/MinePageDatasModel';
7 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'; 7 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel';
8 import { SearchDescription } from '../../viewmodel/SearchResultContentItem'; 8 import { SearchDescription } from '../../viewmodel/SearchResultContentItem';
  9 +import { CardParser } from '../CardParser'
9 10
10 const TAG: string = 'More_Comp'; 11 const TAG: string = 'More_Comp';
11 12
@@ -13,26 +14,54 @@ const TAG: string = 'More_Comp'; @@ -13,26 +14,54 @@ const TAG: string = 'More_Comp';
13 @Component 14 @Component
14 export struct MoreComponent { 15 export struct MoreComponent {
15 @State contentDTO: ContentDTO = new ContentDTO(); 16 @State contentDTO: ContentDTO = new ContentDTO();
  17 + @State showDetail: boolean = false;
16 18
17 aboutToAppear(): void { 19 aboutToAppear(): void {
18 this.dealSearchSameList() 20 this.dealSearchSameList()
19 } 21 }
20 22
21 build() { 23 build() {
22 - Row() {  
23 - Text('点击展开更多相似')  
24 - .fontSize(16)  
25 - Text(`(${this.contentDTO.sameContentListSize})`)  
26 - .fontSize(16)  
27 - Image($r('app.media.comment_unfold'))  
28 - .width(16)  
29 - .height(16) 24 + if (this.showDetail) {
  25 + ForEach(this.contentDTO.sameContentList, (item: ContentDTO, index: number) => {
  26 + CardParser({compDTO:new CompDTO, contentDTO: item })
  27 + })
  28 + } else {
  29 + Column() {
  30 +
  31 + Divider()
  32 + .width('100%')
  33 + .height(10)
  34 + .color($r('app.color.color_F5F5F5'))
  35 + .strokeWidth('1lpx')
  36 +
  37 + Row() {
  38 + Text('点击展开更多相似')
  39 + .fontSize(16)
  40 + Text(`(${this.contentDTO.sameContentListSize})`)
  41 + .fontSize(16)
  42 + Image($r('app.media.comment_unfold'))
  43 + .width(16)
  44 + .height(16)
  45 + }
  46 + .justifyContent(FlexAlign.Center)
  47 + .width('100%')
  48 + .height(48)
  49 + .backgroundColor(0xffffff)
  50 + .onClick(() => {
  51 + this.showDetail = true;
  52 + })
  53 +
  54 + Divider()
  55 + .width('100%')
  56 + .height(10)
  57 + .color($r('app.color.color_F5F5F5'))
  58 + .strokeWidth('1lpx')
30 59
  60 + }
31 } 61 }
32 - .justifyContent(FlexAlign.Center)  
33 - .width('100%')  
34 - .height(48)  
35 - .backgroundColor(0xffffff) 62 +
  63 +
  64 +
36 } 65 }
37 66
38 dealSearchSameList() { 67 dealSearchSameList() {
@@ -88,6 +117,8 @@ export struct MoreComponent { @@ -88,6 +117,8 @@ export struct MoreComponent {
88 console.log("ycg","123") 117 console.log("ycg","123")
89 } 118 }
90 }) 119 })
  120 +
  121 + console.log("MoreComponent", JSON.stringify(this.contentDTO.sameContentList))
91 }).catch((err: Error) => { 122 }).catch((err: Error) => {
92 console.log(TAG, JSON.stringify(err)) 123 console.log(TAG, JSON.stringify(err))
93 }) 124 })