Showing
2 changed files
with
26 additions
and
5 deletions
| @@ -140,7 +140,13 @@ export struct SearchComponent { | @@ -140,7 +140,13 @@ export struct SearchComponent { | ||
| 140 | } else { | 140 | } else { |
| 141 | if (this.hasChooseSearch) { | 141 | if (this.hasChooseSearch) { |
| 142 | //搜索结果 | 142 | //搜索结果 |
| 143 | - SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) | 143 | + SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest,onClickTryAgain: (): void => { |
| 144 | + if(StringUtils.isNotEmpty(this.searchText)){ | ||
| 145 | + SearcherAboutDataModel.putSearchHistoryData(this.searchText) | ||
| 146 | + this.getSearchHistoryData() | ||
| 147 | + this.getSearchInputResData(this.searchText) | ||
| 148 | + } | ||
| 149 | + }}) | ||
| 144 | } else { | 150 | } else { |
| 145 | //联想搜索 | 151 | //联想搜索 |
| 146 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) | 152 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) |
| 1 | import { CompDTO, ContentDTO } from 'wdBean/Index' | 1 | import { CompDTO, ContentDTO } from 'wdBean/Index' |
| 2 | -import { LazyDataSource, UserDataLocal } from 'wdKit/Index' | 2 | +import { LazyDataSource, NetworkUtil, UserDataLocal } from 'wdKit/Index' |
| 3 | import { HttpUtils } from 'wdNetwork/Index' | 3 | import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 5 | import { SearchSuggestRequestItem } from '../../viewmodel/SearchSuggestRequestItem' | 5 | import { SearchSuggestRequestItem } from '../../viewmodel/SearchSuggestRequestItem' |
| @@ -26,6 +26,8 @@ export struct SearchResultComponent { | @@ -26,6 +26,8 @@ export struct SearchResultComponent { | ||
| 26 | @State suggest_count: number = 0; | 26 | @State suggest_count: number = 0; |
| 27 | @State isLoading: boolean = false | 27 | @State isLoading: boolean = false |
| 28 | scroller: Scroller = new Scroller() | 28 | scroller: Scroller = new Scroller() |
| 29 | + onClickTryAgain?: () => void; | ||
| 30 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 29 | 31 | ||
| 30 | aboutToAppear(): void { | 32 | aboutToAppear(): void { |
| 31 | if (this.count.length === 0 && this.isGetRequest == true) { | 33 | if (this.count.length === 0 && this.isGetRequest == true) { |
| @@ -67,9 +69,22 @@ export struct SearchResultComponent { | @@ -67,9 +69,22 @@ export struct SearchResultComponent { | ||
| 67 | List() { | 69 | List() { |
| 68 | ListItem() { | 70 | ListItem() { |
| 69 | //缺省图 | 71 | //缺省图 |
| 70 | - EmptyComponent({emptyType:4}) | ||
| 71 | - .height('612lpx') | ||
| 72 | - .width('100%') | 72 | + if(this.isConnectNetwork){ |
| 73 | + EmptyComponent({emptyType:4}) | ||
| 74 | + .height('612lpx') | ||
| 75 | + .width('100%') | ||
| 76 | + }else{ | ||
| 77 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 78 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 79 | + if(this.isConnectNetwork){ | ||
| 80 | + if (this.onClickTryAgain !== undefined) { | ||
| 81 | + this.onClickTryAgain() | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + }}) | ||
| 85 | + .height("100%") | ||
| 86 | + .width('100%') | ||
| 87 | + } | ||
| 73 | } | 88 | } |
| 74 | if(this.suggest_count > 0){ | 89 | if(this.suggest_count > 0){ |
| 75 | ListItem() { | 90 | ListItem() { |
-
Please register or login to post a comment