Showing
4 changed files
with
63 additions
and
12 deletions
| @@ -2,7 +2,7 @@ import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI' | @@ -2,7 +2,7 @@ import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI' | ||
| 2 | import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; | 2 | import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; |
| 3 | import PageModel from '../../viewmodel/PageModel'; | 3 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| 5 | -import { EmptyComponent } from '../view/EmptyComponent' | 5 | +import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' |
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | import RefreshLayout from './RefreshLayout' | 7 | import RefreshLayout from './RefreshLayout' |
| 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; | 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; |
| @@ -43,7 +43,7 @@ struct MyCollectionListPage { | @@ -43,7 +43,7 @@ struct MyCollectionListPage { | ||
| 43 | }else if(this.browSingModel.viewType == ViewType.ERROR){ | 43 | }else if(this.browSingModel.viewType == ViewType.ERROR){ |
| 44 | ErrorComponent() | 44 | ErrorComponent() |
| 45 | }else if(this.browSingModel.viewType == ViewType.EMPTY){ | 45 | }else if(this.browSingModel.viewType == ViewType.EMPTY){ |
| 46 | - EmptyComponent() | 46 | + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection}) |
| 47 | }else { | 47 | }else { |
| 48 | this.ListLayout() | 48 | this.ListLayout() |
| 49 | } | 49 | } |
| @@ -4,6 +4,42 @@ import { Logger } from 'wdKit'; | @@ -4,6 +4,42 @@ import { Logger } from 'wdKit'; | ||
| 4 | const TAG = 'EmptyComponent'; | 4 | const TAG = 'EmptyComponent'; |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | + * WDViewDefaultType 缺省页 | ||
| 8 | + */ | ||
| 9 | +export const enum WDViewDefaultType { | ||
| 10 | + ///默认 | ||
| 11 | + WDViewDefaultType_Default, | ||
| 12 | + ///无网 | ||
| 13 | + WDViewDefaultType_NoNetwork, | ||
| 14 | + ///暂无内容(列表页) | ||
| 15 | + WDViewDefaultType_NoListContent, | ||
| 16 | + ///内容找不到了(内容详情页) | ||
| 17 | + WDViewDefaultType_NoContent, | ||
| 18 | + ///无搜索内容 | ||
| 19 | + WDViewDefaultType_NoSearchResult, | ||
| 20 | + ///无消息内容 | ||
| 21 | + WDViewDefaultType_NoMessage, | ||
| 22 | + ///无收藏内容 | ||
| 23 | + WDViewDefaultType_NoCollection, | ||
| 24 | + ///无历史记录 | ||
| 25 | + WDViewDefaultType_NoHistory, | ||
| 26 | + ///网络失败 | ||
| 27 | + WDViewDefaultType_NetworkFailed, | ||
| 28 | + ///内容获取失败 | ||
| 29 | + WDViewDefaultType_ContentFailed, | ||
| 30 | + ///无预约内容 | ||
| 31 | + WDViewDefaultType_NoBooking, | ||
| 32 | + ///无评论内容 | ||
| 33 | + WDViewDefaultType_NoComment, | ||
| 34 | + ///暂无作品 | ||
| 35 | + WDViewDefaultType_NoCreation, | ||
| 36 | + ///该号主无法访问 | ||
| 37 | + WDViewDefaultType_NoVisitAccount, | ||
| 38 | + ///暂无关注 | ||
| 39 | + WDViewDefaultType_NoFollow | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +/** | ||
| 7 | * 空数据/无数据 | 43 | * 空数据/无数据 |
| 8 | */ | 44 | */ |
| 9 | @Component | 45 | @Component |
| @@ -11,18 +47,19 @@ export struct EmptyComponent { | @@ -11,18 +47,19 @@ export struct EmptyComponent { | ||
| 11 | // private emptySize: SizeOptions = {}; | 47 | // private emptySize: SizeOptions = {}; |
| 12 | @State emptyWidth: string | number = CommonConstants.FULL_PARENT; | 48 | @State emptyWidth: string | number = CommonConstants.FULL_PARENT; |
| 13 | @State emptyHeight: string | number = CommonConstants.FULL_PARENT; | 49 | @State emptyHeight: string | number = CommonConstants.FULL_PARENT; |
| 50 | + @State emptyType:number = WDViewDefaultType.WDViewDefaultType_Default | ||
| 14 | /** | 51 | /** |
| 15 | * The empty image width percentage setting. | 52 | * The empty image width percentage setting. |
| 16 | */ | 53 | */ |
| 17 | - readonly EMPTY_IMAGE_WIDTH: string = '50%'; | 54 | + readonly EMPTY_IMAGE_WIDTH: string = '15%'; |
| 18 | /** | 55 | /** |
| 19 | * The empty image height percentage setting. | 56 | * The empty image height percentage setting. |
| 20 | */ | 57 | */ |
| 21 | - readonly EMPTY_IMAGE_HEIGHT: string = '30%'; | 58 | + readonly EMPTY_IMAGE_HEIGHT: string = '15%'; |
| 22 | /** | 59 | /** |
| 23 | * The empty data text component margin top. | 60 | * The empty data text component margin top. |
| 24 | */ | 61 | */ |
| 25 | - readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '2%'; | 62 | + readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '10'; |
| 26 | /** | 63 | /** |
| 27 | * The empty data text opacity. | 64 | * The empty data text opacity. |
| 28 | */ | 65 | */ |
| @@ -38,11 +75,11 @@ export struct EmptyComponent { | @@ -38,11 +75,11 @@ export struct EmptyComponent { | ||
| 38 | @Builder | 75 | @Builder |
| 39 | noProgrammeData() { | 76 | noProgrammeData() { |
| 40 | Column() { | 77 | Column() { |
| 41 | - // Image($r('app.media.icon_no_content')) | ||
| 42 | - // .width(this.EMPTY_IMAGE_WIDTH) | ||
| 43 | - // .height(this.EMPTY_IMAGE_HEIGHT) | ||
| 44 | - // .objectFit(ImageFit.Contain) | ||
| 45 | - // // .border({ width: 1, color: Color.Red, radius: 6 }) | 78 | + Image(this.buildNoDataTipImage()) |
| 79 | + .width('this.EMPTY_IMAGE_WIDTH') | ||
| 80 | + .height(this.EMPTY_IMAGE_HEIGHT) | ||
| 81 | + .objectFit(ImageFit.Contain) | ||
| 82 | + // .border({ width: 1, color: Color.Red, radius: 6 }) | ||
| 46 | 83 | ||
| 47 | Text(this.buildNoDataTip()) | 84 | Text(this.buildNoDataTip()) |
| 48 | .fontSize($r('app.float.normal_text_size')) | 85 | .fontSize($r('app.float.normal_text_size')) |
| @@ -59,8 +96,22 @@ export struct EmptyComponent { | @@ -59,8 +96,22 @@ export struct EmptyComponent { | ||
| 59 | .height(this.emptyHeight) | 96 | .height(this.emptyHeight) |
| 60 | } | 97 | } |
| 61 | 98 | ||
| 62 | - buildNoDataTip(): Resource | string { | 99 | + buildNoDataTip(): string { |
| 63 | Logger.info(TAG, "buildNoDataTip"); | 100 | Logger.info(TAG, "buildNoDataTip"); |
| 64 | - return $r('app.string.load_net_data_none') | 101 | + let contentString: string = '暂无内容' |
| 102 | + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { | ||
| 103 | + contentString = '暂无收藏' | ||
| 104 | + } | ||
| 105 | + return contentString | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + buildNoDataTipImage(): Resource | string { | ||
| 110 | + Logger.info(TAG, "buildNoDataTip"); | ||
| 111 | + let imageString: Resource | string = $r('app.media.icon_no_content') | ||
| 112 | + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { | ||
| 113 | + imageString = $r('app.media.icon_no_collection') | ||
| 114 | + } | ||
| 115 | + return imageString | ||
| 65 | } | 116 | } |
| 66 | } | 117 | } |
64.2 KB
-
Please register or login to post a comment