Showing
2 changed files
with
35 additions
and
9 deletions
| 1 | -import { EmitterUtils, EmitterEventId, Logger } from 'wdKit/Index' | 1 | +import { EmitterUtils, EmitterEventId, Logger, NetworkUtil } from 'wdKit/Index' |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 3 | import { FollowListItem } from '../../../viewmodel/FollowListItem' | 3 | import { FollowListItem } from '../../../viewmodel/FollowListItem' |
| 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' | 4 | import { CustomTitleUI } from '../../reusable/CustomTitleUI' |
| 5 | +import { EmptyComponent } from '../../view/EmptyComponent' | ||
| 5 | import { FollowSecondTabsComponent } from './FollowSecondTabsComponent' | 6 | import { FollowSecondTabsComponent } from './FollowSecondTabsComponent' |
| 6 | const TAG = "FollowFirstTabsComponent" | 7 | const TAG = "FollowFirstTabsComponent" |
| 7 | @Component | 8 | @Component |
| @@ -12,8 +13,19 @@ export struct FollowFirstTabsComponent{ | @@ -12,8 +13,19 @@ export struct FollowFirstTabsComponent{ | ||
| 12 | @State data:FollowListItem[] = [] | 13 | @State data:FollowListItem[] = [] |
| 13 | fontColor: string = '#999999' | 14 | fontColor: string = '#999999' |
| 14 | selectedFontColor: string = '#000000' | 15 | selectedFontColor: string = '#000000' |
| 16 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 15 | 17 | ||
| 16 | aboutToAppear(){ | 18 | aboutToAppear(){ |
| 19 | + this.getFollowTabList() | ||
| 20 | + | ||
| 21 | + EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => { | ||
| 22 | + if(this.controller != null && this.data.length>1 ){ | ||
| 23 | + this.jumpFollowNextPage() | ||
| 24 | + } | ||
| 25 | + })) | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + getFollowTabList(){ | ||
| 17 | MinePageDatasModel.getFollowListData(getContext(this)).then((value)=>{ | 29 | MinePageDatasModel.getFollowListData(getContext(this)).then((value)=>{ |
| 18 | this.data.push(new FollowListItem("我的")) | 30 | this.data.push(new FollowListItem("我的")) |
| 19 | value.forEach((element)=>{ | 31 | value.forEach((element)=>{ |
| @@ -26,12 +38,6 @@ export struct FollowFirstTabsComponent{ | @@ -26,12 +38,6 @@ export struct FollowFirstTabsComponent{ | ||
| 26 | }).catch((err:Error)=>{ | 38 | }).catch((err:Error)=>{ |
| 27 | console.log(TAG,JSON.stringify(err)) | 39 | console.log(TAG,JSON.stringify(err)) |
| 28 | }) | 40 | }) |
| 29 | - | ||
| 30 | - EmitterUtils.receiveEvent(EmitterEventId.MY_FOLLOW_EMPTY, (() => { | ||
| 31 | - if(this.controller != null && this.data.length>1 ){ | ||
| 32 | - this.jumpFollowNextPage() | ||
| 33 | - } | ||
| 34 | - })) | ||
| 35 | } | 41 | } |
| 36 | 42 | ||
| 37 | jumpFollowNextPage(){ | 43 | jumpFollowNextPage(){ |
| @@ -75,6 +81,13 @@ export struct FollowFirstTabsComponent{ | @@ -75,6 +81,13 @@ export struct FollowFirstTabsComponent{ | ||
| 75 | //标题栏目 | 81 | //标题栏目 |
| 76 | CustomTitleUI({titleName:"关注列表"}) | 82 | CustomTitleUI({titleName:"关注列表"}) |
| 77 | 83 | ||
| 84 | + if(!this.isConnectNetwork){ | ||
| 85 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 86 | + this.reloadNetWork() | ||
| 87 | + },}) | ||
| 88 | + .layoutWeight(1) | ||
| 89 | + .width('100%') | ||
| 90 | + }else{ | ||
| 78 | Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { | 91 | Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { |
| 79 | ForEach(this.data, (item: FollowListItem, index: number ) => { | 92 | ForEach(this.data, (item: FollowListItem, index: number ) => { |
| 80 | TabContent(){ | 93 | TabContent(){ |
| @@ -93,6 +106,15 @@ export struct FollowFirstTabsComponent{ | @@ -93,6 +106,15 @@ export struct FollowFirstTabsComponent{ | ||
| 93 | }) | 106 | }) |
| 94 | .width('100%') | 107 | .width('100%') |
| 95 | .layoutWeight(1) | 108 | .layoutWeight(1) |
| 109 | + } | ||
| 96 | }.width('100%') | 110 | }.width('100%') |
| 97 | } | 111 | } |
| 112 | + | ||
| 113 | + reloadNetWork(){ | ||
| 114 | + let c = NetworkUtil.isNetConnected() | ||
| 115 | + if(c){ | ||
| 116 | + this.getFollowTabList() | ||
| 117 | + this.isConnectNetwork = c | ||
| 118 | + } | ||
| 119 | + } | ||
| 98 | } | 120 | } |
| 1 | -import { EmitterEventId, EmitterUtils, LazyDataSource, SPHelper, UserDataLocal } from 'wdKit'; | 1 | +import { EmitterEventId, EmitterUtils, LazyDataSource, NetworkUtil, SPHelper, UserDataLocal } from 'wdKit'; |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; | 3 | import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; |
| 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; | 4 | import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; |
| @@ -70,7 +70,11 @@ export struct FollowListDetailUI { | @@ -70,7 +70,11 @@ export struct FollowListDetailUI { | ||
| 70 | Column() { | 70 | Column() { |
| 71 | if (this.count === 0) { | 71 | if (this.count === 0) { |
| 72 | if (this.isGetRequest == true) { | 72 | if (this.isGetRequest == true) { |
| 73 | - if(this.creatorDirectoryId === -1){ | 73 | + if(!NetworkUtil.isNetConnected()){ |
| 74 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" }) | ||
| 75 | + .layoutWeight(1) | ||
| 76 | + .width('100%') | ||
| 77 | + }else if(this.creatorDirectoryId === -1){ | ||
| 74 | EmptyComponent({ emptyType: 14,emptyHeight:"100%" }) | 78 | EmptyComponent({ emptyType: 14,emptyHeight:"100%" }) |
| 75 | .layoutWeight(1) | 79 | .layoutWeight(1) |
| 76 | .width('100%') | 80 | .width('100%') |
-
Please register or login to post a comment