wangyong_wd

播报推荐列表弹窗添加

1 -import { CompInfoBean, CompDTO } from 'wdBean' 1 +import { CompInfoBean, CompDTO, CompList } from 'wdBean'
2 import { CommonConstants } from 'wdConstant'; 2 import { CommonConstants } from 'wdConstant';
3 import { ProcessUtils } from '../../utils/ProcessUtils'; 3 import { ProcessUtils } from '../../utils/ProcessUtils';
4 -  
5 /** 4 /**
6 * 播报--今日推荐列表 5 * 播报--今日推荐列表
7 */ 6 */
@@ -9,6 +8,12 @@ import { ProcessUtils } from '../../utils/ProcessUtils'; @@ -9,6 +8,12 @@ import { ProcessUtils } from '../../utils/ProcessUtils';
9 @Component 8 @Component
10 export struct RecommendLists { 9 export struct RecommendLists {
11 @Prop recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐-组件信息 10 @Prop recommendCompInfoBean: CompInfoBean = {} as CompInfoBean // 推荐-组件信息
  11 + recommendDialog: CustomDialogController = new CustomDialogController({
  12 + builder: CustomDialogExample({
  13 + recommendLists: this.recommendCompInfoBean?.compList
  14 + }),
  15 + offset: { dx: 0, dy: 0 }
  16 + })
12 17
13 build() { 18 build() {
14 Column(){ 19 Column(){
@@ -32,7 +37,7 @@ export struct RecommendLists { @@ -32,7 +37,7 @@ export struct RecommendLists {
32 .justifyContent(FlexAlign.Center) 37 .justifyContent(FlexAlign.Center)
33 .margin({top: 5}) 38 .margin({top: 5})
34 .onClick(() => { 39 .onClick(() => {
35 - // console.log(1) 40 + this.recommendDialog.open()
36 }) 41 })
37 } 42 }
38 } 43 }
@@ -62,9 +67,65 @@ export struct RecommendLists { @@ -62,9 +67,65 @@ export struct RecommendLists {
62 ProcessUtils.processPage(item.operDataList[0]) 67 ProcessUtils.processPage(item.operDataList[0])
63 }) 68 })
64 } 69 }
  70 +}
65 71
66 - @Builder  
67 - recommendListItem() { 72 +@CustomDialog
  73 +struct CustomDialogExample {
  74 + controller: CustomDialogController
  75 + @Prop recommendLists: CompList[]
  76 + build() {
  77 + Column(){
  78 + Text('推荐列表')
  79 + .fontSize($r('app.float.selected_text_size'))
  80 + .fontWeight(500)
  81 + .fontColor($r('app.color.color_323232'))
  82 + .height(57)
  83 + .width(CommonConstants.FULL_WIDTH)
  84 + .padding({left: 16})
  85 + Divider()
  86 + List(){
  87 + ForEach(this.recommendLists, (item: CompDTO, index: number) => {
  88 + ListItem(){
  89 + this.listItem(item, index)
  90 + }
  91 + .onClick(() => {
  92 + ProcessUtils.processPage(item.operDataList[0])
  93 + this.controller.close()
  94 + })
  95 + })
  96 + }.layoutWeight(1)
  97 + Divider()
  98 + Text('取消')
  99 + .fontSize($r('app.float.font_size_16'))
  100 + .fontColor($r('app.color.color_323232'))
  101 + .width(CommonConstants.FULL_WIDTH)
  102 + .height(57)
  103 + .textAlign(TextAlign.Center)
  104 + .onClick(() => {
  105 + this.controller.close()
  106 + })
  107 + }
  108 + .height('80%')
  109 + }
68 110
  111 + @Builder listItem(item: CompDTO,index: number) {
  112 + Row(){
  113 + Text(String(index+1))
  114 + .width(24)
  115 + .height(24)
  116 + .textAlign(TextAlign.Center)
  117 + .fontSize($r('app.float.font_size_14'))
  118 + .fontColor($r('app.color.color_48505A'))
  119 + Text(item.operDataList[0].newsTitle)
  120 + .layoutWeight(1)
  121 + .maxLines(1)
  122 + .textOverflow({overflow:TextOverflow.Ellipsis})
  123 + .margin({left: 16})
  124 + .fontSize($r('app.float.font_size_16'))
  125 + .fontColor($r('app.color.color_212228'))
  126 + }
  127 + .width(CommonConstants.FULL_WIDTH)
  128 + .height(54)
  129 + .padding({left: 16, right: 16})
69 } 130 }
70 } 131 }
@@ -127,6 +127,14 @@ @@ -127,6 +127,14 @@
127 { 127 {
128 "name":"color_EEEEEE", 128 "name":"color_EEEEEE",
129 "value": "#EEEEEE" 129 "value": "#EEEEEE"
  130 + },
  131 + {
  132 + "name": "color_323232",
  133 + "value": "#323232"
  134 + },
  135 + {
  136 + "name": "color_48505A",
  137 + "value": "#48505A"
130 } 138 }
131 ] 139 ]
132 } 140 }