Showing
2 changed files
with
19 additions
and
20 deletions
| 1 | -import ArrayList from '@ohos.util.ArrayList' | ||
| 2 | -import { ViewType } from 'wdConstant/Index'; | ||
| 3 | import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index'; | 1 | import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index'; |
| 4 | -import PageModel from '../../../viewmodel/PageModel'; | ||
| 5 | -import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel'; | ||
| 6 | -import commentViewModel from '../viewmodel/CommentViewModel' | 2 | +import { commentItemModel, WDPublicUserType } from '../model/CommentModel'; |
| 3 | +import commentViewModel from '../viewmodel/CommentViewModel'; | ||
| 7 | import { CommentText } from './CommentText'; | 4 | import { CommentText } from './CommentText'; |
| 8 | -import measure from '@ohos.measure' | ||
| 9 | -import { CommentCustomDialog } from './CommentCustomDialog' | 5 | +import { CommentCustomDialog } from './CommentCustomDialog'; |
| 10 | import { publishCommentModel } from '../model/PublishCommentModel'; | 6 | import { publishCommentModel } from '../model/PublishCommentModel'; |
| 11 | -import { ifaa } from '@kit.OnlineAuthenticationKit'; | ||
| 12 | -import { HttpUrlUtils, HttpUtils } from 'wdNetwork/Index'; | ||
| 13 | -import NoMoreLayout from '../../page/NoMoreLayout'; | 7 | +import { HttpUtils } from 'wdNetwork/Index'; |
| 14 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 8 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 15 | -import { ColorUtils } from '../../../utils/ColorUtils'; | 9 | +import { EmptyComponent } from '../../view/EmptyComponent'; |
| 16 | 10 | ||
| 17 | const TAG = 'CommentComponent'; | 11 | const TAG = 'CommentComponent'; |
| 18 | 12 | ||
| @@ -27,10 +21,8 @@ export struct CommentComponent { | @@ -27,10 +21,8 @@ export struct CommentComponent { | ||
| 27 | // @State private browSingModel: commentListModel = new commentListModel() | 21 | // @State private browSingModel: commentListModel = new commentListModel() |
| 28 | /*必传*/ | 22 | /*必传*/ |
| 29 | @ObjectLink publishCommentModel: publishCommentModel | 23 | @ObjectLink publishCommentModel: publishCommentModel |
| 30 | - | ||
| 31 | listScroller: ListScroller = new ListScroller(); // scroller控制器 | 24 | listScroller: ListScroller = new ListScroller(); // scroller控制器 |
| 32 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset | 25 | historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset |
| 33 | - | ||
| 34 | isloading: boolean = false | 26 | isloading: boolean = false |
| 35 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 27 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 36 | @State dialogController: CustomDialogController | null = null; | 28 | @State dialogController: CustomDialogController | null = null; |
| @@ -142,7 +134,7 @@ export struct CommentComponent { | @@ -142,7 +134,7 @@ export struct CommentComponent { | ||
| 142 | 134 | ||
| 143 | build() { | 135 | build() { |
| 144 | Column() { | 136 | Column() { |
| 145 | - List({scroller:this.listScroller}) { | 137 | + List({ scroller: this.listScroller }) { |
| 146 | ListItemGroup({ header: this.titleHeader() }) | 138 | ListItemGroup({ header: this.titleHeader() }) |
| 147 | 139 | ||
| 148 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | 140 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { |
| @@ -181,10 +173,15 @@ export struct CommentComponent { | @@ -181,10 +173,15 @@ export struct CommentComponent { | ||
| 181 | 173 | ||
| 182 | // 加载更多 | 174 | // 加载更多 |
| 183 | ListItem() { | 175 | ListItem() { |
| 184 | - if (this.hasMore === false) NoMoreLayout() | 176 | + if (this.hasMore === false) { |
| 177 | + // NoMoreLayout() | ||
| 178 | + EmptyComponent({ emptyType: 17 }) | ||
| 179 | + .height(300) | ||
| 185 | } | 180 | } |
| 181 | + | ||
| 186 | } | 182 | } |
| 187 | - .onReachEnd(()=>{ | 183 | + } |
| 184 | + .onReachEnd(() => { | ||
| 188 | if (this.hasMore) { | 185 | if (this.hasMore) { |
| 189 | this.getData() | 186 | this.getData() |
| 190 | } | 187 | } |
| @@ -197,11 +194,13 @@ export struct CommentComponent { | @@ -197,11 +194,13 @@ export struct CommentComponent { | ||
| 197 | 194 | ||
| 198 | //获取数据 | 195 | //获取数据 |
| 199 | async getData() { | 196 | async getData() { |
| 200 | - commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, this.publishCommentModel.targetType) | 197 | + commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, |
| 198 | + this.publishCommentModel.targetType) | ||
| 201 | .then(commentListModel => { | 199 | .then(commentListModel => { |
| 202 | this.currentPage++ | 200 | this.currentPage++ |
| 203 | 201 | ||
| 204 | - if (Number.parseInt(commentListModel.totalCommentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | 202 | + if (Number.parseInt(commentListModel.totalCommentNum) > |
| 203 | + Number.parseInt(this.publishCommentModel.totalCommentNumer)) { | ||
| 205 | this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' | 204 | this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' |
| 206 | } | 205 | } |
| 207 | 206 | ||
| @@ -223,7 +222,7 @@ export struct CommentComponent { | @@ -223,7 +222,7 @@ export struct CommentComponent { | ||
| 223 | }); | 222 | }); |
| 224 | 223 | ||
| 225 | 224 | ||
| 226 | - }else{ | 225 | + } else { |
| 227 | this.hasMore = false | 226 | this.hasMore = false |
| 228 | } | 227 | } |
| 229 | }) | 228 | }) |
| @@ -231,7 +231,7 @@ export struct EmptyComponent { | @@ -231,7 +231,7 @@ export struct EmptyComponent { | ||
| 231 | this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { | 231 | this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { |
| 232 | imageString = $r('app.media.icon_no_comment') | 232 | imageString = $r('app.media.icon_no_comment') |
| 233 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) { | 233 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) { |
| 234 | - imageString = $r('app.media.icon_no_result') | 234 | + imageString = $r('app.media.icon_no_result1') |
| 235 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { | 235 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { |
| 236 | imageString = $r('app.media.icon_no_net1') | 236 | imageString = $r('app.media.icon_no_net1') |
| 237 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) { | 237 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) { |
-
Please register or login to post a comment