陈剑华

Merge remote-tracking branch 'origin/main'

@@ -6,6 +6,7 @@ import { CommentCustomDialog } from './CommentCustomDialog'; @@ -6,6 +6,7 @@ import { CommentCustomDialog } from './CommentCustomDialog';
6 import { publishCommentModel } from '../model/PublishCommentModel'; 6 import { publishCommentModel } from '../model/PublishCommentModel';
7 import { HttpUtils } from 'wdNetwork/Index'; 7 import { HttpUtils } from 'wdNetwork/Index';
8 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 8 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  9 +import NoMoreLayout from '../../page/NoMoreLayout';
9 import { EmptyComponent } from '../../view/EmptyComponent'; 10 import { EmptyComponent } from '../../view/EmptyComponent';
10 11
11 const TAG = 'CommentComponent'; 12 const TAG = 'CommentComponent';
@@ -18,7 +19,7 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一 @@ -18,7 +19,7 @@ const testString = '因为读书的人\n是低着头向上看的人\n身处一
18 export struct CommentComponent { 19 export struct CommentComponent {
19 @State hasMore: boolean = true; 20 @State hasMore: boolean = true;
20 @State currentPage: number = 1; 21 @State currentPage: number = 1;
21 - // @State private browSingModel: commentListModel = new commentListModel() 22 + @State isComments: boolean = true
22 /*必传*/ 23 /*必传*/
23 @ObjectLink publishCommentModel: publishCommentModel 24 @ObjectLink publishCommentModel: publishCommentModel
24 listScroller: ListScroller = new ListScroller(); // scroller控制器 25 listScroller: ListScroller = new ListScroller(); // scroller控制器
@@ -27,6 +28,8 @@ export struct CommentComponent { @@ -27,6 +28,8 @@ export struct CommentComponent {
27 @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); 28 @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource();
28 @State dialogController: CustomDialogController | null = null; 29 @State dialogController: CustomDialogController | null = null;
29 30
  31 + // @State private browSingModel: commentListModel = new commentListModel()
  32 +
30 // 在自定义组件即将析构销毁时将dialogControlle置空 33 // 在自定义组件即将析构销毁时将dialogControlle置空
31 aboutToDisappear() { 34 aboutToDisappear() {
32 this.dialogController = null // 将dialogController置空 35 this.dialogController = null // 将dialogController置空
@@ -137,9 +140,16 @@ export struct CommentComponent { @@ -137,9 +140,16 @@ export struct CommentComponent {
137 List({ scroller: this.listScroller }) { 140 List({ scroller: this.listScroller }) {
138 ListItemGroup({ header: this.titleHeader() }) 141 ListItemGroup({ header: this.titleHeader() })
139 142
  143 + if (!this.isComments) {
  144 + EmptyComponent({ emptyType: 17 })
  145 + .height(300)
  146 + } else {
140 LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { 147 LazyForEach(this.allDatas, (item: commentItemModel, index: number) => {
141 if (item.hasMore) { 148 if (item.hasMore) {
142 - ListItemGroup({ header: this.CommentHeaderItem(item, index), footer: this.GroupFooterView(item, index) }) { 149 + ListItemGroup({
  150 + header: this.CommentHeaderItem(item, index),
  151 + footer: this.GroupFooterView(item, index)
  152 + }) {
143 LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => { 153 LazyForEach(item.childCommentsLazyDataSource, (childItem: commentItemModel, subIndex: number) => {
144 ListItem() { 154 ListItem() {
145 ChildCommentItem({ 155 ChildCommentItem({
@@ -174,18 +184,16 @@ export struct CommentComponent { @@ -174,18 +184,16 @@ export struct CommentComponent {
174 // 加载更多 184 // 加载更多
175 ListItem() { 185 ListItem() {
176 if (this.hasMore === false) { 186 if (this.hasMore === false) {
177 - // NoMoreLayout()  
178 - EmptyComponent({ emptyType: 17 })  
179 - .height(300) 187 + NoMoreLayout()
  188 + }
180 } 189 }
181 -  
182 } 190 }
  191 +
183 } 192 }
184 .onReachEnd(() => { 193 .onReachEnd(() => {
185 if (this.hasMore) { 194 if (this.hasMore) {
186 this.getData() 195 this.getData()
187 } 196 }
188 -  
189 }) 197 })
190 .enableScrollInteraction(false) 198 .enableScrollInteraction(false)
191 } 199 }
@@ -204,6 +212,10 @@ export struct CommentComponent { @@ -204,6 +212,10 @@ export struct CommentComponent {
204 this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + '' 212 this.publishCommentModel.totalCommentNumer = commentListModel.totalCommentNum + ''
205 } 213 }
206 214
  215 + if (commentListModel.list.length === 0) {
  216 + this.isComments = false
  217 + }
  218 +
207 if (commentListModel.hasNext === 0) { 219 if (commentListModel.hasNext === 0) {
208 this.hasMore = false; 220 this.hasMore = false;
209 } else { 221 } else {
@@ -226,7 +238,6 @@ export struct CommentComponent { @@ -226,7 +238,6 @@ export struct CommentComponent {
226 this.hasMore = false 238 this.hasMore = false
227 } 239 }
228 }) 240 })
229 -  
230 } 241 }
231 } 242 }
232 243