yangchenggong1_wd

fix |> 17457 无网络时进入协议节目鸿蒙与安卓显示不一致

import { CommonConstants } from 'wdConstant';
import { Logger } from 'wdKit';
import { router } from '@kit.ArkUI';
const TAG = 'EmptyComponent';
/**
* WDViewDefaultType 缺省页 无网络
* WDViewDefaultType 缺省页 无网络
*/
export const enum WDViewDefaultType {
/// 0.默认
... ... @@ -19,11 +20,15 @@ export const enum WDViewDefaultType {
@Preview
@Component
export struct EmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_NoNetwork; // 缺省图类型,传枚举
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举
@State emptyButton: boolean = false
@State isBlack: boolean = false // 背景是否为黑色 默认白色
@State timeNum: number = 10
///占位图上是否显示返回按钮
@State showBackButton: boolean = true
/**
* The empty image width percentage setting.
*/
... ... @@ -39,13 +44,27 @@ export struct EmptyComponent {
/**
* The empty data text opacity.
*/
readonly TEXT_OPACITY: number = 0.4;
private timer: number = -1
readonly TEXT_OPACITY: number = 1.0;
retry: () => void = () => {
}
build() {
this.noProgrammeData();
Stack({alignContent:Alignment.Bottom}) {
this.noProgrammeData();
if (this.showBackButton) {
Image($r("app.media.icon_arrow_left_white"))
.width(24)
.height(24)
.onClick(() => {
router.back();
})
.position({
bottom: 15,
left: 16
})
}
}
}
/**
... ... @@ -64,17 +83,18 @@ export struct EmptyComponent {
.fontWeight(FontWeight.Normal)
.opacity(this.TEXT_OPACITY)
.margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP })
.fontColor('#666666')
.onClick((event: ClickEvent) => {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
if (this.isShowButton()) {
if (this.emptyType !== 15) {
if (this.emptyType !== 15 && !this.isBlack) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor('#fffffff')
.backgroundColor(Color.White)
.fontColor('#FF666666')
.border({ width: 1 })
.borderColor('#FFEDEDED')
... ... @@ -106,7 +126,9 @@ export struct EmptyComponent {
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
.layoutWeight(1)
.height(this.emptyHeight)
}
buildNoDataTip(): string {
... ... @@ -120,7 +142,7 @@ export struct EmptyComponent {
buildNoDataTipImage(): Resource | string {
Logger.info(TAG, "buildNoDataTip");
let imageString: Resource | string = ""
let imageString: Resource | string = $r('app.media.icon_no_net1')
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
imageString = $r('app.media.icon_no_net1')
}
... ... @@ -128,7 +150,7 @@ export struct EmptyComponent {
}
isShowButton() {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15 && this.emptyButton) {
return true
} else {
return false
... ...