Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
21 changed files
with
580 additions
and
131 deletions
| @@ -39,7 +39,7 @@ export const enum CompStyle { | @@ -39,7 +39,7 @@ export const enum CompStyle { | ||
| 39 | Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡 | 39 | Zh_Single_Column_10 = 'Zh_Single_Column-10', //18 服务组合卡 |
| 40 | Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡 | 40 | Zh_Single_Column_11 = 'Zh_Single_Column-11', //19 问政组合卡 |
| 41 | Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡 | 41 | Zh_Grid_Layout_01 = 'Zh_Grid_Layout-01', //4 信息流组合卡 |
| 42 | - Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡 | 42 | + Zh_Grid_Layout_02 = 'Zh_Grid_Layout-02', //7 双列流小视频,一行两图卡 ->标题 |
| 43 | Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡 | 43 | Zh_Grid_Layout_03 = 'Zh_Grid_Layout-03', //11 金刚位卡 |
| 44 | Card_01 = '1', // 小图卡 | 44 | Card_01 = '1', // 小图卡 |
| 45 | Card_02 = '2', // 大图卡 | 45 | Card_02 = '2', // 大图卡 |
| @@ -80,5 +80,7 @@ export const enum CompStyle { | @@ -80,5 +80,7 @@ export const enum CompStyle { | ||
| 80 | /** | 80 | /** |
| 81 | * 本地稿件和组件样式 | 81 | * 本地稿件和组件样式 |
| 82 | */ | 82 | */ |
| 83 | - Card_Comp_Adv = 'card_comp_adv', // | 83 | + Card_Comp_Adv = 'card_comp_adv', // 信息流广告稿件 |
| 84 | + | ||
| 85 | + Card_Comp_Zh_Grid_Layout_02 = 'Card_Comp_Zh_Grid_Layout-02', // 一行两列卡业务内容 | ||
| 84 | } | 86 | } |
| @@ -7,10 +7,11 @@ import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; | @@ -7,10 +7,11 @@ import { VoiceInfoDTO } from '../detail/VoiceInfoDTO'; | ||
| 7 | import { RmhInfoDTO } from '../detail/RmhInfoDTO'; | 7 | import { RmhInfoDTO } from '../detail/RmhInfoDTO'; |
| 8 | import { commentInfo } from './commentInfo'; | 8 | import { commentInfo } from './commentInfo'; |
| 9 | import { BaseDTO } from '../component/BaseDTO'; | 9 | import { BaseDTO } from '../component/BaseDTO'; |
| 10 | +import { LiveRoomDataBean } from '../live/LiveRoomDataBean'; | ||
| 10 | 11 | ||
| 11 | @Observed | 12 | @Observed |
| 12 | export class ContentDTO implements BaseDTO { | 13 | export class ContentDTO implements BaseDTO { |
| 13 | - shareFlag?:string='1'; | 14 | + shareFlag?: string = '1'; |
| 14 | appStyle: string = ''; | 15 | appStyle: string = ''; |
| 15 | cityCode: string = ''; | 16 | cityCode: string = ''; |
| 16 | coverSize: string = ''; | 17 | coverSize: string = ''; |
| @@ -62,8 +63,7 @@ export class ContentDTO implements BaseDTO { | @@ -62,8 +63,7 @@ export class ContentDTO implements BaseDTO { | ||
| 62 | videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 | 63 | videoInfo: VideoInfoDTO = {} as VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的 |
| 63 | 64 | ||
| 64 | newsSummary: string = ''; //appstyle:2 ,新闻详情 | 65 | newsSummary: string = ''; //appstyle:2 ,新闻详情 |
| 65 | - contentText?: string =''; | ||
| 66 | - | 66 | + contentText?: string = ''; |
| 67 | // 二次请求接口,返回的数据,这里组装到content里; | 67 | // 二次请求接口,返回的数据,这里组装到content里; |
| 68 | interactData?: InteractDataDTO; | 68 | interactData?: InteractDataDTO; |
| 69 | hasMore: number = -1; | 69 | hasMore: number = -1; |
| @@ -85,6 +85,10 @@ export class ContentDTO implements BaseDTO { | @@ -85,6 +85,10 @@ export class ContentDTO implements BaseDTO { | ||
| 85 | // 链接类型: 0:无链接;1:内链(文章);2:外链 | 85 | // 链接类型: 0:无链接;1:内链(文章);2:外链 |
| 86 | openType: string = ''; | 86 | openType: string = ''; |
| 87 | extra: string = '' | 87 | extra: string = '' |
| 88 | + /* | ||
| 89 | + 本地辅助字段 | ||
| 90 | + */ | ||
| 91 | + liveRoomDataBean?: LiveRoomDataBean // 批查获取到的直播观看人数 | ||
| 88 | 92 | ||
| 89 | static clone(old: ContentDTO): ContentDTO { | 93 | static clone(old: ContentDTO): ContentDTO { |
| 90 | let content = new ContentDTO(); | 94 | let content = new ContentDTO(); |
| @@ -42,6 +42,16 @@ export interface PageInfoDTO { | @@ -42,6 +42,16 @@ export interface PageInfoDTO { | ||
| 42 | pageAdList:CompAdvBean[] | 42 | pageAdList:CompAdvBean[] |
| 43 | 43 | ||
| 44 | md5:string | 44 | md5:string |
| 45 | + | ||
| 46 | + /* | ||
| 47 | + 信息流页面,最后一个楼层的最后一个组件的信息源 | ||
| 48 | + lastCompSourceType = 0 从楼层接口获取数据(compinfor) | ||
| 49 | + = 1 表示 直播回看数据源 | ||
| 50 | + */ | ||
| 51 | + lastCompSourceType: number | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + | ||
| 45 | } | 55 | } |
| 46 | 56 | ||
| 47 | export interface ChannelInfoDTO { | 57 | export interface ChannelInfoDTO { |
| @@ -44,7 +44,7 @@ export struct CardParser { | @@ -44,7 +44,7 @@ export struct CardParser { | ||
| 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { | 44 | } else if (contentDTO.appStyle === CompStyle.Card_04) { |
| 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) | 45 | Card4Component({ compDTO: this.compDTO, contentDTO }) |
| 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { | 46 | } else if (contentDTO.appStyle === CompStyle.Card_05) { |
| 47 | - Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy, compDTO: this.compDTO }) | 47 | + Card5Component({ contentDTO, titleShowPolicy: this.compDTO.titleShowPolicy}) |
| 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle | 48 | } else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle |
| 49 | .Card_13) { | 49 | .Card_13) { |
| 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) | 50 | Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO }) |
| @@ -8,6 +8,8 @@ import { Card5Component } from './cardview/Card5Component'; | @@ -8,6 +8,8 @@ import { Card5Component } from './cardview/Card5Component'; | ||
| 8 | import { AdvCardParser } from './cardViewAdv/AdvCardParser'; | 8 | import { AdvCardParser } from './cardViewAdv/AdvCardParser'; |
| 9 | import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; | 9 | import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01'; |
| 10 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | 10 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; |
| 11 | +import { ZhGridLayout02News } from './compview/ZhGridLayout02News'; | ||
| 12 | +import { ZhGridLayout02NewsContent } from './compview/ZhGridLayout02NewsContent'; | ||
| 11 | import { ZhGridLayout03 } from './compview/ZhGridLayout03'; | 13 | import { ZhGridLayout03 } from './compview/ZhGridLayout03'; |
| 12 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | 14 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; |
| 13 | import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; | 15 | import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; |
| @@ -37,10 +39,8 @@ export struct CompParser { | @@ -37,10 +39,8 @@ export struct CompParser { | ||
| 37 | 39 | ||
| 38 | build() { | 40 | build() { |
| 39 | Column() { | 41 | Column() { |
| 40 | - if (this.compDTO.name != "月度排行卡") { | ||
| 41 | 42 | ||
| 42 | - this.componentBuilder(); | ||
| 43 | - } | 43 | + this.componentBuilder(); |
| 44 | } | 44 | } |
| 45 | } | 45 | } |
| 46 | 46 | ||
| @@ -75,9 +75,14 @@ export struct CompParser { | @@ -75,9 +75,14 @@ export struct CompParser { | ||
| 75 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | 75 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) { |
| 76 | ZhSingleRow03({ compDTO: this.compDTO }) | 76 | ZhSingleRow03({ compDTO: this.compDTO }) |
| 77 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 77 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 78 | - } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | ||
| 79 | - ZhGridLayout02({ compDTO: this.compDTO }) | ||
| 80 | - Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 78 | + } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 ->标题 |
| 79 | + //ZhGridLayout02({ compDTO: this.compDTO }) | ||
| 80 | + ZhGridLayout02News({ compDTO: this.compDTO }) | ||
| 81 | + // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 82 | + } else if (this.compDTO.compStyle === CompStyle.Card_Comp_Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 | ||
| 83 | + | ||
| 84 | + ZhGridLayout02NewsContent({ compDTO: this.compDTO }) | ||
| 85 | + | ||
| 81 | } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | 86 | } else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { |
| 82 | ZhGridLayout03({ compDTO: this.compDTO }) | 87 | ZhGridLayout03({ compDTO: this.compDTO }) |
| 83 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 88 | Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| @@ -105,7 +110,7 @@ export struct CompParser { | @@ -105,7 +110,7 @@ export struct CompParser { | ||
| 105 | // ZhSingleColumn05({ compDTO: compDTO }) | 110 | // ZhSingleColumn05({ compDTO: compDTO }) |
| 106 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | 111 | // Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) |
| 107 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { | 112 | } else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) { |
| 108 | - Divider().strokeWidth(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({top: -3}) | 113 | + Divider().strokeWidth(3).color('#ffffff').padding({ left: 16, right: 16 }).margin({ top: -3 }) |
| 109 | Divider().strokeWidth(6).color('#f5f5f5') | 114 | Divider().strokeWidth(6).color('#f5f5f5') |
| 110 | ZhSingleColumn09({ compDTO: this.compDTO }) | 115 | ZhSingleColumn09({ compDTO: this.compDTO }) |
| 111 | Divider().strokeWidth(6).color('#f5f5f5') | 116 | Divider().strokeWidth(6).color('#f5f5f5') |
| @@ -41,6 +41,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel'; | @@ -41,6 +41,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel'; | ||
| 41 | import { CommentComponent } from './comment/view/CommentComponent'; | 41 | import { CommentComponent } from './comment/view/CommentComponent'; |
| 42 | import { EmptyComponent } from './view/EmptyComponent'; | 42 | import { EmptyComponent } from './view/EmptyComponent'; |
| 43 | import { detailedSkeleton } from './skeleton/detailSkeleton'; | 43 | import { detailedSkeleton } from './skeleton/detailSkeleton'; |
| 44 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 45 | +import { common } from '@kit.AbilityKit'; | ||
| 44 | 46 | ||
| 45 | const TAG = 'DynamicDetailComponent' | 47 | const TAG = 'DynamicDetailComponent' |
| 46 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 48 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| @@ -602,6 +604,7 @@ export struct DynamicDetailComponent { | @@ -602,6 +604,7 @@ export struct DynamicDetailComponent { | ||
| 602 | this.getInteractDataStatus() | 604 | this.getInteractDataStatus() |
| 603 | this.makeJumpInfo() | 605 | this.makeJumpInfo() |
| 604 | this.interactDataV2() | 606 | this.interactDataV2() |
| 607 | + this.viewBlogInsightIntentShare() | ||
| 605 | } | 608 | } |
| 606 | 609 | ||
| 607 | private async interactDataV2() { | 610 | private async interactDataV2() { |
| @@ -761,6 +764,14 @@ export struct DynamicDetailComponent { | @@ -761,6 +764,14 @@ export struct DynamicDetailComponent { | ||
| 761 | console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) | 764 | console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactDataDTO?.likeNum) |
| 762 | }) | 765 | }) |
| 763 | } | 766 | } |
| 767 | + | ||
| 768 | + /** | ||
| 769 | + * 意图上报 | ||
| 770 | + */ | ||
| 771 | + private viewBlogInsightIntentShare(){ | ||
| 772 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 773 | + viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactDataDTO) | ||
| 774 | + } | ||
| 764 | } | 775 | } |
| 765 | 776 | ||
| 766 | interface radiusType { | 777 | interface radiusType { |
| @@ -31,6 +31,8 @@ import { publishCommentModel } from '../components/comment/model/PublishCommentM | @@ -31,6 +31,8 @@ import { publishCommentModel } from '../components/comment/model/PublishCommentM | ||
| 31 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 31 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 32 | import { CommentComponent } from '../components/comment/view/CommentComponent' | 32 | import { CommentComponent } from '../components/comment/view/CommentComponent' |
| 33 | import { HttpUtils } from 'wdNetwork/Index'; | 33 | import { HttpUtils } from 'wdNetwork/Index'; |
| 34 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 35 | +import { common } from '@kit.AbilityKit'; | ||
| 34 | 36 | ||
| 35 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 37 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 36 | 38 | ||
| @@ -56,7 +58,6 @@ export struct ImageAndTextPageComponent { | @@ -56,7 +58,6 @@ export struct ImageAndTextPageComponent { | ||
| 56 | @State likeNum: number = 0 | 58 | @State likeNum: number = 0 |
| 57 | @State reachEndIncreament: number = 0 | 59 | @State reachEndIncreament: number = 0 |
| 58 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 60 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 59 | - | ||
| 60 | build() { | 61 | build() { |
| 61 | Stack({ alignContent: Alignment.Top }) { | 62 | Stack({ alignContent: Alignment.Top }) { |
| 62 | Stack({ alignContent: Alignment.Bottom }) { | 63 | Stack({ alignContent: Alignment.Bottom }) { |
| @@ -261,10 +262,20 @@ export struct ImageAndTextPageComponent { | @@ -261,10 +262,20 @@ export struct ImageAndTextPageComponent { | ||
| 261 | } else { | 262 | } else { |
| 262 | this.operationButtonList = ['comment', 'collect', 'share'] | 263 | this.operationButtonList = ['comment', 'collect', 'share'] |
| 263 | } | 264 | } |
| 265 | + | ||
| 266 | + //意图上报 | ||
| 267 | + this.viewBlogInsightIntentShare() | ||
| 264 | } | 268 | } |
| 265 | } | 269 | } |
| 266 | } | 270 | } |
| 267 | 271 | ||
| 272 | + //意图上报 | ||
| 273 | + private viewBlogInsightIntentShare(){ | ||
| 274 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 275 | + viewBlogItemInsightIntentShare(context,this.contentDetailData, this.interactData) | ||
| 276 | + } | ||
| 277 | + | ||
| 278 | + | ||
| 268 | private async getRecommend() { | 279 | private async getRecommend() { |
| 269 | let params: postRecommendListParams = { | 280 | let params: postRecommendListParams = { |
| 270 | imei: HttpUtils.getImei(), | 281 | imei: HttpUtils.getImei(), |
| @@ -341,6 +352,7 @@ export struct ImageAndTextPageComponent { | @@ -341,6 +352,7 @@ export struct ImageAndTextPageComponent { | ||
| 341 | } | 352 | } |
| 342 | PageRepository.getContentInteract(params).then(res => { | 353 | PageRepository.getContentInteract(params).then(res => { |
| 343 | if (res.data) { | 354 | if (res.data) { |
| 355 | + this.interactData = res.data[0] | ||
| 344 | this.likeNum = Number(res.data[0]?.likeNum) || 0 | 356 | this.likeNum = Number(res.data[0]?.likeNum) || 0 |
| 345 | } | 357 | } |
| 346 | }) | 358 | }) |
| @@ -22,6 +22,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | @@ -22,6 +22,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 22 | import { PageRepository } from '../repository/PageRepository'; | 22 | import { PageRepository } from '../repository/PageRepository'; |
| 23 | import { SpConstants } from 'wdConstant/Index'; | 23 | import { SpConstants } from 'wdConstant/Index'; |
| 24 | import { router } from '@kit.ArkUI'; | 24 | import { router } from '@kit.ArkUI'; |
| 25 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 26 | +import { common } from '@kit.AbilityKit'; | ||
| 25 | 27 | ||
| 26 | const TAG = 'MultiPictureDetailPageComponent'; | 28 | const TAG = 'MultiPictureDetailPageComponent'; |
| 27 | 29 | ||
| @@ -467,6 +469,7 @@ export struct MultiPictureDetailPageComponent { | @@ -467,6 +469,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 467 | this.getInteractBrowsOperate() | 469 | this.getInteractBrowsOperate() |
| 468 | this.getBatchAttentionStatus() | 470 | this.getBatchAttentionStatus() |
| 469 | } | 471 | } |
| 472 | + this.viewBlogInsightIntentShare() | ||
| 470 | }) | 473 | }) |
| 471 | .catch((err: Error) => { | 474 | .catch((err: Error) => { |
| 472 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | 475 | Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); |
| @@ -544,4 +547,12 @@ export struct MultiPictureDetailPageComponent { | @@ -544,4 +547,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 544 | } | 547 | } |
| 545 | }) | 548 | }) |
| 546 | } | 549 | } |
| 550 | + | ||
| 551 | + /** | ||
| 552 | + * 意图上报 | ||
| 553 | + */ | ||
| 554 | + private viewBlogInsightIntentShare(){ | ||
| 555 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 556 | + viewBlogItemInsightIntentShare(context,this.contentDetailData) | ||
| 557 | + } | ||
| 547 | } | 558 | } |
| @@ -10,6 +10,8 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | @@ -10,6 +10,8 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 10 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 11 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 11 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 12 | import { NetworkUtil, WindowModel } from 'wdKit'; | 12 | import { NetworkUtil, WindowModel } from 'wdKit'; |
| 13 | +import { viewBlogItemInsightIntentShare } from '../utils/InsightIntentShare' | ||
| 14 | +import { common } from '@kit.AbilityKit'; | ||
| 13 | 15 | ||
| 14 | const TAG: string = 'SpacialTopicPageComponent' | 16 | const TAG: string = 'SpacialTopicPageComponent' |
| 15 | 17 | ||
| @@ -49,6 +51,12 @@ export struct SpacialTopicPageComponent { | @@ -49,6 +51,12 @@ export struct SpacialTopicPageComponent { | ||
| 49 | }) | 51 | }) |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 54 | + //意图上报 | ||
| 55 | + private viewBlogInsightIntentShare(){ | ||
| 56 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 57 | + viewBlogItemInsightIntentShare(context,this.contentDetailData) | ||
| 58 | + } | ||
| 59 | + | ||
| 52 | private async getDetail() { | 60 | private async getDetail() { |
| 53 | this.isNetConnected = NetworkUtil.isNetConnected() | 61 | this.isNetConnected = NetworkUtil.isNetConnected() |
| 54 | 62 | ||
| @@ -71,6 +79,7 @@ export struct SpacialTopicPageComponent { | @@ -71,6 +79,7 @@ export struct SpacialTopicPageComponent { | ||
| 71 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 79 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 72 | if (detailBeans && detailBeans.length > 0) { | 80 | if (detailBeans && detailBeans.length > 0) { |
| 73 | this.contentDetailData = detailBeans[0]; | 81 | this.contentDetailData = detailBeans[0]; |
| 82 | + this.viewBlogInsightIntentShare() | ||
| 74 | // if (this.contentDetailData[0]?.openComment) { | 83 | // if (this.contentDetailData[0]?.openComment) { |
| 75 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') | 84 | this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '') |
| 76 | this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') | 85 | this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId || '') |
| @@ -3,8 +3,6 @@ import { CommonConstants } from 'wdConstant'; | @@ -3,8 +3,6 @@ import { CommonConstants } from 'wdConstant'; | ||
| 3 | import { ProcessUtils } from 'wdRouter'; | 3 | import { ProcessUtils } from 'wdRouter'; |
| 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 4 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 5 | import { Notes } from './notes'; | 5 | import { Notes } from './notes'; |
| 6 | -import { viewBlogInsightIntentShare, ActionMode } from '../../utils/InsightIntentShare' | ||
| 7 | -import { common } from '@kit.AbilityKit'; | ||
| 8 | 6 | ||
| 9 | const TAG: string = 'Card5Component'; | 7 | const TAG: string = 'Card5Component'; |
| 10 | 8 | ||
| @@ -15,7 +13,6 @@ const TAG: string = 'Card5Component'; | @@ -15,7 +13,6 @@ const TAG: string = 'Card5Component'; | ||
| 15 | export struct Card5Component { | 13 | export struct Card5Component { |
| 16 | @State contentDTO: ContentDTO = new ContentDTO(); | 14 | @State contentDTO: ContentDTO = new ContentDTO(); |
| 17 | @Prop titleShowPolicy: number | string | 15 | @Prop titleShowPolicy: number | string |
| 18 | - @Prop compDTO: CompDTO = {} as CompDTO | ||
| 19 | @State loadImg: boolean = false; | 16 | @State loadImg: boolean = false; |
| 20 | @State clicked: boolean = false; | 17 | @State clicked: boolean = false; |
| 21 | @State titleMarked: boolean = false; | 18 | @State titleMarked: boolean = false; |
| @@ -100,8 +97,6 @@ export struct Card5Component { | @@ -100,8 +97,6 @@ export struct Card5Component { | ||
| 100 | .onClick((event: ClickEvent) => { | 97 | .onClick((event: ClickEvent) => { |
| 101 | this.clicked = true; | 98 | this.clicked = true; |
| 102 | ProcessUtils.processPage(this.contentDTO) | 99 | ProcessUtils.processPage(this.contentDTO) |
| 103 | - let context = getContext(this) as common.UIAbilityContext; | ||
| 104 | - viewBlogInsightIntentShare(context, this.contentDTO?.channelId, [this.compDTO], ActionMode.EXECUTED) | ||
| 105 | }) | 100 | }) |
| 106 | 101 | ||
| 107 | } | 102 | } |
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02News.ets
0 → 100644
| 1 | +import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | +import { Logger } from 'wdKit/Index'; | ||
| 4 | +import { ProcessUtils } from 'wdRouter'; | ||
| 5 | +import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 双图卡 的标题组件 | ||
| 11 | + * | ||
| 12 | + */ | ||
| 13 | +@Component | ||
| 14 | +export struct ZhGridLayout02News { | ||
| 15 | + @State compDTO: CompDTO = new CompDTO | ||
| 16 | + | ||
| 17 | + aboutToAppear() { | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + build() { | ||
| 21 | + Column() { | ||
| 22 | + Row() { | ||
| 23 | + Image($r("app.media.redLine")) | ||
| 24 | + .width(3) | ||
| 25 | + .height(16) | ||
| 26 | + .margin({ right: 4 }) | ||
| 27 | + Text(this.compDTO.objectTitle) | ||
| 28 | + .fontSize($r("app.float.font_size_17")) | ||
| 29 | + .fontColor($r("app.color.color_222222")) | ||
| 30 | + .fontWeight(600) | ||
| 31 | + } | ||
| 32 | + .justifyContent(FlexAlign.Start) | ||
| 33 | + .margin({ top: 16, bottom: 8 }) | ||
| 34 | + .width(CommonConstants.FULL_WIDTH) | ||
| 35 | + } | ||
| 36 | + .width(CommonConstants.FULL_WIDTH) | ||
| 37 | + .padding({ left: 16, right: 16 }) | ||
| 38 | + | ||
| 39 | + } | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | + |
sight_harmony/features/wdComponent/src/main/ets/components/compview/ZhGridLayout02NewsContent.ets
0 → 100644
| 1 | +import { CompDTO, ContentDTO, LiveRoomDataBean } from 'wdBean'; | ||
| 2 | +import { CommonConstants } from 'wdConstant/Index'; | ||
| 3 | +import { Logger } from 'wdKit/Index'; | ||
| 4 | +import { ProcessUtils } from 'wdRouter'; | ||
| 5 | +import PageViewModel from '../../viewmodel/PageViewModel'; | ||
| 6 | +import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | ||
| 7 | + | ||
| 8 | +let listSize: number = 2; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 双图卡 的标题组件 | ||
| 12 | + * | ||
| 13 | + */ | ||
| 14 | +@Component | ||
| 15 | +export struct ZhGridLayout02NewsContent { | ||
| 16 | + @ObjectLink compDTO: CompDTO | ||
| 17 | + @State loadImg: boolean = false; | ||
| 18 | + | ||
| 19 | + async aboutToAppear(): Promise<void> { | ||
| 20 | + | ||
| 21 | + this.loadImg = await onlyWifiLoadImg(); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + build() { | ||
| 25 | + | ||
| 26 | + if (this.compDTO != undefined) { | ||
| 27 | + GridRow({ | ||
| 28 | + gutter: { x: 12, y: 13 }, | ||
| 29 | + columns: { sm: listSize, md: 2 }, | ||
| 30 | + breakpoints: { value: ['320vp', '520vp', '840vp'] } | ||
| 31 | + }) { | ||
| 32 | + ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | ||
| 33 | + GridCol() { | ||
| 34 | + this.buildItemCard(item); | ||
| 35 | + } | ||
| 36 | + }) | ||
| 37 | + }.width("100%").padding({ left: 16, right: 16 }) | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Builder | ||
| 43 | + buildItemCard(item: ContentDTO) { | ||
| 44 | + Column() { | ||
| 45 | + Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 46 | + Image(this.loadImg ? item.fullColumnImgUrls[0].url : '') | ||
| 47 | + .backgroundColor(0xf5f5f5) | ||
| 48 | + .width('100%') | ||
| 49 | + .height(95) | ||
| 50 | + .borderRadius(4) | ||
| 51 | + if (item.liveRoomDataBean != null && item.liveRoomDataBean.pv > 0) { | ||
| 52 | + Text(this.computeShowNum(item.liveRoomDataBean.pv)) | ||
| 53 | + .fontSize('11vp') | ||
| 54 | + .fontWeight(400) | ||
| 55 | + .fontColor(Color.White) | ||
| 56 | + .margin({ | ||
| 57 | + right: '5vp', | ||
| 58 | + bottom: '5vp' | ||
| 59 | + }) | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + Text(item.newsTitle) | ||
| 64 | + .margin({ top: '6',bottom:'10' }) | ||
| 65 | + .fontSize(13) | ||
| 66 | + .maxLines(2) | ||
| 67 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 68 | + } | ||
| 69 | + .width('100%') | ||
| 70 | + .onClick(() => { | ||
| 71 | + ProcessUtils.processPage(item) | ||
| 72 | + }) | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + private computeShowNum(count: number): string { | ||
| 76 | + if (count >= 10000) { | ||
| 77 | + let num = (count / 10000).toFixed(1) | ||
| 78 | + if (Number(num.substring(num.length - 1)) == 0) { | ||
| 79 | + num = num.substring(0, num.length - 2) | ||
| 80 | + } | ||
| 81 | + return num + '万人参加' | ||
| 82 | + } | ||
| 83 | + return `${count}人参加` | ||
| 84 | + } | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | + |
| 1 | import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' | 1 | import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent' |
| 2 | import { RmhRecommendDTO } from 'wdBean'; | 2 | import { RmhRecommendDTO } from 'wdBean'; |
| 3 | -import { faceDetector } from '@kit.CoreVisionKit'; | ||
| 4 | 3 | ||
| 5 | @Component | 4 | @Component |
| 6 | export struct PeopleShipRecommendComponent { | 5 | export struct PeopleShipRecommendComponent { |
| @@ -28,7 +28,7 @@ const TAG: string = 'ReserveMorePage'; | @@ -28,7 +28,7 @@ const TAG: string = 'ReserveMorePage'; | ||
| 28 | @Component | 28 | @Component |
| 29 | struct ReserveMorePage { | 29 | struct ReserveMorePage { |
| 30 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); | 30 | @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); |
| 31 | - @State reserveList: ReserveItemBean[] = [] | 31 | + private reserveList: ReserveItemBean[] = [] |
| 32 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | 32 | topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; |
| 33 | type: number = 2; | 33 | type: number = 2; |
| 34 | pageSize: number = 20; | 34 | pageSize: number = 20; |
| @@ -312,8 +312,15 @@ struct ReserveMorePage { | @@ -312,8 +312,15 @@ struct ReserveMorePage { | ||
| 312 | Logger.debug(TAG,'是否关注元数据2:' +` ${JSON.stringify(element.subscribe)}`) | 312 | Logger.debug(TAG,'是否关注元数据2:' +` ${JSON.stringify(element.subscribe)}`) |
| 313 | element.subscribe = !element.subscribe | 313 | element.subscribe = !element.subscribe |
| 314 | Logger.debug(TAG,'是否关注元数据3:' +` ${JSON.stringify(element.subscribe)}`) | 314 | Logger.debug(TAG,'是否关注元数据3:' +` ${JSON.stringify(element.subscribe)}`) |
| 315 | - this.data.reloadData() | ||
| 316 | this.isShow = true | 315 | this.isShow = true |
| 316 | + if (element.subscribe) { | ||
| 317 | + this.reservedIds.push(element.liveId.toString()) | ||
| 318 | + }else { | ||
| 319 | + const num = this.reservedIds.indexOf(element.liveId.toString()) | ||
| 320 | + if (num >= 0 && num < this.reservedIds.length) { | ||
| 321 | + this.reservedIds.splice(num, 1) | ||
| 322 | + } | ||
| 323 | + } | ||
| 317 | } | 324 | } |
| 318 | } | 325 | } |
| 319 | }) | 326 | }) |
| @@ -349,6 +356,7 @@ struct ReserveMorePage { | @@ -349,6 +356,7 @@ struct ReserveMorePage { | ||
| 349 | if (this.currentPage == 1) { | 356 | if (this.currentPage == 1) { |
| 350 | this.data.clear() | 357 | this.data.clear() |
| 351 | this.reserveList = [] | 358 | this.reserveList = [] |
| 359 | + this.reservedIds = [] | ||
| 352 | } | 360 | } |
| 353 | this.data.push(...liveReviewDTO.list) | 361 | this.data.push(...liveReviewDTO.list) |
| 354 | //批量查询关注状态 | 362 | //批量查询关注状态 |
| @@ -396,7 +404,12 @@ struct ReserveMorePage { | @@ -396,7 +404,12 @@ struct ReserveMorePage { | ||
| 396 | Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`) | 404 | Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`) |
| 397 | if (result && result.length > 0) { | 405 | if (result && result.length > 0) { |
| 398 | this.reserveList.push(...result) | 406 | this.reserveList.push(...result) |
| 399 | - this.data.reloadData() | 407 | + // this.reserveStatus = res; |
| 408 | + result.map((item: ReserveItemBean) => { | ||
| 409 | + if (item.subscribe) { | ||
| 410 | + this.reservedIds.push(item.liveId.toString()) | ||
| 411 | + } | ||
| 412 | + }) | ||
| 400 | } | 413 | } |
| 401 | }).catch(() =>{ | 414 | }).catch(() =>{ |
| 402 | // this.data.push(...list) | 415 | // this.data.push(...list) |
| @@ -409,11 +422,7 @@ struct ReserveMorePage { | @@ -409,11 +422,7 @@ struct ReserveMorePage { | ||
| 409 | 422 | ||
| 410 | // 判断是否预约 | 423 | // 判断是否预约 |
| 411 | isReserved(item: ContentDTO) { | 424 | isReserved(item: ContentDTO) { |
| 412 | - const objc = this.getAttentionItem(item) | ||
| 413 | - if (objc) { | ||
| 414 | - return objc.subscribe | ||
| 415 | - } | ||
| 416 | - return false | 425 | + return this.reservedIds.includes(item.objectId) |
| 417 | } | 426 | } |
| 418 | 427 | ||
| 419 | getAttentionItem(item: ContentDTO) { | 428 | getAttentionItem(item: ContentDTO) { |
| @@ -460,9 +469,17 @@ struct ReserveMorePage { | @@ -460,9 +469,17 @@ struct ReserveMorePage { | ||
| 460 | Logger.debug(TAG,'是否关注元数据:' +` ${JSON.stringify(element.subscribe)}`) | 469 | Logger.debug(TAG,'是否关注元数据:' +` ${JSON.stringify(element.subscribe)}`) |
| 461 | element.subscribe = !element.subscribe | 470 | element.subscribe = !element.subscribe |
| 462 | Logger.debug(TAG,'是否关注元数据1:' +` ${JSON.stringify(element.subscribe)}`) | 471 | Logger.debug(TAG,'是否关注元数据1:' +` ${JSON.stringify(element.subscribe)}`) |
| 463 | - this.data.reloadData() | 472 | + if (element.subscribe) { |
| 473 | + this.reservedIds.push(element.liveId.toString()) | ||
| 474 | + }else { | ||
| 475 | + const num = this.reservedIds.indexOf(element.liveId.toString()) | ||
| 476 | + if (num >= 0 && num < this.reservedIds.length) { | ||
| 477 | + this.reservedIds.splice(num, 1) | ||
| 478 | + } | ||
| 479 | + } | ||
| 464 | } | 480 | } |
| 465 | }) | 481 | }) |
| 482 | + | ||
| 466 | } | 483 | } |
| 467 | this.isLoadingAttention = false | 484 | this.isLoadingAttention = false |
| 468 | this.liveId = '' | 485 | this.liveId = '' |
| @@ -31,7 +31,6 @@ export struct SearchComponent { | @@ -31,7 +31,6 @@ export struct SearchComponent { | ||
| 31 | scroller: Scroller = new Scroller() | 31 | scroller: Scroller = new Scroller() |
| 32 | @State count:string[] = [] | 32 | @State count:string[] = [] |
| 33 | @State isGetRequest:boolean = false; | 33 | @State isGetRequest:boolean = false; |
| 34 | - @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 35 | 34 | ||
| 36 | aboutToAppear() { | 35 | aboutToAppear() { |
| 37 | //获取提示滚动 | 36 | //获取提示滚动 |
| @@ -129,16 +128,8 @@ export struct SearchComponent { | @@ -129,16 +128,8 @@ export struct SearchComponent { | ||
| 129 | .padding({ left: '31lpx', right: '31lpx' }) | 128 | .padding({ left: '31lpx', right: '31lpx' }) |
| 130 | } else { | 129 | } else { |
| 131 | if (this.hasChooseSearch) { | 130 | if (this.hasChooseSearch) { |
| 132 | - if(!this.isConnectNetwork){ | ||
| 133 | - EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 134 | - this.getSearchInputResData(this.searchText) | ||
| 135 | - }}) | ||
| 136 | - .layoutWeight(1) | ||
| 137 | - .width('100%') | ||
| 138 | - }else{ | ||
| 139 | - //搜索结果 | ||
| 140 | - SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) | ||
| 141 | - } | 131 | + //搜索结果 |
| 132 | + SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) | ||
| 142 | } else { | 133 | } else { |
| 143 | //联想搜索 | 134 | //联想搜索 |
| 144 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) | 135 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) |
| @@ -339,12 +330,10 @@ export struct SearchComponent { | @@ -339,12 +330,10 @@ export struct SearchComponent { | ||
| 339 | } | 330 | } |
| 340 | this.isGetRequest = true | 331 | this.isGetRequest = true |
| 341 | this.resetSearch() | 332 | this.resetSearch() |
| 342 | - this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 343 | }).catch((err: Error) => { | 333 | }).catch((err: Error) => { |
| 344 | console.log(TAG, JSON.stringify(err)) | 334 | console.log(TAG, JSON.stringify(err)) |
| 345 | this.isGetRequest = true | 335 | this.isGetRequest = true |
| 346 | this.resetSearch() | 336 | this.resetSearch() |
| 347 | - this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 348 | }) | 337 | }) |
| 349 | } | 338 | } |
| 350 | 339 |
| @@ -216,7 +216,7 @@ export struct EmptyComponent { | @@ -216,7 +216,7 @@ export struct EmptyComponent { | ||
| 216 | contentString = '暂无关注' | 216 | contentString = '暂无关注' |
| 217 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { | 217 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { |
| 218 | contentString = '暂无评论,快来抢沙发' | 218 | contentString = '暂无评论,快来抢沙发' |
| 219 | - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment1) { | 219 | + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoContent2) { |
| 220 | contentString = '内容找不到了' | 220 | contentString = '内容找不到了' |
| 221 | } | 221 | } |
| 222 | 222 |
| 1 | import { common } from '@kit.AbilityKit'; | 1 | import { common } from '@kit.AbilityKit'; |
| 2 | import { insightIntent } from '@kit.IntentsKit'; | 2 | import { insightIntent } from '@kit.IntentsKit'; |
| 3 | import { BusinessError } from '@kit.BasicServicesKit'; | 3 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 4 | -import { CompDTO, CompList, ContentDTO, PageInfoBean } from 'wdBean'; | 4 | +import { CompDTO, CompList, ContentDTO, PageInfoBean, ContentDetailDTO, InteractDataDTO } from 'wdBean'; |
| 5 | 5 | ||
| 6 | function generateUUID() { | 6 | function generateUUID() { |
| 7 | let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒) | 7 | let dt = new Date().getTime(); // 获取当前时间的时间戳(毫秒) |
| @@ -82,12 +82,58 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | @@ -82,12 +82,58 @@ export function viewBlogInsightIntentShare(context: common.UIAbilityContext, ent | ||
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | +//ViewBlog意图共享-节目详情 目前单独在详情页上报 | ||
| 86 | +export function viewBlogItemInsightIntentShare(context: common.UIAbilityContext, item: ContentDetailDTO, | ||
| 87 | + interactData?: InteractDataDTO) { | ||
| 88 | + let identifier = generateUUID() | ||
| 89 | + let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | ||
| 90 | + intentName: 'ViewBlog', | ||
| 91 | + intentVersion: '1.0.1', | ||
| 92 | + identifier, | ||
| 93 | + intentActionInfo: { | ||
| 94 | + actionMode: ActionMode.EXECUTED, | ||
| 95 | + currentPercentage: 50, | ||
| 96 | + }, | ||
| 97 | + intentEntityInfo: { | ||
| 98 | + entityName: 'Blog', | ||
| 99 | + entityId: String(item?.newsId), | ||
| 100 | + displayName: item?.newsTitle, | ||
| 101 | + entityGroupId: String(item?.reLInfo?.channelId), //channelId | ||
| 102 | + logoURL: item.fullColumnImgUrls.length > 0 ? item.fullColumnImgUrls[0]?.url : item.firstFrameImageUri, | ||
| 103 | + metadataModificationTime: item?.publishTime, | ||
| 104 | + blogTitle: item?.newsTitle, | ||
| 105 | + blogType: 'Normal', | ||
| 106 | + blogCategory: item, | ||
| 107 | + categoryDisplayName: '', //TODO 分类名称 | ||
| 108 | + blogSubTitle: item?.newsSummary.length > 20 ? | ||
| 109 | + item?.newsSummary.substring(0, 20) : item?.newsSummary, | ||
| 110 | + blogAuthor: item?.newsSourceName, | ||
| 111 | + blogPublishTime: item?.publishTime, | ||
| 112 | + tag: item?.newsTags.split(','), | ||
| 113 | + viewCount: item?.viewCount || 0, | ||
| 114 | + likeCount: interactData?.likeNum || 0, | ||
| 115 | + forwardCount: interactData?.shareNum || 0, | ||
| 116 | + commentCount: interactData?.commentNum || 0, | ||
| 117 | + favorites: interactData?.collectNum || 0, | ||
| 118 | + rankingHint: 99, | ||
| 119 | + isPublicData: true | ||
| 120 | + } | ||
| 121 | + } | ||
| 85 | 122 | ||
| 86 | -//ViewBlog意图共享-早晚报 | 123 | + console.log('yzl', JSON.stringify(viewBlogInsightIntentItem)) |
| 124 | + // 共享数据 | ||
| 125 | + insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => { | ||
| 126 | + console.log('yzl shareIntent success'); | ||
| 127 | + }).catch((err: BusinessError) => { | ||
| 128 | + console.error(`yzl failed because ${err?.message}`); | ||
| 129 | + }); | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +//ViewColumn意图共享-早晚报 | ||
| 87 | export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string, | 133 | export function viewColumInsightIntentShare(context: common.UIAbilityContext, entityId: string, |
| 88 | pageInfoBean: PageInfoBean) { | 134 | pageInfoBean: PageInfoBean) { |
| 89 | console.log('viewColumInsightIntentShare') | 135 | console.log('viewColumInsightIntentShare') |
| 90 | - let viewBlogInsightIntentItem: insightIntent.InsightIntent = { | 136 | + let viewColumInsightIntentItem: insightIntent.InsightIntent = { |
| 91 | intentName: 'ViewColumn', | 137 | intentName: 'ViewColumn', |
| 92 | intentVersion: '1.0.1', | 138 | intentVersion: '1.0.1', |
| 93 | identifier: generateUUID(), | 139 | identifier: generateUUID(), |
| @@ -108,10 +154,10 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | @@ -108,10 +154,10 @@ export function viewColumInsightIntentShare(context: common.UIAbilityContext, en | ||
| 108 | isPublicData: true | 154 | isPublicData: true |
| 109 | } | 155 | } |
| 110 | } | 156 | } |
| 111 | - console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewBlogInsightIntentItem)) | 157 | + console.log('yzl viewColumInsightIntentShare', JSON.stringify(viewColumInsightIntentItem)) |
| 112 | 158 | ||
| 113 | // 共享数据 | 159 | // 共享数据 |
| 114 | - insightIntent.shareIntent(context, [viewBlogInsightIntentItem]).then(() => { | 160 | + insightIntent.shareIntent(context, [viewColumInsightIntentItem]).then(() => { |
| 115 | console.log('yzl shareIntent success'); | 161 | console.log('yzl shareIntent success'); |
| 116 | }).catch((err: BusinessError) => { | 162 | }).catch((err: BusinessError) => { |
| 117 | console.error(`yzl failed because ${err?.message}`); | 163 | console.error(`yzl failed because ${err?.message}`); |
| 1 | -import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, PageDTO, PageInfoDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, LiveRoomDataBean, PageDTO, PageInfoDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; | 3 | import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; |
| 4 | import { closeRefresh } from '../utils/PullDownRefresh'; | 4 | import { closeRefresh } from '../utils/PullDownRefresh'; |
| @@ -75,7 +75,7 @@ export class PageHelper { | @@ -75,7 +75,7 @@ export class PageHelper { | ||
| 75 | // 清空comp列表 | 75 | // 清空comp列表 |
| 76 | pageModel.compList.clear() | 76 | pageModel.compList.clear() |
| 77 | } | 77 | } |
| 78 | - this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) | 78 | + this.analysisPageGroupCompData(pageDto, pageInfo) |
| 79 | Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); | 79 | Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| @@ -178,14 +178,31 @@ export class PageHelper { | @@ -178,14 +178,31 @@ export class PageHelper { | ||
| 178 | // await,确保groups接口顺序执行 | 178 | // await,确保groups接口顺序执行 |
| 179 | let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO | 179 | let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO |
| 180 | let index = pageInfo.groups.indexOf(group) | 180 | let index = pageInfo.groups.indexOf(group) |
| 181 | - if (index == 0) { | ||
| 182 | - // 清空comp列表 | ||
| 183 | - pageModel.compList.clear() | 181 | + |
| 182 | + // 解析楼层组件 | ||
| 183 | + this.analysisPageGroupCompData(pageDto, pageInfo) | ||
| 184 | + | ||
| 185 | + // 最后一个楼层,特殊处理 | ||
| 186 | + if (index == pageInfo.groups.length - 1) { | ||
| 187 | + // 检测楼层最后一个组件业务数据是否需要通过访问接口获取 | ||
| 188 | + let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1] | ||
| 189 | + // 直播回放,需要二次请求数据 | ||
| 190 | + if (comp.compStyle == CompStyle.Zh_Grid_Layout_02) { | ||
| 191 | + pageInfo.lastCompSourceType = 1 | ||
| 192 | + let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(1, 20) as LiveReviewDTO | ||
| 193 | + Logger.error("ZZZXXXXX", 'getLiveReviewData------1---' + listReviewDtoBean.list.length); | ||
| 194 | + // 创建一行两图卡组件 | ||
| 195 | + this.createDoubleColumComp(listReviewDtoBean, pageInfo) | ||
| 196 | + | ||
| 197 | + Logger.error("ZZZXXXXX", 'getLiveReviewData-----2----' + listReviewDtoBean.list.length); | ||
| 198 | + | ||
| 199 | + } else { | ||
| 200 | + pageInfo.lastCompSourceType = 0 | ||
| 201 | + } | ||
| 184 | // // 保存缓存 | 202 | // // 保存缓存 |
| 185 | // CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | 203 | // CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, |
| 186 | // pageDto.md5) | 204 | // pageDto.md5) |
| 187 | } | 205 | } |
| 188 | - this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) | ||
| 189 | Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); | 206 | Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); |
| 190 | } | 207 | } |
| 191 | 208 | ||
| @@ -196,9 +213,11 @@ export class PageHelper { | @@ -196,9 +213,11 @@ export class PageHelper { | ||
| 196 | // 处理页面广告数据,投放到页面的位置 | 213 | // 处理页面广告数据,投放到页面的位置 |
| 197 | this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); | 214 | this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); |
| 198 | 215 | ||
| 216 | + // 清空comp列表 | ||
| 217 | + pageModel.compList.clear() | ||
| 199 | //遍历所有组件和稿件数据 push到页面 | 218 | //遍历所有组件和稿件数据 push到页面 |
| 200 | for (let element of pageInfo.oneRequestPageGroupCompList) { | 219 | for (let element of pageInfo.oneRequestPageGroupCompList) { |
| 201 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | 220 | + pageModel.compList.push(element) |
| 202 | } | 221 | } |
| 203 | 222 | ||
| 204 | // 批查互动数据 | 223 | // 批查互动数据 |
| @@ -225,26 +244,11 @@ export class PageHelper { | @@ -225,26 +244,11 @@ export class PageHelper { | ||
| 225 | * @param pageInfo 信息流页面信息 | 244 | * @param pageInfo 信息流页面信息 |
| 226 | * @param isLastGroup pageDto信息是不是最后一个楼层 | 245 | * @param isLastGroup pageDto信息是不是最后一个楼层 |
| 227 | */ | 246 | */ |
| 228 | - private async analysisPageGroupCompData(pageModel: PageModel,pageDto: PageDTO, pageInfo: PageInfoDTO, isLastGroup: boolean) { | 247 | + private async analysisPageGroupCompData(pageDto: PageDTO, pageInfo: PageInfoDTO) { |
| 229 | 248 | ||
| 230 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 249 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 231 | 250 | ||
| 232 | - let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集楼层组件、稿件和本地组件容器 | ||
| 233 | - // 遍历楼层的组件数据 | ||
| 234 | - pageDto.compList.forEach((element: CompDTO) => { | ||
| 235 | - let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 236 | - //移除音频 和 活动 | ||
| 237 | - if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | ||
| 238 | - Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 239 | - } else { | ||
| 240 | - // 暂时屏蔽活动和音频详情入口 | ||
| 241 | - if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | ||
| 242 | - } else { | ||
| 243 | - pageCompList.add(element) | ||
| 244 | - } | ||
| 245 | - } | ||
| 246 | - }) | ||
| 247 | - | 251 | + let pageCompList = this.factoryCompArray(pageDto.compList) |
| 248 | // pageInfor 记录 | 252 | // pageInfor 记录 |
| 249 | pageCompList.forEach((comp: CompDTO) => { | 253 | pageCompList.forEach((comp: CompDTO) => { |
| 250 | pageInfo.oneRequestPageGroupCompList.add(comp) | 254 | pageInfo.oneRequestPageGroupCompList.add(comp) |
| @@ -255,19 +259,6 @@ export class PageHelper { | @@ -255,19 +259,6 @@ export class PageHelper { | ||
| 255 | pageInfo.pageAdList.push(...pageDto.compAdList) | 259 | pageInfo.pageAdList.push(...pageDto.compAdList) |
| 256 | } | 260 | } |
| 257 | 261 | ||
| 258 | - // 检测最后一个楼层是否有一行两图卡 | ||
| 259 | - if (isLastGroup) { | ||
| 260 | - // 最后一个楼层,特殊处理 | ||
| 261 | - // 检测楼层最后一个组件业务数据是否需要通过访问接口获取 | ||
| 262 | - let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1] | ||
| 263 | - // 直播回放,需要二次请求数据 | ||
| 264 | - if ( comp.compStyle == CompStyle.Zh_Grid_Layout_02) { | ||
| 265 | - // 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉 | ||
| 266 | - pageModel.contentNeedScroll = true | ||
| 267 | - | ||
| 268 | - //this.getLiveReviewData(pageInfo,comp) | ||
| 269 | - } | ||
| 270 | - } | ||
| 271 | } | 262 | } |
| 272 | 263 | ||
| 273 | } | 264 | } |
| @@ -295,23 +286,32 @@ export class PageHelper { | @@ -295,23 +286,32 @@ export class PageHelper { | ||
| 295 | promptAction.showToast({ message: err }); | 286 | promptAction.showToast({ message: err }); |
| 296 | }) | 287 | }) |
| 297 | } else { | 288 | } else { |
| 298 | - PageViewModel.getPageGroupCompData(pageModel.bizCopy()) | ||
| 299 | - .then((data: PageDTO) => { | ||
| 300 | - if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 301 | - pageModel.hasMore = false; | ||
| 302 | - } else { | ||
| 303 | - // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 304 | - pageModel.currentPage++; | ||
| 305 | - pageModel.hasMore = true; | ||
| 306 | - | ||
| 307 | - //移除音频 和 活动 | ||
| 308 | - this.loadMorePageComp(pageModel, data) | ||
| 309 | - // 参与批查 | ||
| 310 | - this.allCompBatchRequest(data.compList, pageModel) | ||
| 311 | - } | ||
| 312 | - }).catch((err: string | Resource) => { | ||
| 313 | - promptAction.showToast({ message: err }); | ||
| 314 | - }) | 289 | + |
| 290 | + if (pageModel.pageInfo.lastCompSourceType == 1) { | ||
| 291 | + // 加载更多 走 直播回看接口 | ||
| 292 | + this.getLiveReviewData(pageModel, pageModel.pageInfo) | ||
| 293 | + | ||
| 294 | + } else { | ||
| 295 | + // 默认加载更多走 楼层接口 | ||
| 296 | + PageViewModel.getPageGroupCompData(pageModel.bizCopy()) | ||
| 297 | + .then((data: PageDTO) => { | ||
| 298 | + | ||
| 299 | + if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 300 | + pageModel.hasMore = false; | ||
| 301 | + } else { | ||
| 302 | + // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 303 | + pageModel.currentPage++; | ||
| 304 | + pageModel.hasMore = true; | ||
| 305 | + | ||
| 306 | + //移除音频 和 活动 | ||
| 307 | + this.loadMorePageComp(pageModel, data) | ||
| 308 | + // 参与批查 | ||
| 309 | + this.allCompBatchRequest(data.compList, pageModel) | ||
| 310 | + } | ||
| 311 | + }).catch((err: string | Resource) => { | ||
| 312 | + promptAction.showToast({ message: err }); | ||
| 313 | + }) | ||
| 314 | + } | ||
| 315 | } | 315 | } |
| 316 | } | 316 | } |
| 317 | 317 | ||
| @@ -321,9 +321,34 @@ export class PageHelper { | @@ -321,9 +321,34 @@ export class PageHelper { | ||
| 321 | */ | 321 | */ |
| 322 | private loadMorePageComp(pageModel: PageModel, pageDto: PageDTO) { | 322 | private loadMorePageComp(pageModel: PageModel, pageDto: PageDTO) { |
| 323 | 323 | ||
| 324 | - let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | 324 | + let pageCompList = this.factoryCompArray(pageDto.compList) // 收集页面组件、稿件和本地组件容器 |
| 325 | 325 | ||
| 326 | - pageDto.compList.forEach((element: CompDTO) => { | 326 | + // pageInfor 记录 |
| 327 | + pageModel.pageInfo.oneRequestPageGroupCompList.clear() | ||
| 328 | + pageCompList.forEach((comp: CompDTO) => { | ||
| 329 | + pageModel.pageInfo.oneRequestPageGroupCompList.add(comp) | ||
| 330 | + }) | ||
| 331 | + | ||
| 332 | + // 记录 | ||
| 333 | + pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | ||
| 334 | + // 处理页面广告数据,投放到页面的位置 | ||
| 335 | + this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto.compAdList); | ||
| 336 | + | ||
| 337 | + //遍历所有组件和稿件数据 push到页面 | ||
| 338 | + for (let element of pageCompList) { | ||
| 339 | + pageModel.compList.push(element) | ||
| 340 | + } | ||
| 341 | + | ||
| 342 | + } | ||
| 343 | + | ||
| 344 | + /** | ||
| 345 | + * 加工 组件数组信息 | ||
| 346 | + * @param compList | ||
| 347 | + * @returns | ||
| 348 | + */ | ||
| 349 | + private factoryCompArray(compList: CompDTO[]): ArrayList<CompDTO> { | ||
| 350 | + let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | ||
| 351 | + compList.forEach((element: CompDTO) => { | ||
| 327 | let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | 352 | let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); |
| 328 | //移除音频 和 活动 | 353 | //移除音频 和 活动 |
| 329 | if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | 354 | if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { |
| @@ -332,22 +357,17 @@ export class PageHelper { | @@ -332,22 +357,17 @@ export class PageHelper { | ||
| 332 | // 暂时屏蔽活动和音频详情入口 | 357 | // 暂时屏蔽活动和音频详情入口 |
| 333 | if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | 358 | if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { |
| 334 | } else { | 359 | } else { |
| 335 | - pageCompList.add(element) | 360 | + if (element.name == "月度排行卡") { |
| 361 | + | ||
| 362 | + } else { | ||
| 363 | + pageCompList.add(CompDTO.createNewsBean(element)) | ||
| 364 | + } | ||
| 336 | } | 365 | } |
| 337 | } | 366 | } |
| 338 | 367 | ||
| 339 | }) | 368 | }) |
| 340 | 369 | ||
| 341 | - // 记录 | ||
| 342 | - pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | ||
| 343 | - // 处理页面广告数据,投放到页面的位置 | ||
| 344 | - this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto.compAdList); | ||
| 345 | - | ||
| 346 | - //遍历所有组件和稿件数据 push到页面 | ||
| 347 | - for (let element of pageCompList) { | ||
| 348 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 349 | - } | ||
| 350 | - | 370 | + return pageCompList |
| 351 | } | 371 | } |
| 352 | 372 | ||
| 353 | /** | 373 | /** |
| @@ -356,6 +376,8 @@ export class PageHelper { | @@ -356,6 +376,8 @@ export class PageHelper { | ||
| 356 | * @param pageModel | 376 | * @param pageModel |
| 357 | */ | 377 | */ |
| 358 | private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { | 378 | private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { |
| 379 | + | ||
| 380 | + // 批查人数 | ||
| 359 | PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { | 381 | PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { |
| 360 | // 刷新,替换所有数据 | 382 | // 刷新,替换所有数据 |
| 361 | this.resetInteract(data, pageModel.compList) | 383 | this.resetInteract(data, pageModel.compList) |
| @@ -366,6 +388,9 @@ export class PageHelper { | @@ -366,6 +388,9 @@ export class PageHelper { | ||
| 366 | } | 388 | } |
| 367 | }) | 389 | }) |
| 368 | 390 | ||
| 391 | + // 批查直播观看人数 | ||
| 392 | + // this.getLiveRoomDataInfo(compList) | ||
| 393 | + | ||
| 369 | // 测试数据 | 394 | // 测试数据 |
| 370 | // setTimeout(() => { | 395 | // setTimeout(() => { |
| 371 | // let index = 1 | 396 | // let index = 1 |
| @@ -381,6 +406,59 @@ export class PageHelper { | @@ -381,6 +406,59 @@ export class PageHelper { | ||
| 381 | } | 406 | } |
| 382 | 407 | ||
| 383 | /** | 408 | /** |
| 409 | + * 直播回看的批查数据 | ||
| 410 | + * @param list | ||
| 411 | + * @param compList | ||
| 412 | + */ | ||
| 413 | + private getLiveRoomDataInfo(compList: CompDTO[]) { | ||
| 414 | + | ||
| 415 | + let list: ContentDTO[] = [] | ||
| 416 | + compList.forEach((comp: CompDTO) => { | ||
| 417 | + if (comp.compStyle == CompStyle.Card_Comp_Zh_Grid_Layout_02) { | ||
| 418 | + list.push(...comp.operDataList) | ||
| 419 | + } | ||
| 420 | + }) | ||
| 421 | + | ||
| 422 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 423 | + | ||
| 424 | + const reserveIds = this.getLiveDetailIds(list) | ||
| 425 | + PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => { | ||
| 426 | + if (result && result.length > 0) { | ||
| 427 | + result.forEach((bean: LiveRoomDataBean) => { | ||
| 428 | + for (let item of list) { | ||
| 429 | + if (item.objectId == bean.liveId.toString()) { | ||
| 430 | + item.liveRoomDataBean = bean | ||
| 431 | + outer: for (let compBean of compList) { | ||
| 432 | + for (let contentBean of compBean.operDataList) { | ||
| 433 | + if (contentBean === item) { | ||
| 434 | + compBean.timestamp = time | ||
| 435 | + break outer | ||
| 436 | + } | ||
| 437 | + } | ||
| 438 | + } | ||
| 439 | + break | ||
| 440 | + } | ||
| 441 | + } | ||
| 442 | + }) | ||
| 443 | + } | ||
| 444 | + }).catch(() => { | ||
| 445 | + }) | ||
| 446 | + } | ||
| 447 | + | ||
| 448 | + /** | ||
| 449 | + * 获取直播详情id入参 | ||
| 450 | + * @param list | ||
| 451 | + * @returns | ||
| 452 | + */ | ||
| 453 | + private getLiveDetailIds(list: ContentDTO[]): string { | ||
| 454 | + let idList: string[] = [] | ||
| 455 | + list.forEach(item => { | ||
| 456 | + idList.push(item.objectId) | ||
| 457 | + }); | ||
| 458 | + return idList.join(',') | ||
| 459 | + } | ||
| 460 | + | ||
| 461 | + /** | ||
| 384 | * 刷新互动数据到compList | 462 | * 刷新互动数据到compList |
| 385 | * @param interact 批查互动数据结果 | 463 | * @param interact 批查互动数据结果 |
| 386 | * @param compList comp list | 464 | * @param compList comp list |
| @@ -560,12 +638,99 @@ export class PageHelper { | @@ -560,12 +638,99 @@ export class PageHelper { | ||
| 560 | /** | 638 | /** |
| 561 | * 获取直播回看数据 | 639 | * 获取直播回看数据 |
| 562 | */ | 640 | */ |
| 563 | - private async getLiveReviewData(pageInfo: PageInfoDTO,comp: CompDTO) { | 641 | + private async getLiveReviewData(pageModel: PageModel, pageInfo: PageInfoDTO) { |
| 564 | 642 | ||
| 565 | - let currentPage = 1 | 643 | + let currentPage = pageModel.currentPage |
| 566 | let pageSize = 20 | 644 | let pageSize = 20 |
| 567 | - let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(currentPage, pageSize) as LiveReviewDTO | ||
| 568 | - Logger.error("ZZZXXXXX", 'getLiveReviewData---------'+listReviewDtoBean.list.length); | 645 | + |
| 646 | + PageViewModel.getLiveReviewUrl(currentPage, pageSize).then((liveReviewDTO) => { | ||
| 647 | + if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) { | ||
| 648 | + pageModel.hasMore = false; | ||
| 649 | + } else { | ||
| 650 | + | ||
| 651 | + pageInfo.oneRequestPageGroupCompList.clear() | ||
| 652 | + // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 653 | + pageModel.currentPage++; | ||
| 654 | + pageModel.hasMore = true; | ||
| 655 | + | ||
| 656 | + let haveMoveContent = false | ||
| 657 | + //获取当前页面最后一个组件 | ||
| 658 | + let lastIndex = pageModel.compList.totalCount() - 1 | ||
| 659 | + let lastComp = pageModel.compList.getData(lastIndex) as CompDTO | ||
| 660 | + // 一行两图卡,需要从奇数 补齐成偶数内容 | ||
| 661 | + if (lastComp.compStyle == CompStyle.Card_Comp_Zh_Grid_Layout_02) { | ||
| 662 | + | ||
| 663 | + let operLength = lastComp.operDataList.length | ||
| 664 | + Logger.error("ZZZXXXXX", 'getLiveReviewData------1---operLength=' + operLength); | ||
| 665 | + // 最后一个组件的业务数据是奇数,需要从获取更多的业务数据中补一个数据 | ||
| 666 | + if (operLength === 1) { | ||
| 667 | + lastComp.operDataList.push(liveReviewDTO.list[0]) | ||
| 668 | + // 更新某个组件 | ||
| 669 | + pageModel.compList.updateItem(lastComp, lastIndex) | ||
| 670 | + // 移走新获取的数据中第一条数据 | ||
| 671 | + liveReviewDTO.list.splice(0, 1) | ||
| 672 | + } | ||
| 673 | + } | ||
| 674 | + | ||
| 675 | + this.createDoubleColumComp(liveReviewDTO, pageInfo) | ||
| 676 | + // 统计页面的总的组件和稿件数量 | ||
| 677 | + pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize | ||
| 678 | + //遍历所有组件和稿件数据 push到页面 | ||
| 679 | + for (let element of pageInfo.oneRequestPageGroupCompList) { | ||
| 680 | + pageModel.compList.push(element) | ||
| 681 | + } | ||
| 682 | + | ||
| 683 | + // 批查直播观看人数 | ||
| 684 | + // if (haveMoveContent) { | ||
| 685 | + // // 把当前获取到的直播回看数据 | ||
| 686 | + // liveReviewDTO.list.push(lastComp.operDataList[1]) | ||
| 687 | + // pageInfo.oneRequestPageGroupCompList.add(lastComp) | ||
| 688 | + // } | ||
| 689 | + // this.getLiveRoomDataInfo(liveReviewDTO.list, pageInfo.oneRequestPageGroupCompList) | ||
| 690 | + | ||
| 691 | + } | ||
| 692 | + | ||
| 693 | + }).catch((err: string | Resource) => { | ||
| 694 | + promptAction.showToast({ message: err }); | ||
| 695 | + }) | ||
| 696 | + } | ||
| 697 | + | ||
| 698 | + /** | ||
| 699 | + * 创建一行两图卡 自定义的业务稿件 | ||
| 700 | + * @param listReviewDtoBean | ||
| 701 | + * @param pageInfo | ||
| 702 | + */ | ||
| 703 | + private async createDoubleColumComp(listReviewDtoBean: LiveReviewDTO, pageInfo: PageInfoDTO, test?: boolean) { | ||
| 704 | + /* | ||
| 705 | + 两个业务 内容 配置一个comp | ||
| 706 | + */ | ||
| 707 | + let length = listReviewDtoBean.list.length | ||
| 708 | + | ||
| 709 | + Logger.error("ZZZXXXXX", 'createDoubleColumComp------1---test=' + test + " length=" + length); | ||
| 710 | + if (test) { | ||
| 711 | + // 偶数变成奇数 | ||
| 712 | + if (length % 2 === 0) { | ||
| 713 | + listReviewDtoBean.list.splice(length - 1, 1) | ||
| 714 | + length = listReviewDtoBean.list.length | ||
| 715 | + } | ||
| 716 | + } | ||
| 717 | + | ||
| 718 | + for (let i = 0; i < length; i = i + 2) { | ||
| 719 | + let sliceArray: ContentDTO[] | ||
| 720 | + let j = i + 2 | ||
| 721 | + | ||
| 722 | + if (j < length) { | ||
| 723 | + sliceArray = listReviewDtoBean.list.slice(i, j) | ||
| 724 | + } else { | ||
| 725 | + sliceArray = listReviewDtoBean.list.slice(i) | ||
| 726 | + } | ||
| 727 | + // 创建一行两图卡 自定义的业务稿件 | ||
| 728 | + let doubleColumnLiveReviewComp = new CompDTO() | ||
| 729 | + doubleColumnLiveReviewComp.compStyle = CompStyle.Card_Comp_Zh_Grid_Layout_02 | ||
| 730 | + let operDataList: ContentDTO[] = sliceArray | ||
| 731 | + doubleColumnLiveReviewComp.operDataList = operDataList | ||
| 732 | + pageInfo.oneRequestPageGroupCompList.add(doubleColumnLiveReviewComp) | ||
| 733 | + } | ||
| 569 | 734 | ||
| 570 | } | 735 | } |
| 571 | } | 736 | } |
| 1 | import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; | 1 | import { insightIntent, InsightIntentExecutor } from '@kit.AbilityKit'; |
| 2 | import { window } from '@kit.ArkUI'; | 2 | import { window } from '@kit.ArkUI'; |
| 3 | import { BusinessError } from '@kit.BasicServicesKit'; | 3 | import { BusinessError } from '@kit.BasicServicesKit'; |
| 4 | - | 4 | +import { ProcessUtils } from 'wdRouter'; |
| 5 | /** | 5 | /** |
| 6 | * 意图调用 | 6 | * 意图调用 |
| 7 | */ | 7 | */ |
| 8 | export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | 8 | export default class InsightIntentExecutorImpl extends InsightIntentExecutor { |
| 9 | - private static readonly ViewColumn = 'ViewColumn'; | 9 | + private static readonly ViewBlog = 'ViewBlog'; |
| 10 | + private static readonly ViewColumnUpdate = 'ViewColumnUpdate'; | ||
| 11 | + | ||
| 10 | /** | 12 | /** |
| 11 | * override 执行前台UIAbility意图 | 13 | * override 执行前台UIAbility意图 |
| 12 | * | 14 | * |
| @@ -17,10 +19,13 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -17,10 +19,13 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 17 | */ | 19 | */ |
| 18 | onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage): | 20 | onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage): |
| 19 | Promise<insightIntent.ExecuteResult> { | 21 | Promise<insightIntent.ExecuteResult> { |
| 22 | + console.log('yzl onExecuteInUIAbilityForegroundMode',name,JSON.stringify(param)) | ||
| 20 | // 根据意图名称分发处理逻辑 | 23 | // 根据意图名称分发处理逻辑 |
| 21 | switch (name) { | 24 | switch (name) { |
| 22 | - case InsightIntentExecutorImpl.ViewColumn: | ||
| 23 | - return this.jumpToView(param, pageLoader); | 25 | + case InsightIntentExecutorImpl.ViewBlog: |
| 26 | + return this.jumpToViewBlog(param, pageLoader); | ||
| 27 | + case InsightIntentExecutorImpl.ViewColumnUpdate: | ||
| 28 | + return this.jumpToViewColumnUpdate(param, pageLoader); | ||
| 24 | default: | 29 | default: |
| 25 | break; | 30 | break; |
| 26 | } | 31 | } |
| @@ -32,18 +37,47 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -32,18 +37,47 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 32 | } as insightIntent.ExecuteResult) | 37 | } as insightIntent.ExecuteResult) |
| 33 | } | 38 | } |
| 34 | /** | 39 | /** |
| 35 | - * 实现跳转新闻页面功能 | ||
| 36 | - * | 40 | + * 实现习惯推荐功能 |
| 37 | * @param param 意图参数 | 41 | * @param param 意图参数 |
| 38 | * @param pageLoader 窗口 | 42 | * @param pageLoader 窗口 |
| 39 | */ | 43 | */ |
| 40 | - private jumpToView(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { | 44 | + private jumpToViewBlog(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { |
| 45 | + console.log('yzl jumpToView',JSON.stringify(param)) | ||
| 41 | return new Promise((resolve, reject) => { | 46 | return new Promise((resolve, reject) => { |
| 42 | // TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage | 47 | // TODO 实现意图调用,loadContent的入参为歌曲落地页路径,例如:pages/SongPage |
| 43 | pageLoader.loadContent('pages/MainPage') | 48 | pageLoader.loadContent('pages/MainPage') |
| 44 | .then(() => { | 49 | .then(() => { |
| 45 | - let entityId: string = (param.items as Array<object>)?.[0]?.['entityId']; | ||
| 46 | - // TODO 调用成功的情况,此处可以打印日志 | 50 | + let entityGroupId: string = (param.items as Array<object>)?.[0]?.['entityGroupId']; |
| 51 | + ProcessUtils.jumpChannelTab(entityGroupId,'') | ||
| 52 | + resolve({ | ||
| 53 | + code: 0, | ||
| 54 | + result: { | ||
| 55 | + message: 'Intent execute success' | ||
| 56 | + } | ||
| 57 | + }); | ||
| 58 | + }) | ||
| 59 | + .catch((err: BusinessError) => { | ||
| 60 | + resolve({ | ||
| 61 | + code: -1, | ||
| 62 | + result: { | ||
| 63 | + message: 'Intent execute failed' | ||
| 64 | + } | ||
| 65 | + }) | ||
| 66 | + }); | ||
| 67 | + }) | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 实现事件推荐功能 | ||
| 72 | + * @param param 意图参数 | ||
| 73 | + * @param pageLoader 窗口 | ||
| 74 | + */ | ||
| 75 | + private jumpToViewColumnUpdate(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { | ||
| 76 | + console.log('yzl jumpToViewColum',JSON.stringify(param)) | ||
| 77 | + return new Promise((resolve, reject) => { | ||
| 78 | + pageLoader.loadContent('pages/MainPage') | ||
| 79 | + .then(() => { | ||
| 80 | + // TODO 事件推荐调用 | ||
| 47 | resolve({ | 81 | resolve({ |
| 48 | code: 0, | 82 | code: 0, |
| 49 | result: { | 83 | result: { |
| @@ -52,7 +86,6 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | @@ -52,7 +86,6 @@ export default class InsightIntentExecutorImpl extends InsightIntentExecutor { | ||
| 52 | }); | 86 | }); |
| 53 | }) | 87 | }) |
| 54 | .catch((err: BusinessError) => { | 88 | .catch((err: BusinessError) => { |
| 55 | - // TODO 调用失败的情况 | ||
| 56 | resolve({ | 89 | resolve({ |
| 57 | code: -1, | 90 | code: -1, |
| 58 | result: { | 91 | result: { |
| 1 | { | 1 | { |
| 2 | "insightIntents": [ | 2 | "insightIntents": [ |
| 3 | { | 3 | { |
| 4 | - "intentName": "ViewColumn", | 4 | + "intentName": "ViewBlog", |
| 5 | + "domain": "", | ||
| 6 | + "intentVersion": "1.0.1", | ||
| 7 | + "srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets", | ||
| 8 | + "uiAbility": { | ||
| 9 | + "ability": "EntryAbility", | ||
| 10 | + "executeMode": [ | ||
| 11 | + "background", | ||
| 12 | + "foreground" | ||
| 13 | + ] | ||
| 14 | + } | ||
| 15 | + }, | ||
| 16 | + { | ||
| 17 | + "intentName": "ViewColumnUpdate", | ||
| 5 | "domain": "", | 18 | "domain": "", |
| 6 | "intentVersion": "1.0.1", | 19 | "intentVersion": "1.0.1", |
| 7 | "srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets", | 20 | "srcEntry": "./ets/utils/InsightIntentExecutorImpl.ets", |
-
Please register or login to post a comment