张善主

fix(早晚报/版面):分享

@@ -100,6 +100,8 @@ export class ContentDTO implements BaseDTO { @@ -100,6 +100,8 @@ export class ContentDTO implements BaseDTO {
100 本地辅助字段 100 本地辅助字段
101 */ 101 */
102 liveRoomDataBean : LiveRoomDataBean = {} as LiveRoomDataBean// 批查获取到的直播观看人数 102 liveRoomDataBean : LiveRoomDataBean = {} as LiveRoomDataBean// 批查获取到的直播观看人数
  103 + //本地字段:时间轴专题页节点组件时间;【如果开启模糊则显示时间->左右;0:否,1:是】
  104 + timeBlurred:number = 0
103 105
104 static clone(old: ContentDTO): ContentDTO { 106 static clone(old: ContentDTO): ContentDTO {
105 let content = new ContentDTO(); 107 let content = new ContentDTO();
  1 +import { ArrayList } from '@kit.ArkTS';
  2 +import { SharePosterItemBean } from './SharePosterItemBean';
  3 +
1 export interface ShareInfoDTO { 4 export interface ShareInfoDTO {
2 shareCoverUrl: string; 5 shareCoverUrl: string;
3 shareOpen: number; 6 shareOpen: number;
  7 + //海报图片地址
4 sharePosterCoverUrl: string; 8 sharePosterCoverUrl: string;
  9 + //海报报分享开关 0:关闭,1:开启
5 sharePosterOpen: number; 10 sharePosterOpen: number;
6 shareSummary: string; 11 shareSummary: string;
  12 + //标题
7 shareTitle: string; 13 shareTitle: string;
  14 + //分享链接
8 shareUrl: string; 15 shareUrl: string;
  16 + //首发时间
  17 + publishTime:string;
  18 + //图片
  19 + imageUrl:string;
  20 + //直播和内容的举报,仅针对人民号发布的才能举报,cms创建的没有举报按钮
  21 + showReport:boolean;
  22 + //点赞按钮显示 -1:不展示 0:未点赞 1:已点赞
  23 + showLike:number;
  24 + //0 分享海报关闭,1 分享海报开启
  25 + posterShareControl:string;
  26 + //是否展示海报 -1-不展示图标
  27 + showPoster:number;
  28 + //海报展示类型 1:专题、文章、图文、视频、直播 2:人民号 3:评论 4:电子报海报 5:音频专题海报 6:早晚报专题海报 7:榜单H5 8:H5普通文章专题,包含时间链
  29 + showPosterType:number;
  30 + //接口返回: 内容id、内容类型
  31 + contentId:string;
  32 + //内容类型,分享的类型 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频
  33 + contentType:string;
  34 + //关系id
  35 + targetRelId:string;
  36 + //关系类型,1.频道关系;2.专题关系
  37 + targetRelType:string;
  38 + //21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题
  39 + topicType:string;
  40 + //早晚报;1-早报;2-午报;3-晚报
  41 + topicPattern:number;
  42 + //是否有头版
  43 + isFrontDaily:boolean;
  44 + //分享海报简介
  45 + posterSummary:string;
  46 + sharePosterItemList: SharePosterItemBean[]
  47 + //分享海报标题
  48 + posterTitle:string;
  49 +
9 } 50 }
  1 +export interface SharePosterItemBean {
  2 + title: string;
  3 +
  4 + duration:number;
  5 +
  6 + imageUrl:string;
  7 +
  8 + timeNode:string;
  9 + /**
  10 + * 是否显示时间左右
  11 + */
  12 + timeBlurred:number;
  13 +}
1 import { FrontLinkObject } from '../component/FrontLinkObject'; 1 import { FrontLinkObject } from '../component/FrontLinkObject';
  2 +import { ArrayList } from '@kit.ArkTS';
  3 +import { ContentDTO } from '../content/ContentDTO';
2 4
3 export interface TopicInfo { 5 export interface TopicInfo {
4 axisColor: string; 6 axisColor: string;
@@ -28,8 +30,17 @@ export interface TopicInfo { @@ -28,8 +30,17 @@ export interface TopicInfo {
28 topicId: string; 30 topicId: string;
29 topicPattern: number; 31 topicPattern: number;
30 // topicTemplate?: any; 32 // topicTemplate?: any;
  33 + //21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题,26:时间链
31 topicType: number; 34 topicType: number;
32 transluceImgUrl: string; 35 transluceImgUrl: string;
33 visitorComment: number; 36 visitorComment: number;
34 // voteInfo?: any; 37 // voteInfo?: any;
  38 + //频道、专题页关系id;
  39 + relId:string;
  40 + //关系类型:1.频道关系;2.专题关系;
  41 + relType:string;
  42 + //本地字段 --》分享页面需要展示的数据
  43 + shareContentList: ContentDTO[]
  44 + //专题背景图
  45 + backgroundImgUrl: string
35 } 46 }
1 export interface NewspaperShareBean { 1 export interface NewspaperShareBean {
2 shareUrl:string; 2 shareUrl:string;
3 sharePosterOpen:number; 3 sharePosterOpen:number;
  4 + sharePosterCoverUrl:string;
4 } 5 }
1 -import { NewspaperListBean, NewspaperListItemBean } from 'wdBean'; 1 +import { ContentDetailDTO, NewspaperListBean, NewspaperListItemBean } from 'wdBean';
2 import { NewspaperViewModel } from '../viewmodel/NewspaperViewModel'; 2 import { NewspaperViewModel } from '../viewmodel/NewspaperViewModel';
3 import router from '@ohos.router'; 3 import router from '@ohos.router';
4 import { ENewspaperItemComponent } from './ENewspaperItemComponent'; 4 import { ENewspaperItemComponent } from './ENewspaperItemComponent';
@@ -11,7 +11,8 @@ import { RMCalendarBean } from './calendar/RMCalendarBean'; @@ -11,7 +11,8 @@ import { RMCalendarBean } from './calendar/RMCalendarBean';
11 import { newsSkeleton } from './skeleton/newsSkeleton'; 11 import { newsSkeleton } from './skeleton/newsSkeleton';
12 import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index'; 12 import { Logger, ToastUtils, NetworkUtil } from 'wdKit/Index';
13 import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index'; 13 import { TrackingContent,TrackConstants, TrackingButton } from 'wdTracking/Index';
14 - 14 +import { WDShare } from 'wdShare/Index';
  15 +//电子报UI
15 @Component 16 @Component
16 export struct ENewspaperPageComponent { 17 export struct ENewspaperPageComponent {
17 private displayTool = display.getDefaultDisplaySync() 18 private displayTool = display.getDefaultDisplaySync()
@@ -179,7 +180,7 @@ export struct ENewspaperPageComponent { @@ -179,7 +180,7 @@ export struct ENewspaperPageComponent {
179 }) 180 })
180 .id('e_newspaper_share') 181 .id('e_newspaper_share')
181 .onClick(() => { 182 .onClick(() => {
182 - ToastUtils.showToast('分享为公共方法,待开发', 1000); 183 + this.share()
183 }) 184 })
184 } 185 }
185 } 186 }
@@ -392,4 +393,24 @@ export struct ENewspaperPageComponent { @@ -392,4 +393,24 @@ export struct ENewspaperPageComponent {
392 393
393 } 394 }
394 } 395 }
  396 +
  397 + share() {
  398 + let contentDetailData: ContentDetailDTO = {
  399 + shareInfo:{
  400 + shareTitle:this.newspaperListBean?.list[this.swiperIndex].pageName,
  401 + publishTime:this.newspaperListBean?.list[this.swiperIndex].periodNum,
  402 + imageUrl:this.newspaperListBean?.list[this.swiperIndex].pagePic,
  403 + shareUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.shareUrl,
  404 + sharePosterCoverUrl:this.newspaperListBean?.list[this.swiperIndex].sharePagePic.sharePosterCoverUrl,
  405 + showReport:false,
  406 + showLike:-1,
  407 + shareOpen:1,
  408 + sharePosterOpen:1,
  409 + posterShareControl:'-1',
  410 + showPoster:-1,
  411 + showPosterType:4,
  412 + }
  413 + } as ContentDetailDTO
  414 + WDShare.shareContent(contentDetailData,TrackConstants.PageName.NewsPaperPage,TrackConstants.PageName.NewsPaperPage)
  415 + }
395 } 416 }
@@ -294,7 +294,7 @@ export struct MorningEveningPaperComponent { @@ -294,7 +294,7 @@ export struct MorningEveningPaperComponent {
294 @Builder 294 @Builder
295 topPaperTitle(){ 295 topPaperTitle(){
296 Column(){ 296 Column(){
297 - PaperTitleComponent().margin({top:this.topSafeHeight}) 297 + PaperTitleComponent({topicInfo:this.pageInfoBean?.topicInfo}).margin({top:this.topSafeHeight})
298 }.height(44+this.topSafeHeight).backgroundColor(this.isHasTopView?(this.scrollOffset > 100?this.mixedBgColor:''):this.mixedBgColor) 298 }.height(44+this.topSafeHeight).backgroundColor(this.isHasTopView?(this.scrollOffset > 100?this.mixedBgColor:''):this.mixedBgColor)
299 } 299 }
300 300
1 import router from '@ohos.router'; 1 import router from '@ohos.router';
  2 +import { ContentDetailDTO, TopicInfo } from 'wdBean/Index';
2 import { ToastUtils } from 'wdKit'; 3 import { ToastUtils } from 'wdKit';
  4 +import { WDShare } from 'wdShare/Index';
  5 +import { TrackConstants } from 'wdTracking/Index';
3 6
4 /** 7 /**
5 * 早晚报页面标题bar 8 * 早晚报页面标题bar
@@ -9,7 +12,7 @@ import { ToastUtils } from 'wdKit'; @@ -9,7 +12,7 @@ import { ToastUtils } from 'wdKit';
9 export struct PaperTitleComponent { 12 export struct PaperTitleComponent {
10 @Consume title?: string 13 @Consume title?: string
11 @Consume subTitle?: string 14 @Consume subTitle?: string
12 - 15 + topicInfo: TopicInfo = {} as TopicInfo
13 aboutToAppear() { 16 aboutToAppear() {
14 } 17 }
15 18
@@ -105,7 +108,7 @@ export struct PaperTitleComponent { @@ -105,7 +108,7 @@ export struct PaperTitleComponent {
105 .id('img_share') 108 .id('img_share')
106 .margin({ right: 16 }) 109 .margin({ right: 16 })
107 .onClick(() => { 110 .onClick(() => {
108 - ToastUtils.showToast('分享为公共方法,待开发', 1000) 111 + this.share()
109 }) 112 })
110 } 113 }
111 // .margin({ left: 14, right: 14 }) 114 // .margin({ left: 14, right: 14 })
@@ -149,4 +152,28 @@ export struct PaperTitleComponent { @@ -149,4 +152,28 @@ export struct PaperTitleComponent {
149 // } 152 // }
150 // .margin({ left: 6 }) 153 // .margin({ left: 6 })
151 } 154 }
  155 +
  156 + share() {
  157 + let contentDetailData: ContentDetailDTO = {
  158 + newsId:Number.parseInt(this.topicInfo.topicId),
  159 + shareInfo:{
  160 + contentId:this.topicInfo.topicId,
  161 + contentType:this.topicInfo.topicType+'',
  162 + shareTitle:this.topicInfo.shareTitle,
  163 + shareSummary:this.topicInfo.shareSummary,
  164 + imageUrl:this.topicInfo.shareCoverUrl,
  165 + sharePosterCoverUrl:this.topicInfo.sharePosterCoverUrl,
  166 + shareUrl:this.topicInfo.shareUrl,
  167 + targetRelId:this.topicInfo.relId,
  168 + targetRelType:this.topicInfo.relType,
  169 + showReport:false,
  170 + showLike:-1,
  171 + shareOpen:1,
  172 + sharePosterOpen:this.topicInfo.posterFlag,
  173 + showPoster:this.topicInfo.posterFlag>0?1:-1,
  174 + }
  175 + } as ContentDetailDTO
  176 + WDShare.setTopicBeanToShareBean(contentDetailData.shareInfo,this.topicInfo)
  177 + WDShare.shareContent(contentDetailData,TrackConstants.PageName.Eletronic_Paper,TrackConstants.PageName.Eletronic_Paper)
  178 + }
152 } 179 }
1 -import { ContentDetailDTO, ContentDTO, PageInfoDTO } from 'wdBean/Index'; 1 +import { ContentDetailDTO, ContentDTO, PageInfoDTO, ShareInfoDTO, TopicInfo } from 'wdBean/Index';
  2 +import { SharePosterItemBean } from 'wdBean/src/main/ets/bean/detail/SharePosterItemBean';
2 import { ShareScene, ShareType, WDShareBase } from 'wdShareBase/Index'; 3 import { ShareScene, ShareType, WDShareBase } from 'wdShareBase/Index';
3 import { ShareContentType } from 'wdShareBase/src/main/ets/Constant'; 4 import { ShareContentType } from 'wdShareBase/src/main/ets/Constant';
4 5
@@ -29,4 +30,58 @@ export class WDShare { @@ -29,4 +30,58 @@ export class WDShare {
29 30
30 } 31 }
31 32
  33 + //专题分享数据转换
  34 + static setTopicBeanToShareBean(shareBean: ShareInfoDTO, topicInfoBean: TopicInfo){
  35 + shareBean.topicType = topicInfoBean.topicType+''
  36 + //21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题,26:时间链
  37 + if(25 == topicInfoBean.topicType){
  38 + shareBean.showPosterType = 6
  39 + shareBean.topicPattern = topicInfoBean.topicPattern
  40 + shareBean.publishTime = topicInfoBean.topicDate
  41 + if(topicInfoBean.frontLinkObject == null){
  42 + shareBean.isFrontDaily = false
  43 + if(topicInfoBean.shareContentList != null && topicInfoBean.shareContentList.length>0){
  44 + shareBean.sharePosterItemList = [] as SharePosterItemBean[]
  45 + shareBean.sharePosterItemList.length = topicInfoBean.shareContentList.length
  46 + for (let index = 0; index < topicInfoBean.shareContentList.length; index++) {
  47 + let element = topicInfoBean.shareContentList[index]
  48 + if(element != null){
  49 + shareBean.sharePosterItemList[index] = {
  50 + title:topicInfoBean.shareContentList[index].newsTitle,
  51 + imageUrl:topicInfoBean.shareContentList[index].coverUrl,
  52 + } as SharePosterItemBean
  53 + }
  54 + }
  55 + }
  56 + }else{
  57 + shareBean.isFrontDaily = true
  58 + shareBean.sharePosterCoverUrl = topicInfoBean.frontLinkObject.coverUrl
  59 + shareBean.posterSummary = topicInfoBean.frontLinkObject.summary
  60 + }
  61 + }else{
  62 + //文章/直播/话题专题(H5普通文章专题,包含时间链)
  63 + shareBean.showPosterType = 8
  64 + //海报的头图
  65 + shareBean.sharePosterCoverUrl = topicInfoBean.backgroundImgUrl
  66 + shareBean.isFrontDaily = false
  67 + shareBean.posterTitle = topicInfoBean.title
  68 + shareBean.posterSummary = topicInfoBean.summary
  69 + if(topicInfoBean.shareContentList != null && topicInfoBean.shareContentList.length>0){
  70 + shareBean.sharePosterItemList = [] as SharePosterItemBean[]
  71 + shareBean.sharePosterItemList.length = topicInfoBean.shareContentList.length
  72 + for (let index = 0; index < topicInfoBean.shareContentList.length; index++) {
  73 + let element = topicInfoBean.shareContentList[index]
  74 + if(element != null){
  75 + shareBean.sharePosterItemList[index] = {
  76 + title:topicInfoBean.shareContentList[index].newsTitle,
  77 + imageUrl:topicInfoBean.shareContentList[index].coverUrl,
  78 + timeNode:topicInfoBean.shareContentList[index].publishTime,
  79 + timeBlurred:topicInfoBean.shareContentList[index].timeBlurred
  80 + } as SharePosterItemBean
  81 + }
  82 + }
  83 + }
  84 + }
  85 + }
  86 +
32 } 87 }
@@ -5,7 +5,7 @@ import window from '@ohos.window'; @@ -5,7 +5,7 @@ import window from '@ohos.window';
5 import { TrackingPageBrowse ,TrackConstants} from 'wdTracking/Index'; 5 import { TrackingPageBrowse ,TrackConstants} from 'wdTracking/Index';
6 6
7 const TAG = 'ENewspaper'; 7 const TAG = 'ENewspaper';
8 - 8 +//电子报主页面
9 @Entry 9 @Entry
10 @Component 10 @Component
11 struct ENewspaper { 11 struct ENewspaper {