Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
12 changed files
with
203 additions
and
124 deletions
| @@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base'; | @@ -25,6 +25,9 @@ import { BusinessError } from '@ohos.base'; | ||
| 25 | import { CommonConstants, SpConstants } from 'wdConstant/Index'; | 25 | import { CommonConstants, SpConstants } from 'wdConstant/Index'; |
| 26 | import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' | 26 | import { CardMediaInfo } from '../components/cardCommon/CardMediaInfo' |
| 27 | import router from '@ohos.router'; | 27 | import router from '@ohos.router'; |
| 28 | +import { publishCommentModel } from './comment/model/PublishCommentModel'; | ||
| 29 | +import { CommentComponent } from './comment/view/CommentComponent'; | ||
| 30 | + | ||
| 28 | const TAG = 'DynamicDetailComponent' | 31 | const TAG = 'DynamicDetailComponent' |
| 29 | @Preview | 32 | @Preview |
| 30 | @Component | 33 | @Component |
| @@ -50,6 +53,8 @@ export struct DynamicDetailComponent { | @@ -50,6 +53,8 @@ export struct DynamicDetailComponent { | ||
| 50 | //跳转 | 53 | //跳转 |
| 51 | private mJumpInfo: ContentDTO = {} as ContentDTO; | 54 | private mJumpInfo: ContentDTO = {} as ContentDTO; |
| 52 | 55 | ||
| 56 | + @State publishCommentModel: publishCommentModel = new publishCommentModel() | ||
| 57 | + | ||
| 53 | async aboutToAppear() { | 58 | async aboutToAppear() { |
| 54 | await this.getContentDetailData() | 59 | await this.getContentDetailData() |
| 55 | } | 60 | } |
| @@ -355,8 +360,14 @@ export struct DynamicDetailComponent { | @@ -355,8 +360,14 @@ export struct DynamicDetailComponent { | ||
| 355 | //点赞操作 | 360 | //点赞操作 |
| 356 | this.toggleLikeStatus() | 361 | this.toggleLikeStatus() |
| 357 | }) | 362 | }) |
| 363 | + // 评论 | ||
| 364 | + if (this.contentDetailData?.openComment) { | ||
| 365 | + Divider().strokeWidth(6).color('#f5f5f5') | ||
| 366 | + CommentComponent({ | ||
| 367 | + publishCommentModel: this.publishCommentModel | ||
| 368 | + }) | ||
| 369 | + } | ||
| 358 | Blank().layoutWeight(1) | 370 | Blank().layoutWeight(1) |
| 359 | - //fixme 评论组件 | ||
| 360 | } | 371 | } |
| 361 | } | 372 | } |
| 362 | .width(CommonConstants.FULL_WIDTH) | 373 | .width(CommonConstants.FULL_WIDTH) |
| @@ -365,7 +376,11 @@ export struct DynamicDetailComponent { | @@ -365,7 +376,11 @@ export struct DynamicDetailComponent { | ||
| 365 | .scrollBar(BarState.Off) | 376 | .scrollBar(BarState.Off) |
| 366 | .alignSelf(ItemAlign.Start) | 377 | .alignSelf(ItemAlign.Start) |
| 367 | //底部交互区 | 378 | //底部交互区 |
| 368 | - OperRowListView({ contentDetailData: this.contentDetailData,interactData:this.interactDataDTO,newsStatusOfUser:this.newsStatusOfUser }) | 379 | + OperRowListView({ contentDetailData: this.contentDetailData |
| 380 | + ,interactData:this.interactDataDTO | ||
| 381 | + ,newsStatusOfUser:this.newsStatusOfUser | ||
| 382 | + ,publishCommentModel: this.publishCommentModel | ||
| 383 | + ,needLike:false}) | ||
| 369 | } | 384 | } |
| 370 | } | 385 | } |
| 371 | .alignSelf(ItemAlign.Start) | 386 | .alignSelf(ItemAlign.Start) |
| @@ -384,6 +399,17 @@ export struct DynamicDetailComponent { | @@ -384,6 +399,17 @@ export struct DynamicDetailComponent { | ||
| 384 | } catch (exception) { | 399 | } catch (exception) { |
| 385 | console.log('请求失败',JSON.stringify(exception)) | 400 | console.log('请求失败',JSON.stringify(exception)) |
| 386 | } | 401 | } |
| 402 | + if (this.contentDetailData.openComment) { | ||
| 403 | + this.publishCommentModel = { | ||
| 404 | + targetId: String(this.contentDetailData?.newsId || ''), | ||
| 405 | + targetRelId: this.contentDetailData?.reLInfo?.relId, | ||
| 406 | + targetTitle: this.contentDetailData?.newsTitle, | ||
| 407 | + targetRelType: this.contentDetailData?.reLInfo?.relType, | ||
| 408 | + targetRelObjectId: String(this.contentDetailData?.reLInfo?.relObjectId), | ||
| 409 | + keyArticle: String(this.contentDetailData?.keyArticle), | ||
| 410 | + targetType: String(this.contentDetailData?.newsType), | ||
| 411 | + } as publishCommentModel | ||
| 412 | + } | ||
| 387 | this.getBatchAttentionStatus() | 413 | this.getBatchAttentionStatus() |
| 388 | this.getInteractDataStatus() | 414 | this.getInteractDataStatus() |
| 389 | this.makeJumpInfo() | 415 | this.makeJumpInfo() |
| @@ -184,15 +184,13 @@ export struct ImageAndTextPageComponent { | @@ -184,15 +184,13 @@ export struct ImageAndTextPageComponent { | ||
| 184 | this.queryContentInteractCount() | 184 | this.queryContentInteractCount() |
| 185 | } | 185 | } |
| 186 | if (this.contentDetailData[0]?.openComment) { | 186 | if (this.contentDetailData[0]?.openComment) { |
| 187 | - this.publishCommentModel = { | ||
| 188 | - targetId: String(this.contentDetailData[0]?.newsId || ''), | ||
| 189 | - targetRelId: this.contentDetailData[0]?.reLInfo?.relId, | ||
| 190 | - targetTitle: this.contentDetailData[0]?.newsTitle, | ||
| 191 | - targetRelType: this.contentDetailData[0]?.reLInfo?.relType, | ||
| 192 | - targetRelObjectId: String(this.contentDetailData[0]?.reLInfo?.relObjectId), | ||
| 193 | - keyArticle: String(this.contentDetailData[0]?.keyArticle), | ||
| 194 | - targetType: String(this.contentDetailData[0]?.newsType), | ||
| 195 | - } as publishCommentModel | 187 | + this.publishCommentModel.targetId = String(this.contentDetailData[0]?.newsId || '') |
| 188 | + this.publishCommentModel.targetRelId = String(this.contentDetailData[0]?.reLInfo?.relId) | ||
| 189 | + this.publishCommentModel.targetTitle = this.contentDetailData[0]?.newsTitle | ||
| 190 | + this.publishCommentModel.targetRelType = String(this.contentDetailData[0]?.reLInfo?.relType) | ||
| 191 | + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData[0]?.reLInfo?.relObjectId) | ||
| 192 | + this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | ||
| 193 | + this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | ||
| 196 | } | 194 | } |
| 197 | } | 195 | } |
| 198 | } | 196 | } |
| @@ -84,10 +84,10 @@ export struct PageComponent { | @@ -84,10 +84,10 @@ export struct PageComponent { | ||
| 84 | // 加载更多 | 84 | // 加载更多 |
| 85 | ListItem() { | 85 | ListItem() { |
| 86 | if (this.pageModel.hasMore) { | 86 | if (this.pageModel.hasMore) { |
| 87 | - LoadMoreLayout({ | ||
| 88 | - refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 89 | - this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 90 | - }) | 87 | + // LoadMoreLayout({ |
| 88 | + // refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 89 | + // this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 90 | + // }) | ||
| 91 | } else if (!this.pageModel.contentNeedScroll) { | 91 | } else if (!this.pageModel.contentNeedScroll) { |
| 92 | PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) }) | 92 | PageNoMoreLayout({ noMoreBean: new NoMoreBean(this.pageModel.pageInfo.baselineCopywriting) }) |
| 93 | } | 93 | } |
| 1 | -import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentionContentListTopComponent' | ||
| 2 | -import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 3 | -import { ContentDTO } from 'wdBean' | ||
| 4 | -import { CardParser } from '../CardParser' | ||
| 5 | - | ||
| 6 | -@Preview | ||
| 7 | -@Component | ||
| 8 | -export struct PeopleShipAttentionContentListComponent { | ||
| 9 | - | ||
| 10 | - @Prop followList: FollowListDetailItem[] | ||
| 11 | - | ||
| 12 | - @Prop attentionList: ContentDTO[] | ||
| 13 | - | ||
| 14 | - build() { | ||
| 15 | - List(){ | ||
| 16 | - // 头部关注列表 | ||
| 17 | - ListItem(){ | ||
| 18 | - PeopleShipAttentionContentListTopComponent({ | ||
| 19 | - followList: this.followList | ||
| 20 | - }) | ||
| 21 | - } | ||
| 22 | - ForEach(this.attentionList, (item: ContentDTO) => { | ||
| 23 | - ListItem() { | ||
| 24 | - CardParser({ contentDTO: item }) | ||
| 25 | - }.width("100%") | ||
| 26 | - .backgroundColor(Color.Transparent) | ||
| 27 | - | ||
| 28 | - }, (item: ContentDTO, index: number) => item.objectId + index.toString()) | ||
| 29 | - } | ||
| 30 | - .scrollBar(BarState.Off) | ||
| 31 | - .width('100%') | ||
| 32 | - .height('100%') | ||
| 33 | - } | ||
| 34 | -} | ||
| 35 | - |
| 1 | +import { PeopleShipHomePageHeadComponent } from '../peopleShipHomePage/PeopleShipHomePageHeadComponent' | ||
| 2 | +import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | ||
| 3 | + | ||
| 4 | +@Component | ||
| 5 | +export struct PeopleShipAttentionContentListHeadComponent { | ||
| 6 | + | ||
| 7 | + @State index: number = 0 | ||
| 8 | + @ObjectLink item: FollowListDetailItem | ||
| 9 | + build() { | ||
| 10 | + Column(){ | ||
| 11 | + // 头像 | ||
| 12 | + PeopleShipHomePageHeadComponent({ | ||
| 13 | + diameter: 48, | ||
| 14 | + iconDiameter: 16, | ||
| 15 | + headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') : | ||
| 16 | + ((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ? | ||
| 17 | + this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')), | ||
| 18 | + authIcon: this.index == 0 ? '' : this.item.authIcon | ||
| 19 | + }).margin({ | ||
| 20 | + bottom: '8vp' | ||
| 21 | + }) | ||
| 22 | + | ||
| 23 | + Text(this.index == 0 ? '我的关注' : this.item.attentionUserName) | ||
| 24 | + .fontColor($r('app.color.color_666666')) | ||
| 25 | + .fontSize($r('app.float.vp_13')) | ||
| 26 | + .fontWeight(400) | ||
| 27 | + .height('18vp') | ||
| 28 | + .lineHeight('18vp') | ||
| 29 | + .maxLines(1) | ||
| 30 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 31 | + .padding({ | ||
| 32 | + left: '2vp', | ||
| 33 | + right: '2vp' | ||
| 34 | + }) | ||
| 35 | + } | ||
| 36 | + .alignItems(HorizontalAlign.Center) | ||
| 37 | + .width('78vp') | ||
| 38 | + .margin({ | ||
| 39 | + left: this.index == 0 ? '8vp' : '4vp', | ||
| 40 | + top: '14vp', | ||
| 41 | + bottom: '14vp' | ||
| 42 | + }) | ||
| 43 | + } | ||
| 44 | +} | ||
| 45 | + |
| 1 | import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; | 1 | import { FollowListDetailItem } from '../../viewmodel/FollowListDetailItem'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | -import { PeopleShipHomePageHeadComponent } from '../peopleShipHomePage/PeopleShipHomePageHeadComponent' | ||
| 5 | - | 4 | +import { PeopleShipAttentionContentListHeadComponent } from './PeopleShipAttentionContentListHeadComponent' |
| 6 | 5 | ||
| 7 | @Component | 6 | @Component |
| 8 | export struct PeopleShipAttentionContentListTopComponent { | 7 | export struct PeopleShipAttentionContentListTopComponent { |
| @@ -41,45 +40,3 @@ export struct PeopleShipAttentionContentListTopComponent { | @@ -41,45 +40,3 @@ export struct PeopleShipAttentionContentListTopComponent { | ||
| 41 | } | 40 | } |
| 42 | } | 41 | } |
| 43 | } | 42 | } |
| 44 | - | ||
| 45 | -@Component | ||
| 46 | -struct PeopleShipAttentionContentListHeadComponent { | ||
| 47 | - | ||
| 48 | - @State index: number = 0 | ||
| 49 | - @ObjectLink item: FollowListDetailItem | ||
| 50 | - build() { | ||
| 51 | - Column(){ | ||
| 52 | - // 头像 | ||
| 53 | - PeopleShipHomePageHeadComponent({ | ||
| 54 | - diameter: 48, | ||
| 55 | - iconDiameter: 16, | ||
| 56 | - headPhotoUrl: this.index == 0 ? $r('app.media.attention_mine') : | ||
| 57 | - ((this.item.attentionHeadPhotoUrl && this.item.attentionHeadPhotoUrl.length > 0) ? | ||
| 58 | - this.item.attentionHeadPhotoUrl : $r('app.media.WDAccountOwnerHedaerDefaultIcon')), | ||
| 59 | - authIcon: this.index == 0 ? '' : this.item.authIcon | ||
| 60 | - }).margin({ | ||
| 61 | - bottom: '8vp' | ||
| 62 | - }) | ||
| 63 | - | ||
| 64 | - Text(this.index == 0 ? '我的关注' : this.item.attentionUserName) | ||
| 65 | - .fontColor($r('app.color.color_666666')) | ||
| 66 | - .fontSize($r('app.float.vp_13')) | ||
| 67 | - .fontWeight(400) | ||
| 68 | - .height('18vp') | ||
| 69 | - .lineHeight('18vp') | ||
| 70 | - .maxLines(1) | ||
| 71 | - .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 72 | - .padding({ | ||
| 73 | - left: '2vp', | ||
| 74 | - right: '2vp' | ||
| 75 | - }) | ||
| 76 | - } | ||
| 77 | - .alignItems(HorizontalAlign.Center) | ||
| 78 | - .width('78vp') | ||
| 79 | - .margin({ | ||
| 80 | - left: this.index == 0 ? '8vp' : '4vp', | ||
| 81 | - top: '14vp', | ||
| 82 | - bottom: '14vp' | ||
| 83 | - }) | ||
| 84 | - } | ||
| 85 | -} |
| @@ -2,7 +2,14 @@ import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent'; | @@ -2,7 +2,14 @@ import { PeopleShipRecommendComponent } from './PeopleShipRecommendComponent'; | ||
| 2 | import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; | 2 | import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel'; |
| 3 | import { HttpUtils } from 'wdNetwork/Index'; | 3 | import { HttpUtils } from 'wdNetwork/Index'; |
| 4 | import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit'; | 4 | import { Logger, DateTimeUtils, EmitterEventId, EmitterUtils } from 'wdKit'; |
| 5 | -import { RmhRecommendDTO, ContentDTO, AttentionBatchDTO, CreatorDTO } from 'wdBean'; | 5 | +import { |
| 6 | + RmhRecommendDTO, | ||
| 7 | + ContentDTO, | ||
| 8 | + AttentionBatchDTO, | ||
| 9 | + CreatorDTO, | ||
| 10 | + contentListParams, | ||
| 11 | + InteractDataDTO | ||
| 12 | +} from 'wdBean'; | ||
| 6 | import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; | 13 | import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType'; |
| 7 | import { channelSkeleton } from '../skeleton/channelSkeleton' | 14 | import { channelSkeleton } from '../skeleton/channelSkeleton' |
| 8 | import { EmptyComponent } from '../view/EmptyComponent'; | 15 | import { EmptyComponent } from '../view/EmptyComponent'; |
| @@ -56,6 +63,13 @@ export struct PeopleShipMainComponent { | @@ -56,6 +63,13 @@ export struct PeopleShipMainComponent { | ||
| 56 | this.LoadingLayout() | 63 | this.LoadingLayout() |
| 57 | } else if (this.viewType == ViewType.ERROR) { | 64 | } else if (this.viewType == ViewType.ERROR) { |
| 58 | ErrorComponent() | 65 | ErrorComponent() |
| 66 | + .onTouch((event: TouchEvent | undefined) => { | ||
| 67 | + if (event) { | ||
| 68 | + if (this.viewType === ViewType.ERROR) { | ||
| 69 | + this.getData() | ||
| 70 | + } | ||
| 71 | + } | ||
| 72 | + }) | ||
| 59 | } else if (this.viewType == ViewType.EMPTY) { | 73 | } else if (this.viewType == ViewType.EMPTY) { |
| 60 | EmptyComponent() | 74 | EmptyComponent() |
| 61 | } else { | 75 | } else { |
| @@ -155,11 +169,6 @@ export struct PeopleShipMainComponent { | @@ -155,11 +169,6 @@ export struct PeopleShipMainComponent { | ||
| 155 | .scrollBar(BarState.Off) | 169 | .scrollBar(BarState.Off) |
| 156 | .width('100%') | 170 | .width('100%') |
| 157 | .height('100%') | 171 | .height('100%') |
| 158 | - | ||
| 159 | - // PeopleShipAttentionContentListComponent({ | ||
| 160 | - // followList: this.followList, | ||
| 161 | - // attentionList: this.attentionList | ||
| 162 | - // }) | ||
| 163 | } | 172 | } |
| 164 | 173 | ||
| 165 | aboutToAppear() { | 174 | aboutToAppear() { |
| @@ -259,14 +268,6 @@ export struct PeopleShipMainComponent { | @@ -259,14 +268,6 @@ export struct PeopleShipMainComponent { | ||
| 259 | // 获取列表数据 | 268 | // 获取列表数据 |
| 260 | let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime) | 269 | let listData = await PeopleShipMainViewModel.getAttentionContentListInfo(this.currentPage, 20, this.loadTime) |
| 261 | Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`) | 270 | Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`) |
| 262 | - | ||
| 263 | - if (resolve ) { | ||
| 264 | - if (this.currentPage == 1) { | ||
| 265 | - resolve('已更新至最新') | ||
| 266 | - }else { | ||
| 267 | - resolve('') | ||
| 268 | - } | ||
| 269 | - } | ||
| 270 | if (listData && listData.list && listData.list.length > 0) { | 271 | if (listData && listData.list && listData.list.length > 0) { |
| 271 | if (listData.list.length === 20) { | 272 | if (listData.list.length === 20) { |
| 272 | this.hasMore = true; | 273 | this.hasMore = true; |
| @@ -276,14 +277,71 @@ export struct PeopleShipMainComponent { | @@ -276,14 +277,71 @@ export struct PeopleShipMainComponent { | ||
| 276 | if (this.currentPage == 1) { | 277 | if (this.currentPage == 1) { |
| 277 | this.attentionList = [] | 278 | this.attentionList = [] |
| 278 | } | 279 | } |
| 279 | - this.attentionList.push(...listData.list) | 280 | + //批量查询各类型内容动态数据接口 |
| 281 | + this.checkContentInteractData(listData.list, resolve) | ||
| 282 | + } else { | ||
| 283 | + this.resolveEnd(true, resolve) | ||
| 280 | } | 284 | } |
| 281 | - this.viewType = ViewType.LOADED | ||
| 282 | - this.isLoading = false | 285 | + |
| 286 | + } catch (exception) { | ||
| 287 | + this.resolveEnd(false, resolve) | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + // 批量查询各类型内容动态数据接口 | ||
| 292 | + private async checkContentInteractData(list: ContentDTO[], resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 293 | + // 批量查询内容当前用户点赞、收藏状态 | ||
| 294 | + try { | ||
| 295 | + // 获取列表数据 | ||
| 296 | + const params: contentListParams = { | ||
| 297 | + contentList: [] | ||
| 298 | + } | ||
| 299 | + list.forEach((item: ContentDTO) => { | ||
| 300 | + params.contentList.push({ | ||
| 301 | + contentId: item.objectId, | ||
| 302 | + contentType: Number(item.objectType ?? '1') | ||
| 303 | + }) | ||
| 304 | + }) | ||
| 305 | + | ||
| 306 | + let listData = await PeopleShipMainViewModel.getContentInteractInfo(params) | ||
| 307 | + Logger.debug('PeopleShipMainComponent', '获取页面信息' + `${JSON.stringify(listData)}`) | ||
| 308 | + this.resolveEnd(true, resolve) | ||
| 309 | + list.forEach((element: ContentDTO) => { | ||
| 310 | + // 获取 interactData 数据 | ||
| 311 | + if (listData && listData.length > 0) { | ||
| 312 | + const objc = listData.find((interactModel: InteractDataDTO) => { | ||
| 313 | + return element.objectId == interactModel.contentId | ||
| 314 | + }) | ||
| 315 | + if (objc) { | ||
| 316 | + element.interactData = objc | ||
| 317 | + } | ||
| 318 | + } | ||
| 319 | + // 设置人民号都不可关注 | ||
| 320 | + if (element.rmhInfo) { | ||
| 321 | + element.rmhInfo.cnIsAttention = 0 | ||
| 322 | + } | ||
| 323 | + this.attentionList.push(element) | ||
| 324 | + }) | ||
| 325 | + | ||
| 283 | } catch (exception) { | 326 | } catch (exception) { |
| 327 | + this.resolveEnd(false, resolve) | ||
| 328 | + } | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 332 | + if (resolve) { | ||
| 333 | + if (this.currentPage == 1 && isTop) { | ||
| 334 | + resolve('已更新至最新') | ||
| 335 | + }else { | ||
| 336 | + resolve('') | ||
| 337 | + } | ||
| 338 | + } | ||
| 339 | + if (this.currentPage == 1 && !isTop) { | ||
| 284 | this.viewType = ViewType.ERROR | 340 | this.viewType = ViewType.ERROR |
| 285 | - this.isLoading = false | 341 | + } else { |
| 342 | + this.viewType = ViewType.LOADED | ||
| 286 | } | 343 | } |
| 344 | + this.isLoading = false | ||
| 287 | } | 345 | } |
| 288 | 346 | ||
| 289 | // 说是首页必须要调用 | 347 | // 说是首页必须要调用 |
| @@ -40,11 +40,12 @@ const TAG = 'OperRowListView'; | @@ -40,11 +40,12 @@ const TAG = 'OperRowListView'; | ||
| 40 | export struct OperRowListView { | 40 | export struct OperRowListView { |
| 41 | @Prop contentDetailData: ContentDetailDTO // 稿件详情 | 41 | @Prop contentDetailData: ContentDetailDTO // 稿件详情 |
| 42 | @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] // 组件展示条件 | 42 | @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] // 组件展示条件 |
| 43 | - @Prop publishCommentModel: publishCommentModel | 43 | + @ObjectLink publishCommentModel: publishCommentModel |
| 44 | // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 44 | // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 45 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 45 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 46 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 46 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 47 | @State likeBean: Record<string, string> = {} | 47 | @State likeBean: Record<string, string> = {} |
| 48 | + needLike: boolean = true | ||
| 48 | 49 | ||
| 49 | async aboutToAppear() { | 50 | async aboutToAppear() { |
| 50 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | 51 | const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| @@ -90,7 +91,7 @@ export struct OperRowListView { | @@ -90,7 +91,7 @@ export struct OperRowListView { | ||
| 90 | ForEach(this.operationButtonList, (item: string, index: number) => { | 91 | ForEach(this.operationButtonList, (item: string, index: number) => { |
| 91 | if (item == 'comment') { | 92 | if (item == 'comment') { |
| 92 | this.builderComment() | 93 | this.builderComment() |
| 93 | - } else if (item == 'like') { | 94 | + } else if (item == 'like' && this.needLike) { |
| 94 | this.builderLike() | 95 | this.builderLike() |
| 95 | } else if (item == 'collect') { | 96 | } else if (item == 'collect') { |
| 96 | this.builderCollect() | 97 | this.builderCollect() |
| @@ -262,7 +263,8 @@ export struct OperRowListView { | @@ -262,7 +263,8 @@ export struct OperRowListView { | ||
| 262 | } | 263 | } |
| 263 | } | 264 | } |
| 264 | // console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res)) | 265 | // console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res)) |
| 265 | - console.log(TAG, 'this.interactData', JSON.stringify(this.interactData)) | 266 | + console.log(TAG, 'this.interactData44', JSON.stringify(this.interactData)) |
| 267 | + console.log(TAG, 'this.publishCommentModel', JSON.stringify(this.publishCommentModel)) | ||
| 266 | }) | 268 | }) |
| 267 | } | 269 | } |
| 268 | } | 270 | } |
| @@ -35,7 +35,7 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, | @@ -35,7 +35,7 @@ export function listTouchEvent(pageModel: PageModel, pageAdvModel: PageAdModel, | ||
| 35 | touchUpPullRefresh(pageModel, pageAdvModel); | 35 | touchUpPullRefresh(pageModel, pageAdvModel); |
| 36 | } else { | 36 | } else { |
| 37 | // Fingers up, handle loading more. | 37 | // Fingers up, handle loading more. |
| 38 | - touchUpLoadMore(pageModel); | 38 | + // touchUpLoadMore(pageModel); |
| 39 | } | 39 | } |
| 40 | break; | 40 | break; |
| 41 | default: | 41 | default: |
| @@ -4,13 +4,18 @@ import PageHelper from '../viewmodel/PageHelper'; | @@ -4,13 +4,18 @@ import PageHelper from '../viewmodel/PageHelper'; | ||
| 4 | 4 | ||
| 5 | export function touchMoveLoadMore(model: PageModel, event: TouchEvent) { | 5 | export function touchMoveLoadMore(model: PageModel, event: TouchEvent) { |
| 6 | // list size +1 | 6 | // list size +1 |
| 7 | - if (model.endIndex === model.compList.totalCount() || model.endIndex === model.compList.totalCount() + 1) { | ||
| 8 | - model.offsetY = event.touches[0].y - model.downY; | ||
| 9 | - if (Math.abs(model.offsetY) > vp2px(model.pullUpLoadHeight) / 2) { | 7 | + if (model.endIndex >= model.compList.totalCount()-3 && model.endIndex <= model.compList.totalCount()) { |
| 8 | + // model.offsetY = event.touches[0].y - model.downY; | ||
| 9 | + // if (Math.abs(model.offsetY) > vp2px(model.pullUpLoadHeight) / 2) { | ||
| 10 | + // model.isCanLoadMore = true; | ||
| 11 | + // model.isVisiblePullUpLoad = true; | ||
| 12 | + // model.offsetY = -vp2px(model.pullUpLoadHeight) + model.offsetY * Const.Y_OFF_SET_COEFFICIENT; | ||
| 13 | + // } | ||
| 14 | + | ||
| 15 | + // 不用分页动画,直接预加载 | ||
| 10 | model.isCanLoadMore = true; | 16 | model.isCanLoadMore = true; |
| 11 | model.isVisiblePullUpLoad = true; | 17 | model.isVisiblePullUpLoad = true; |
| 12 | - model.offsetY = -vp2px(model.pullUpLoadHeight) + model.offsetY * Const.Y_OFF_SET_COEFFICIENT; | ||
| 13 | - } | 18 | + touchUpLoadMore(model); |
| 14 | } | 19 | } |
| 15 | } | 20 | } |
| 16 | 21 |
| 1 | import { Logger } from 'wdKit'; | 1 | import { Logger } from 'wdKit'; |
| 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 2 | import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 3 | -import HashMap from '@ohos.util.HashMap'; | ||
| 4 | import { | 3 | import { |
| 5 | RmhRecommendDTO, | 4 | RmhRecommendDTO, |
| 6 | PeopleShipContentListDTO, | 5 | PeopleShipContentListDTO, |
| 7 | - AttentionBatchDTO | 6 | + AttentionBatchDTO, |
| 7 | + contentListParams, | ||
| 8 | + InteractDataDTO | ||
| 8 | } from 'wdBean'; | 9 | } from 'wdBean'; |
| 10 | +import { PageRepository } from '../repository/PageRepository' | ||
| 9 | 11 | ||
| 10 | const TAG = 'PeopleShipMainViewModel' | 12 | const TAG = 'PeopleShipMainViewModel' |
| 11 | 13 | ||
| @@ -103,5 +105,24 @@ export class PeopleShipMainViewModel { | @@ -103,5 +105,24 @@ export class PeopleShipMainViewModel { | ||
| 103 | }) | 105 | }) |
| 104 | } | 106 | } |
| 105 | 107 | ||
| 108 | + static async getContentInteractInfo(params: contentListParams): Promise<InteractDataDTO[]> { | ||
| 109 | + return new Promise<InteractDataDTO[]>((success, error) => { | ||
| 110 | + Logger.debug(TAG, `getContentInteractInfo pageInfo start`); | ||
| 111 | + PageRepository.getContentInteract(params) | ||
| 112 | + .then((resDTO) => { | ||
| 113 | + if (!resDTO.data || resDTO.code != 0) { | ||
| 114 | + error(resDTO.message) | ||
| 115 | + return | ||
| 116 | + } | ||
| 117 | + Logger.debug(TAG, "getContentInteractInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 118 | + success(resDTO.data); | ||
| 119 | + }) | ||
| 120 | + .catch((err: Error) => { | ||
| 121 | + Logger.error(TAG, `getContentInteractInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 122 | + error(err); | ||
| 123 | + }) | ||
| 124 | + }) | ||
| 125 | + } | ||
| 126 | + | ||
| 106 | 127 | ||
| 107 | } | 128 | } |
| @@ -16,6 +16,7 @@ import { | @@ -16,6 +16,7 @@ import { | ||
| 16 | } from 'wdKit'; | 16 | } from 'wdKit'; |
| 17 | import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; | 17 | import { HostEnum, HostManager, WDHttp } from 'wdNetwork'; |
| 18 | import { LoginModule } from 'wdLogin/src/main/ets/LoginModule'; | 18 | import { LoginModule } from 'wdLogin/src/main/ets/LoginModule'; |
| 19 | +import { ConfigurationConstant } from '@kit.AbilityKit'; | ||
| 19 | 20 | ||
| 20 | export default class EntryAbility extends UIAbility { | 21 | export default class EntryAbility extends UIAbility { |
| 21 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { | 22 | onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { |
| @@ -29,7 +30,8 @@ export default class EntryAbility extends UIAbility { | @@ -29,7 +30,8 @@ export default class EntryAbility extends UIAbility { | ||
| 29 | if (StringUtils.isNotEmpty(spHostUrl)) { | 30 | if (StringUtils.isNotEmpty(spHostUrl)) { |
| 30 | HostManager.changeHost(spHostUrl as HostEnum) | 31 | HostManager.changeHost(spHostUrl as HostEnum) |
| 31 | } | 32 | } |
| 32 | - | 33 | + // 还没深色模式需求,暂直接不跟随系统。 |
| 34 | + this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT); | ||
| 33 | // 注册监听网络连接 | 35 | // 注册监听网络连接 |
| 34 | EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => { | 36 | EmitterUtils.receiveEvent(EmitterEventId.NETWORK_CONNECTED, ((str?: string) => { |
| 35 | let type: NetworkType | null = null | 37 | let type: NetworkType | null = null |
-
Please register or login to post a comment