douaojie

feat: 缺省图

Showing 32 changed files with 51 additions and 3 deletions
  1 +import { EmptyComponent } from '../view/EmptyComponent'
  2 +
  3 +@Entry
  4 +@Component
  5 +export struct DefaultPage {
  6 + build() {
  7 + Row() {
  8 + EmptyComponent({ emptyType: 8 })
  9 + }
  10 + }
  11 +}
@@ -23,7 +23,7 @@ export const enum WDViewDefaultType { @@ -23,7 +23,7 @@ export const enum WDViewDefaultType {
23 WDViewDefaultType_NoCollection, 23 WDViewDefaultType_NoCollection,
24 ///无历史记录 24 ///无历史记录
25 WDViewDefaultType_NoHistory, 25 WDViewDefaultType_NoHistory,
26 - ///网络失败 26 + ///网络失败 请稍后重试-倒计时
27 WDViewDefaultType_NetworkFailed, 27 WDViewDefaultType_NetworkFailed,
28 ///内容获取失败 28 ///内容获取失败
29 WDViewDefaultType_ContentFailed, 29 WDViewDefaultType_ContentFailed,
@@ -42,12 +42,13 @@ export const enum WDViewDefaultType { @@ -42,12 +42,13 @@ export const enum WDViewDefaultType {
42 /** 42 /**
43 * 空数据/无数据 43 * 空数据/无数据
44 */ 44 */
  45 +@Preview
45 @Component 46 @Component
46 export struct EmptyComponent { 47 export struct EmptyComponent {
47 // private emptySize: SizeOptions = {}; 48 // private emptySize: SizeOptions = {};
48 @State emptyWidth: string | number = CommonConstants.FULL_PARENT; 49 @State emptyWidth: string | number = CommonConstants.FULL_PARENT;
49 @State emptyHeight: string | number = CommonConstants.FULL_PARENT; 50 @State emptyHeight: string | number = CommonConstants.FULL_PARENT;
50 - @State emptyType:number = WDViewDefaultType.WDViewDefaultType_Default 51 + @State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default
51 /** 52 /**
52 * The empty image width percentage setting. 53 * The empty image width percentage setting.
53 */ 54 */
@@ -101,16 +102,52 @@ export struct EmptyComponent { @@ -101,16 +102,52 @@ export struct EmptyComponent {
101 let contentString: string = '暂无内容' 102 let contentString: string = '暂无内容'
102 if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { 103 if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
103 contentString = '暂无收藏' 104 contentString = '暂无收藏'
  105 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
  106 + contentString = '暂无消息'
  107 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) {
  108 + contentString = '暂无评论'
  109 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) {
  110 + contentString = '没有找到相关内容'
  111 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
  112 + contentString = '网络出小差了,请检查网络后重试'
  113 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
  114 + contentString = '获取内容失败请重试'
  115 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) {
  116 + contentString = '暂无作品'
  117 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
  118 + contentString = '暂无预约'
  119 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
  120 + contentString = '' // 前方拥堵,请耐心等待
  121 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) {
  122 + contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待
104 } 123 }
  124 +
105 return contentString 125 return contentString
106 } 126 }
107 127
108 -  
109 buildNoDataTipImage(): Resource | string { 128 buildNoDataTipImage(): Resource | string {
110 Logger.info(TAG, "buildNoDataTip"); 129 Logger.info(TAG, "buildNoDataTip");
111 let imageString: Resource | string = $r('app.media.icon_no_content') 130 let imageString: Resource | string = $r('app.media.icon_no_content')
112 if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { 131 if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) {
113 imageString = $r('app.media.icon_no_collection') 132 imageString = $r('app.media.icon_no_collection')
  133 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) {
  134 + imageString = $r('app.media.icon_no_message')
  135 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) {
  136 + imageString = $r('app.media.icon_no_comment')
  137 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) {
  138 + imageString = $r('app.media.icon_no_result')
  139 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
  140 + imageString = $r('app.media.icon_no_net')
  141 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
  142 + imageString = $r('app.media.icon_no_content')
  143 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCreation) {
  144 + imageString = $r('app.media.icon_no_appointmentMade')
  145 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoBooking) {
  146 + imageString = $r('app.media.icon_no_appointmentMade')
  147 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) {
  148 + imageString = $r('app.media.icon_no_net')
  149 + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) {
  150 + imageString = $r('app.media.icon_no_master1')
114 } 151 }
115 return imageString 152 return imageString
116 } 153 }
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.