douaojie

fix: 缺省图调整

import ArrayList from '@ohos.util.ArrayList'
import { ViewType } from 'wdConstant/Index';
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index';
import PageModel from '../../../viewmodel/PageModel';
import { commentItemModel, commentListModel, WDPublicUserType } from '../model/CommentModel';
import commentViewModel from '../viewmodel/CommentViewModel'
import { commentItemModel, WDPublicUserType } from '../model/CommentModel';
import commentViewModel from '../viewmodel/CommentViewModel';
import { CommentText } from './CommentText';
import measure from '@ohos.measure'
import { CommentCustomDialog } from './CommentCustomDialog'
import { CommentCustomDialog } from './CommentCustomDialog';
import { publishCommentModel } from '../model/PublishCommentModel';
import { ifaa } from '@kit.OnlineAuthenticationKit';
import { HttpUrlUtils, HttpUtils } from 'wdNetwork/Index';
import NoMoreLayout from '../../page/NoMoreLayout';
import { HttpUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { ColorUtils } from '../../../utils/ColorUtils';
import { EmptyComponent } from '../../view/EmptyComponent';
const TAG = 'CommentComponent';
... ... @@ -23,14 +17,12 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一
@Component
export struct CommentComponent {
@State hasMore: boolean = true;
@State currentPage: number = 1;
@State currentPage: number = 1;
// @State private browSingModel: commentListModel = new commentListModel()
/*必传*/
@ObjectLink publishCommentModel: publishCommentModel
listScroller: ListScroller = new ListScroller(); // scroller控制器
historyOffset: number = 0; // 上次浏览到列表距离顶端的偏移量offset
isloading: boolean = false
@State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
@State dialogController: CustomDialogController | null = null;
... ... @@ -142,7 +134,7 @@ export struct CommentComponent {
build() {
Column() {
List({scroller:this.listScroller}) {
List({ scroller: this.listScroller }) {
ListItemGroup({ header: this.titleHeader() })
LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
... ... @@ -181,10 +173,15 @@ export struct CommentComponent {
// 加载更多
ListItem() {
if (this.hasMore === false) NoMoreLayout()
if (this.hasMore === false) {
// NoMoreLayout()
EmptyComponent({ emptyType: 17 })
.height(300)
}
}
}
.onReachEnd(()=>{
.onReachEnd(() => {
if (this.hasMore) {
this.getData()
}
... ... @@ -197,11 +194,13 @@ export struct CommentComponent {
//获取数据
async getData() {
commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId, this.publishCommentModel.targetType)
commentViewModel.fetchContentCommentList(this.currentPage + '', this.publishCommentModel.targetId,
this.publishCommentModel.targetType)
.then(commentListModel => {
this.currentPage++
if (Number.parseInt(commentListModel.totalCommentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) {
if (Number.parseInt(commentListModel.totalCommentNum) >
Number.parseInt(this.publishCommentModel.totalCommentNumer)) {
this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + ''
}
... ... @@ -223,7 +222,7 @@ export struct CommentComponent {
});
}else{
} else {
this.hasMore = false
}
})
... ...
... ... @@ -231,7 +231,7 @@ export struct EmptyComponent {
this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) {
imageString = $r('app.media.icon_no_comment')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoSearchResult) {
imageString = $r('app.media.icon_no_result')
imageString = $r('app.media.icon_no_result1')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) {
imageString = $r('app.media.icon_no_net1')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) {
... ...