guochunsong

提交金刚卡位

... ... @@ -47,3 +47,5 @@ export { TriPicCardComponent } from "./src/main/ets/components/view/TriPicCardCo
export { BigPicCardComponent } from "./src/main/ets/components/view/BigPicCardComponent"
export { HeadPictureCardComponent } from "./src/main/ets/components/view/HeadPictureCardComponent"
export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayoutComponent"
... ...
... ... @@ -9,6 +9,7 @@ import { BigPicCardComponent } from './view/BigPicCardComponent';
import { TriPicCardComponent } from './view/TriPicCardComponent';
import { LiveHorizontalCardComponent } from './view/LiveHorizontalCardComponent';
import { HeadPictureCardComponent } from './view/HeadPictureCardComponent';
import { ZhGridLayoutComponent } from './view/ZhGridLayoutComponent';
/**
* comp适配器.
... ... @@ -42,6 +43,8 @@ export struct CompParser {
LiveHorizontalCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
HeadPictureCardComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.ZhGrid_Layout_03) {
ZhGridLayoutComponent({ compDTO: compDTO })
} else {
// todo:组件未实现 / Component Not Implemented
Text(compDTO.compStyle)
... ...
import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
import { CompStyle } from 'wdConstant';
import { Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
... ... @@ -18,12 +19,11 @@ export struct SingleImageCardComponent {
@State titleNumber: number = 3 //标题行数
aboutToAppear() {
if (this.compDTO.compStyle === 'Single_Imagecard_03') {
if(this.compDTO.operDataList[0].newsTitle.length > 25){
this.titleNumber = 3;
} else {
this.titleNumber = 2;
}
}
build() {
... ... @@ -63,6 +63,7 @@ export struct SingleImageCardComponent {
Blank(16)
Image(this.compDTO.operDataList[0].coverUrl)
.width('38%')
.borderRadius(5)
.aspectRatio(3 / 2)
}
.padding(
... ...
import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
import { CompStyle } from 'wdConstant';
import { Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
const TAG = 'Zh_Grid_Layout-03';
const FULL_PARENT: string = '100%';
/**
* 金刚卡位
* 枚举值Zh_Grid_Layout-03
* Zh_Grid_Layout-03
*
*/
@Entry
@Component
export struct ZhGridLayoutComponent {
@State compDTO: CompDTO = {} as CompDTO
aboutToAppear() {
Logger.info(TAG + ' comp:'+ JSON.stringify(this.compDTO))
}
build() {
Column() {
Flex({ wrap: FlexWrap.Wrap,
justifyContent: FlexAlign.SpaceEvenly,
alignItems :ItemAlign.End}) {
ForEach(this.compDTO.operDataList, (item: ContentDTO) => {
Column() {
Image(item.coverUrl)
.width(50)
.aspectRatio(1 / 1)
.autoResize(true)
Text(item.newsTitle)
.fontSize(16)
.margin({ top: 10 })
}.margin({
top:5,
bottom:5,
left:5,
right :5
})
}, (item: ContentDTO) => JSON.stringify(item))
}
.backgroundColor(Color.White)
.borderRadius(12)
.padding({
top: 10,
bottom: 10
})
.width(FULL_PARENT)
.margin(10)
}
}
}
... ...
... ... @@ -25,5 +25,5 @@ export const enum CompStyle {
Title_All_01 = '3', // 全标题
Single_Imagecard_02 = '13',//单图卡:2行标题
Single_Imagecard_03 = '13',//单图卡:3行标题
Grid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡
ZhGrid_Layout_03 = 'Zh_Grid_Layout-03', //金刚位卡
}
... ...
... ... @@ -74,24 +74,24 @@ export class HttpUrlUtils {
}
static addSpecialHeaders(headers: HashMap<string, string>) {
switch (this.hostUrl) {
case this.HOST_UAT:
switch (HttpUrlUtils.hostUrl) {
case HttpUrlUtils.HOST_UAT:
// TODO 待优化到常量类里
headers.set('X-Ca-Stage', 'PRE');
headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a');
headers.set('appCode', '83092caa603a421aa0222308b3f6b27a');
break
case this.HOST_SIT:
case HttpUrlUtils.HOST_SIT:
headers.set('X-Ca-Stage', 'TEST');
headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07');
headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07');
break
case this.HOST_PRODUCT:
case HttpUrlUtils.HOST_PRODUCT:
headers.set('X-Ca-Stage', 'RELEASE');
headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6');
headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6');
break
case this.HOST_DEV:
case HttpUrlUtils.HOST_DEV:
headers.set('X-Ca-Stage', 'TEST');
headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9');
headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9');
... ... @@ -102,7 +102,7 @@ export class HttpUrlUtils {
}
static getHost() {
return this.hostUrl;
return HttpUrlUtils.hostUrl;
}
private static getCity() {
... ...