Showing
6 changed files
with
74 additions
and
9 deletions
| @@ -47,3 +47,5 @@ export { TriPicCardComponent } from "./src/main/ets/components/view/TriPicCardCo | @@ -47,3 +47,5 @@ export { TriPicCardComponent } from "./src/main/ets/components/view/TriPicCardCo | ||
| 47 | export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent" | 47 | export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent" |
| 48 | 48 | ||
| 49 | export { HeadPictureCardComponent } from "./src/main/ets/components/view/HeadPictureCardComponent" | 49 | export { HeadPictureCardComponent } from "./src/main/ets/components/view/HeadPictureCardComponent" |
| 50 | + | ||
| 51 | +export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayoutComponent" |
| @@ -9,6 +9,7 @@ import { BigPicCardComponent } from './view/BigPicCardComponent'; | @@ -9,6 +9,7 @@ import { BigPicCardComponent } from './view/BigPicCardComponent'; | ||
| 9 | import { TriPicCardComponent } from './view/TriPicCardComponent'; | 9 | import { TriPicCardComponent } from './view/TriPicCardComponent'; |
| 10 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; | 10 | import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent'; |
| 11 | import { HeadPictureCardComponent } from './view/HeadPictureCardComponent'; | 11 | import { HeadPictureCardComponent } from './view/HeadPictureCardComponent'; |
| 12 | +import { ZhGridLayoutComponent } from './view/ZhGridLayoutComponent'; | ||
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| 14 | * comp适配器. | 15 | * comp适配器. |
| @@ -42,6 +43,8 @@ export struct CompParser { | @@ -42,6 +43,8 @@ export struct CompParser { | ||
| 42 | LiveHorizontalCardComponent({ compDTO: compDTO }) | 43 | LiveHorizontalCardComponent({ compDTO: compDTO }) |
| 43 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { | 44 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) { |
| 44 | HeadPictureCardComponent({ compDTO: compDTO }) | 45 | HeadPictureCardComponent({ compDTO: compDTO }) |
| 46 | + } else if (compDTO.compStyle === CompStyle.ZhGrid_Layout_03) { | ||
| 47 | + ZhGridLayoutComponent({ compDTO: compDTO }) | ||
| 45 | } else { | 48 | } else { |
| 46 | // todo:组件未实现 / Component Not Implemented | 49 | // todo:组件未实现 / Component Not Implemented |
| 47 | Text(compDTO.compStyle) | 50 | Text(compDTO.compStyle) |
| 1 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | +import { CompStyle } from 'wdConstant'; | ||
| 2 | import { Logger } from 'wdKit'; | 3 | import { Logger } from 'wdKit'; |
| 3 | import { WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterRule } from 'wdRouter'; |
| 4 | 5 | ||
| @@ -18,12 +19,11 @@ export struct SingleImageCardComponent { | @@ -18,12 +19,11 @@ export struct SingleImageCardComponent { | ||
| 18 | @State titleNumber: number = 3 //标题行数 | 19 | @State titleNumber: number = 3 //标题行数 |
| 19 | 20 | ||
| 20 | aboutToAppear() { | 21 | aboutToAppear() { |
| 21 | - if (this.compDTO.compStyle === 'Single_Imagecard_03') { | 22 | + if(this.compDTO.operDataList[0].newsTitle.length > 25){ |
| 22 | this.titleNumber = 3; | 23 | this.titleNumber = 3; |
| 23 | } else { | 24 | } else { |
| 24 | this.titleNumber = 2; | 25 | this.titleNumber = 2; |
| 25 | } | 26 | } |
| 26 | - | ||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | build() { | 29 | build() { |
| @@ -63,6 +63,7 @@ export struct SingleImageCardComponent { | @@ -63,6 +63,7 @@ export struct SingleImageCardComponent { | ||
| 63 | Blank(16) | 63 | Blank(16) |
| 64 | Image(this.compDTO.operDataList[0].coverUrl) | 64 | Image(this.compDTO.operDataList[0].coverUrl) |
| 65 | .width('38%') | 65 | .width('38%') |
| 66 | + .borderRadius(5) | ||
| 66 | .aspectRatio(3 / 2) | 67 | .aspectRatio(3 / 2) |
| 67 | } | 68 | } |
| 68 | .padding( | 69 | .padding( |
| 1 | +import { Action, CompDTO, ContentDTO, Params } from 'wdBean'; | ||
| 2 | +import { CompStyle } from 'wdConstant'; | ||
| 3 | +import { Logger } from 'wdKit'; | ||
| 4 | +import { WDRouterRule } from 'wdRouter'; | ||
| 5 | + | ||
| 6 | +const TAG = 'Zh_Grid_Layout-03'; | ||
| 7 | +const FULL_PARENT: string = '100%'; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 金刚卡位 | ||
| 11 | + * 枚举值Zh_Grid_Layout-03 | ||
| 12 | + * Zh_Grid_Layout-03 | ||
| 13 | + * | ||
| 14 | + */ | ||
| 15 | +@Entry | ||
| 16 | +@Component | ||
| 17 | +export struct ZhGridLayoutComponent { | ||
| 18 | + @State compDTO: CompDTO = {} as CompDTO | ||
| 19 | + | ||
| 20 | + aboutToAppear() { | ||
| 21 | + Logger.info(TAG + ' comp:'+ JSON.stringify(this.compDTO)) | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + build() { | ||
| 25 | + Column() { | ||
| 26 | + Flex({ wrap: FlexWrap.Wrap, | ||
| 27 | + justifyContent: FlexAlign.SpaceEvenly, | ||
| 28 | + alignItems :ItemAlign.End}) { | ||
| 29 | + ForEach(this.compDTO.operDataList, (item: ContentDTO) => { | ||
| 30 | + Column() { | ||
| 31 | + Image(item.coverUrl) | ||
| 32 | + .width(50) | ||
| 33 | + .aspectRatio(1 / 1) | ||
| 34 | + .autoResize(true) | ||
| 35 | + Text(item.newsTitle) | ||
| 36 | + .fontSize(16) | ||
| 37 | + .margin({ top: 10 }) | ||
| 38 | + }.margin({ | ||
| 39 | + top:5, | ||
| 40 | + bottom:5, | ||
| 41 | + left:5, | ||
| 42 | + right :5 | ||
| 43 | + }) | ||
| 44 | + }, (item: ContentDTO) => JSON.stringify(item)) | ||
| 45 | + } | ||
| 46 | + .backgroundColor(Color.White) | ||
| 47 | + .borderRadius(12) | ||
| 48 | + .padding({ | ||
| 49 | + top: 10, | ||
| 50 | + bottom: 10 | ||
| 51 | + }) | ||
| 52 | + .width(FULL_PARENT) | ||
| 53 | + .margin(10) | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + } | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | + |
| @@ -25,5 +25,5 @@ export const enum CompStyle { | @@ -25,5 +25,5 @@ export const enum CompStyle { | ||
| 25 | Title_All_01 = '3', // 全标题 | 25 | Title_All_01 = '3', // 全标题 |
| 26 | Single_Imagecard_02 = '13',//单图卡:2行标题 | 26 | Single_Imagecard_02 = '13',//单图卡:2行标题 |
| 27 | Single_Imagecard_03 = '13',//单图卡:3行标题 | 27 | Single_Imagecard_03 = '13',//单图卡:3行标题 |
| 28 | - Grid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡 | 28 | + ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡 |
| 29 | } | 29 | } |
| @@ -74,24 +74,24 @@ export class HttpUrlUtils { | @@ -74,24 +74,24 @@ export class HttpUrlUtils { | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | static addSpecialHeaders(headers: HashMap<string, string>) { | 76 | static addSpecialHeaders(headers: HashMap<string, string>) { |
| 77 | - switch (this.hostUrl) { | ||
| 78 | - case this.HOST_UAT: | 77 | + switch (HttpUrlUtils.hostUrl) { |
| 78 | + case HttpUrlUtils.HOST_UAT: | ||
| 79 | // TODO 待优化到常量类里 | 79 | // TODO 待优化到常量类里 |
| 80 | headers.set('X-Ca-Stage', 'PRE'); | 80 | headers.set('X-Ca-Stage', 'PRE'); |
| 81 | headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a'); | 81 | headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a'); |
| 82 | headers.set('appCode', '83092caa603a421aa0222308b3f6b27a'); | 82 | headers.set('appCode', '83092caa603a421aa0222308b3f6b27a'); |
| 83 | break | 83 | break |
| 84 | - case this.HOST_SIT: | 84 | + case HttpUrlUtils.HOST_SIT: |
| 85 | headers.set('X-Ca-Stage', 'TEST'); | 85 | headers.set('X-Ca-Stage', 'TEST'); |
| 86 | headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07'); | 86 | headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07'); |
| 87 | headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07'); | 87 | headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07'); |
| 88 | break | 88 | break |
| 89 | - case this.HOST_PRODUCT: | 89 | + case HttpUrlUtils.HOST_PRODUCT: |
| 90 | headers.set('X-Ca-Stage', 'RELEASE'); | 90 | headers.set('X-Ca-Stage', 'RELEASE'); |
| 91 | headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'); | 91 | headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'); |
| 92 | headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6'); | 92 | headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6'); |
| 93 | break | 93 | break |
| 94 | - case this.HOST_DEV: | 94 | + case HttpUrlUtils.HOST_DEV: |
| 95 | headers.set('X-Ca-Stage', 'TEST'); | 95 | headers.set('X-Ca-Stage', 'TEST'); |
| 96 | headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9'); | 96 | headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9'); |
| 97 | headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9'); | 97 | headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9'); |
| @@ -102,7 +102,7 @@ export class HttpUrlUtils { | @@ -102,7 +102,7 @@ export class HttpUrlUtils { | ||
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static getHost() { | 104 | static getHost() { |
| 105 | - return this.hostUrl; | 105 | + return HttpUrlUtils.hostUrl; |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | private static getCity() { | 108 | private static getCity() { |
-
Please register or login to post a comment