yuzhilin

fix:H5详情页增加无网缺省图

1 -import { Logger, NumberFormatterUtils, DateTimeUtils, EmitterUtils, EmitterEventId } from 'wdKit'; 1 +import { Logger, NumberFormatterUtils, DateTimeUtils, EmitterUtils, EmitterEventId, NetworkUtil } from 'wdKit';
2 import { 2 import {
3 Action, 3 Action,
4 ContentDetailDTO, 4 ContentDetailDTO,
@@ -20,7 +20,7 @@ import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailView @@ -20,7 +20,7 @@ import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailView
20 import { PageRepository } from '../repository/PageRepository'; 20 import { PageRepository } from '../repository/PageRepository';
21 import { detailedSkeleton } from './skeleton/detailSkeleton'; 21 import { detailedSkeleton } from './skeleton/detailSkeleton';
22 import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; 22 import { publishCommentModel } from '../components/comment/model/PublishCommentModel';
23 - 23 +import { EmptyComponent } from '../components/view/EmptyComponent';
24 import { CommentComponent } from '../components/comment/view/CommentComponent' 24 import { CommentComponent } from '../components/comment/view/CommentComponent'
25 import { HttpUtils } from 'wdNetwork/Index'; 25 import { HttpUtils } from 'wdNetwork/Index';
26 26
@@ -40,6 +40,7 @@ export struct ImageAndTextPageComponent { @@ -40,6 +40,7 @@ export struct ImageAndTextPageComponent {
40 @State publishTime: string = '' 40 @State publishTime: string = ''
41 @State publishCommentModel: publishCommentModel = new publishCommentModel() 41 @State publishCommentModel: publishCommentModel = new publishCommentModel()
42 @State operationButtonList: string[] = ['comment', 'collect', 'share'] 42 @State operationButtonList: string[] = ['comment', 'collect', 'share']
  43 + @State isNetConnected: boolean = true
43 44
44 build() { 45 build() {
45 Column() { 46 Column() {
@@ -143,9 +144,19 @@ export struct ImageAndTextPageComponent { @@ -143,9 +144,19 @@ export struct ImageAndTextPageComponent {
143 .scrollBar(BarState.Off) 144 .scrollBar(BarState.Off)
144 .align(Alignment.Top) 145 .align(Alignment.Top)
145 146
  147 + if(!this.isNetConnected) {
  148 + EmptyComponent({
  149 + emptyType: 1,
  150 + emptyButton: true,
  151 + retry: () => {
  152 + this.getDetail()
  153 + }
  154 + })
  155 + }else{
146 if (!this.isPageEnd) { 156 if (!this.isPageEnd) {
147 detailedSkeleton() 157 detailedSkeleton()
148 } 158 }
  159 + }
149 160
150 //底部交互区 161 //底部交互区
151 if (this.contentDetailData?.length) { 162 if (this.contentDetailData?.length) {
@@ -163,6 +174,7 @@ export struct ImageAndTextPageComponent { @@ -163,6 +174,7 @@ export struct ImageAndTextPageComponent {
163 } 174 }
164 175
165 private async getDetail() { 176 private async getDetail() {
  177 + this.isNetConnected = NetworkUtil.isNetConnected()
166 let contentId: string = '' 178 let contentId: string = ''
167 let relId: string = '' 179 let relId: string = ''
168 let relType: string = '' 180 let relType: string = ''
@@ -91,7 +91,6 @@ export struct SpacialTopicPageComponent { @@ -91,7 +91,6 @@ export struct SpacialTopicPageComponent {
91 } 91 }
92 .width(CommonConstants.FULL_WIDTH) 92 .width(CommonConstants.FULL_WIDTH)
93 .height(CommonConstants.FULL_HEIGHT) 93 .height(CommonConstants.FULL_HEIGHT)
94 - // .padding({ bottom: 76 })  
95 94
96 if (!this.isPageEnd) { 95 if (!this.isPageEnd) {
97 detailedSkeleton() 96 detailedSkeleton()