wangyujian_wd

Merge remote-tracking branch 'origin/main'

Showing 20 changed files with 526 additions and 74 deletions
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * ResponseDTO 2 * ResponseDTO
3 */ 3 */
4 export interface ResponseDTO<T = string> { 4 export interface ResponseDTO<T = string> {
5 - success:boolean; 5 + success: boolean;
6 6
7 // 服务请求响应值/微服务响应状态码” 7 // 服务请求响应值/微服务响应状态码”
8 code: number; 8 code: number;
@@ -12,6 +12,7 @@ export interface ResponseDTO<T = string> { @@ -12,6 +12,7 @@ export interface ResponseDTO<T = string> {
12 12
13 // 响应结果 13 // 响应结果
14 data?: T; 14 data?: T;
  15 + totalCount?: number;
15 16
16 // 请求响应时间戳(unix格式) 17 // 请求响应时间戳(unix格式)
17 timestamp?: number; 18 timestamp?: number;
@@ -43,6 +43,7 @@ export class WDRouterPage { @@ -43,6 +43,7 @@ export class WDRouterPage {
43 static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage"); 43 static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage");
44 // 直播详情页 44 // 直播详情页
45 static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage"); 45 static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage");
  46 + static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage");
46 // 多图(图集)详情页 47 // 多图(图集)详情页
47 static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage"); 48 static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage");
48 // 音乐详情页 49 // 音乐详情页
@@ -171,12 +171,15 @@ export interface LiveInfo { @@ -171,12 +171,15 @@ export interface LiveInfo {
171 liveState: string 171 liveState: string
172 //2024-04-12 15:00:00 直播开始时间 172 //2024-04-12 15:00:00 直播开始时间
173 planStartTime: string 173 planStartTime: string
  174 + liveStyle: number;
174 vlive: Array<Vlive> 175 vlive: Array<Vlive>
175 - mlive:MLive 176 + mlive: MLive
176 } 177 }
  178 +
177 export interface MLive { 179 export interface MLive {
178 - mliveId:string 180 + mliveId: string
179 } 181 }
  182 +
180 export interface FullColumnImgUrls { 183 export interface FullColumnImgUrls {
181 url: string 184 url: string
182 } 185 }
@@ -35,63 +35,63 @@ export struct DynamicDetailComponent { @@ -35,63 +35,63 @@ export struct DynamicDetailComponent {
35 //logo、日期 35 //logo、日期
36 Row() { 36 Row() {
37 Image($r('app.media.ic_article_rmh')) 37 Image($r('app.media.ic_article_rmh'))
38 - .width(80)  
39 - .height(28)  
40 - .margin({ left: 16 }) 38 + .width($r('app.float.margin_80'))
  39 + .height($r('app.float.margin_28'))
  40 + .margin({ left: $r('app.float.margin_16') })
41 Blank() 41 Blank()
42 Text("2023年03月14日 08:16") 42 Text("2023年03月14日 08:16")
43 .fontColor($r('app.color.color_B0B0B0')) 43 .fontColor($r('app.color.color_B0B0B0'))
44 - .fontSize(12)  
45 - .lineHeight(28)  
46 - .margin({ right: 16 }) 44 + .fontSize($r('app.float.font_size_12'))
  45 + .lineHeight($r('app.float.margin_28'))
  46 + .margin({ right: $r('app.float.margin_16') })
47 } 47 }
48 - .height(48) 48 + .height($r('app.float.margin_48'))
49 .width('100%') 49 .width('100%')
50 //分割线 50 //分割线
51 Image($r('app.media.ic_news_detail_division')) 51 Image($r('app.media.ic_news_detail_division'))
52 .width('100%') 52 .width('100%')
53 - .height(7)  
54 - .margin({left: 16, right: 16} ) 53 + .height($r('app.float.margin_7'))
  54 + .margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
55 //号主信息 55 //号主信息
56 Row() { 56 Row() {
57 //头像 57 //头像
58 Stack() { 58 Stack() {
59 Image(this.contentDetailData.rmhInfo?.rmhHeadUrl) 59 Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
60 .alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater')) 60 .alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater'))
61 - .width('32')  
62 - .height('32') 61 + .width($r('app.float.margin_32'))
  62 + .height($r('app.float.margin_32'))
63 .objectFit(ImageFit.Cover) 63 .objectFit(ImageFit.Cover)
64 - .borderRadius(16) 64 + .borderRadius($r('app.float.margin_16'))
65 Image($r('app.media.icon_border_test')) 65 Image($r('app.media.icon_border_test'))
66 - .width('48')  
67 - .height('48') 66 + .width($r('app.float.margin_48'))
  67 + .height($r('app.float.margin_48'))
68 .objectFit(ImageFit.Cover) 68 .objectFit(ImageFit.Cover)
69 - .borderRadius(24) 69 + .borderRadius($r('app.float.margin_24'))
70 } 70 }
71 - .width(48)  
72 - .height(48) 71 + .width($r('app.float.margin_48'))
  72 + .height($r('app.float.margin_48'))
73 .alignContent(Alignment.Center) 73 .alignContent(Alignment.Center)
74 Column(){ 74 Column(){
75 //昵称 75 //昵称
76 Text("this.contentDetailData.rmhInfo?.rmhName") 76 Text("this.contentDetailData.rmhInfo?.rmhName")
77 - .fontSize(14) 77 + .fontSize($r('app.float.font_size_14'))
78 .fontColor($r('app.color.color_222222')) 78 .fontColor($r('app.color.color_222222'))
79 .fontWeight(FontWeight.Medium) 79 .fontWeight(FontWeight.Medium)
80 - .margin({ left: 5 }) 80 + .margin({ left: $r('app.float.margin_5') })
81 //简介 81 //简介
82 Text("this.contentDetailData.rmhInfo?.rmhDesc") 82 Text("this.contentDetailData.rmhInfo?.rmhDesc")
83 - .fontSize(14) 83 + .fontSize($r('app.float.font_size_14'))
84 .fontColor($r('app.color.color_B0B0B0')) 84 .fontColor($r('app.color.color_B0B0B0'))
85 .fontWeight(FontWeight.Medium) 85 .fontWeight(FontWeight.Medium)
86 - .margin({ left: 5 }) 86 + .margin({ left: $r('app.float.margin_5') })
87 } 87 }
88 if (!this.followStatus) { 88 if (!this.followStatus) {
89 Text('关注') 89 Text('关注')
90 .width(60) 90 .width(60)
91 - .height(24) 91 + .height($r('app.float.margin_48'))
92 .textAlign(TextAlign.Center) 92 .textAlign(TextAlign.Center)
93 .fontSize($r('app.float.font_size_12')) 93 .fontSize($r('app.float.font_size_12'))
94 - .borderRadius($r('app.float.button_border_radius')) 94 + .borderRadius($r('app.float.vp_3'))
95 .backgroundColor($r('app.color.color_ED2800')) 95 .backgroundColor($r('app.color.color_ED2800'))
96 .fontColor($r('app.color.color_fff')) 96 .fontColor($r('app.color.color_fff'))
97 .onClick(() => { 97 .onClick(() => {
@@ -99,12 +99,12 @@ export struct DynamicDetailComponent { @@ -99,12 +99,12 @@ export struct DynamicDetailComponent {
99 }) 99 })
100 } else { 100 } else {
101 Text('已关注') 101 Text('已关注')
102 - .width(60)  
103 - .height(24) 102 + .width($r('app.float.margin_60'))
  103 + .height($r('app.float.margin_48'))
104 .borderWidth(1) 104 .borderWidth(1)
105 .textAlign(TextAlign.Center) 105 .textAlign(TextAlign.Center)
106 .fontSize($r('app.float.font_size_12')) 106 .fontSize($r('app.float.font_size_12'))
107 - .borderRadius($r('app.float.button_border_radius')) 107 + .borderRadius($r('app.float.vp_3'))
108 .borderColor($r('app.color.color_CCCCCC')) 108 .borderColor($r('app.color.color_CCCCCC'))
109 .fontColor($r('app.color.color_CCCCCC')) 109 .fontColor($r('app.color.color_CCCCCC'))
110 .onClick(() => { 110 .onClick(() => {
@@ -113,6 +113,53 @@ export struct DynamicDetailComponent { @@ -113,6 +113,53 @@ export struct DynamicDetailComponent {
113 } 113 }
114 } 114 }
115 .width('100%') 115 .width('100%')
  116 + //内容
  117 + Text("这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里")
  118 + .fontColor($r('app.color.color_222222'))
  119 + .fontSize($r('app.float.font_size_18'))
  120 + .lineHeight($r('app.float.margin_25'))
  121 + .margin({ top: $r('app.float.margin_6')
  122 + ,left: $r('app.float.margin_16')
  123 + ,right: $r('app.float.margin_16') })
  124 + //特别声明
  125 + Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")
  126 + .fontColor($r('app.color.color_CCCCCC'))
  127 + .fontSize($r('app.float.font_size_12'))
  128 + .lineHeight($r('app.float.margin_16'))
  129 + .margin({ top: $r('app.float.margin_16')
  130 + ,left: $r('app.float.margin_16')
  131 + ,right: $r('app.float.margin_16') })
  132 + //微信/朋友圈/微博
  133 + Row(){
  134 + Image($r('app.media.xxhdpi_pic_wechat'))
  135 + .width($r('app.float.margin_116'))
  136 + .height($r('app.float.margin_36'))
  137 + .objectFit(ImageFit.Cover)
  138 + Image($r('app.media.xxhdpi_pic_pyq'))
  139 + .width($r('app.float.margin_116'))
  140 + .height($r('app.float.margin_36'))
  141 + .margin({ left: $r('app.float.margin_4_negative')})
  142 + .objectFit(ImageFit.Cover)
  143 + Image($r('app.media.xxhdpi_pic_wb'))
  144 + .width($r('app.float.margin_116'))
  145 + .height($r('app.float.margin_36'))
  146 + .margin({ left: $r('app.float.margin_4_negative')})
  147 + .objectFit(ImageFit.Cover)
  148 + }
  149 + .margin({ top: $r('app.float.margin_24')})
  150 + //点赞
  151 + Row(){
  152 + Image($r('app.media.icon_like_selected_redheart'))
  153 + .width($r('app.float.margin_24'))
  154 + .height($r('app.float.margin_24'))
  155 + .objectFit(ImageFit.Cover)
  156 + Text("2.6万")
  157 + .fontColor($r('app.color.color_999999'))
  158 + .fontSize($r('app.float.font_size_16'))
  159 + .lineHeight($r('app.float.margin_20'))
  160 + .margin({ left: $r('app.float.margin_2')})
  161 + }
  162 + //评论组件/底部组件
116 } 163 }
117 } 164 }
118 .backgroundColor('#FFFFFFFF') 165 .backgroundColor('#FFFFFFFF')
  1 +import { CompDTO, ContentDTO, Params } from 'wdBean';
  2 +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
  3 +import { HttpUrlUtils } from 'wdNetwork/Index';
  4 +import { postInteractAccentionOperateParams } from 'wdBean';
  5 +import { PageRepository } from '../repository/PageRepository';
  6 +import { CommonConstants } from 'wdConstant/Index';
  7 +
  8 +/**
  9 + * 精选评论卡
  10 + * Zh_Single_Row-06
  11 + */
  12 +const TAG = 'Zh_Single_Row-06'
  13 +
  14 +@Entry
  15 +@Component
  16 +export struct ZhSingleRow06 {
  17 + @State compDTO: CompDTO = {} as CompDTO
  18 + @State list: Array<string> = ['社会', '三个字', '是四个字', '时事', '社会', '三个字', '是四个字', '时事']
  19 + @State activeIndexs: Array<number> = []
  20 +
  21 + getItemWidth(index: number) {
  22 + if (index % 4 === 0 || index % 4 === 3) {
  23 + return 80
  24 + } else {
  25 + return 96
  26 + }
  27 + }
  28 +
  29 + build() {
  30 + Column() {
  31 + //顶部
  32 + this.CompHeader(this.compDTO)
  33 + Grid() {
  34 + ForEach(this.list, (item: string, index: number) => {
  35 + GridItem() {
  36 + Text(item)
  37 + .fontSize(14)
  38 + .fontColor(this.activeIndexs.includes(index) ? 0x222222 : 0x666666)
  39 + .fontWeight(this.activeIndexs.includes(index) ? 600 : 400)
  40 + .textAlign(TextAlign.Center)
  41 + }
  42 + .onClick(() => {
  43 + if (this.activeIndexs.includes(index)) {
  44 + const ind = this.activeIndexs.indexOf(index);
  45 + this.activeIndexs.splice(ind, 1)
  46 + } else {
  47 + this.activeIndexs.push(index)
  48 + }
  49 + })
  50 + })
  51 + }
  52 + .height(70)
  53 + .columnsTemplate('1fr 1fr 1fr 1fr')
  54 + .rowsTemplate('1fr 1fr')
  55 + .margin({bottom: 10})
  56 +
  57 +
  58 + Text('选中标签,为您推荐更多您感兴趣的内容')
  59 + .fontSize(12)
  60 + .fontColor(0xB0B0B0)
  61 + .textAlign(TextAlign.Center)
  62 + .margin({bottom: 10})
  63 +
  64 + Row() {
  65 + Text('选好了')
  66 + .fontSize(14)
  67 + .fontColor(0x000000)
  68 + .width('100%')
  69 + .textAlign(TextAlign.Center)
  70 + }
  71 + .height(40)
  72 + .backgroundColor(0xf9f9f9)
  73 + .width('100%')
  74 + .borderRadius(3)
  75 + }
  76 + .padding({
  77 + left: $r('app.float.card_comp_pagePadding_lf'),
  78 + right: $r('app.float.card_comp_pagePadding_lf'),
  79 + top: $r('app.float.card_comp_pagePadding_tb'),
  80 + bottom: $r('app.float.card_comp_pagePadding_tb')
  81 + })
  82 + .backgroundColor($r('app.color.white'))
  83 + .margin({ bottom: 8 })
  84 +
  85 + }
  86 +
  87 + @Builder
  88 + CompHeader(item: CompDTO) {
  89 + Row() {
  90 + Row() {
  91 + Image($r("app.media.icon_interest_ask"))
  92 + .width(24)
  93 + .height(24)
  94 + .margin({ right: 4 })
  95 + Text('以下是否有您感兴趣?')
  96 + .fontSize($r("app.float.font_size_17"))
  97 + .fontColor(0x000000)
  98 + .fontWeight(600)
  99 + }
  100 +
  101 + Row() {
  102 + Image($r("app.media.close_button"))
  103 + .width(14)
  104 + .height(14)
  105 + .onClick(() => {
  106 + })
  107 + }
  108 + .padding({
  109 + right: $r('app.float.card_comp_pagePadding_lf'),
  110 + })
  111 + }
  112 + .justifyContent(FlexAlign.SpaceBetween)
  113 + .margin({ top: 8, bottom: 8 })
  114 + .width('100%')
  115 + }
  116 +}
  117 +
  118 +@Extend(Text)
  119 +function textOverflowStyle(maxLine: number) {
  120 + .maxLines(maxLine)
  121 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  122 +}
  123 +
  124 +@Component
  125 +struct CreatorItem {
  126 + @Prop item: ContentDTO
  127 + @State rmhIsAttention: number = 0
  128 + build() {
  129 + ListItem() {
  130 + Column() {
  131 + Flex({direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween}) {
  132 + Column() {
  133 + Row() {
  134 + Image('')
  135 + .width(20)
  136 + .height(20)
  137 + .margin({right: 4})
  138 + .border({width: 1, color: 0xcccccc, radius: 10})
  139 + Text('立志之间')
  140 + .fontColor(0x212228)
  141 + .fontSize(12)
  142 + }
  143 + }
  144 +
  145 + Column() {
  146 + Row() {
  147 + Image($r('app.media.icon_like_no'))
  148 + .width(16)
  149 + .height(16)
  150 + .margin({right: 4})
  151 + Text('3835')
  152 + .fontSize(14)
  153 + .fontColor(0x999999)
  154 + }
  155 + }
  156 + }
  157 + .margin({top: 10, left: 10, right: 10, bottom: 8})
  158 +
  159 + Text('就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,')
  160 + .maxLines(2)
  161 + .textOverflow({overflow: TextOverflow.Ellipsis})
  162 + .margin({left: 10, right: 10, bottom: 8})
  163 + .fontSize(17)
  164 + .fontColor(0x212228)
  165 + .lineHeight(25)
  166 +
  167 + Row() {
  168 + Image('')
  169 + .width(66)
  170 + .height(44)
  171 + .borderRadius({topLeft: 3, topRight: 0, bottomLeft: 3, bottomRight: 0})
  172 + Text('原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制')
  173 + .margin({left: 8})
  174 + .width(172)
  175 + .maxLines(2)
  176 + .textOverflow({overflow: TextOverflow.Ellipsis})
  177 + }
  178 + .linearGradient({
  179 + direction: GradientDirection.Right,
  180 + colors: [[0xffffff, 0.0],[0xffffff, 0.8], [0xf9f9f9, 1.0]]
  181 + })
  182 + }
  183 + .width(276)
  184 + .height(150)
  185 + .margin({ right: 10 })
  186 + .borderWidth(1)
  187 + .borderColor($r('app.color.color_EDEDED'))
  188 + .borderRadius($r('app.float.image_border_radius'))
  189 + .backgroundColor(0xf9f9f9)
  190 + }
  191 + .onClick(() => {
  192 + console.log('跳转到rmh');
  193 + })
  194 + }
  195 +
  196 + /**
  197 + * 关注号主 TODO 这里后面需要抽离
  198 + */
  199 + handleAccention(item: ContentDTO, status: number) {
  200 + this.rmhIsAttention = this.rmhIsAttention ? 0 : 1
  201 + return
  202 + // 未登录,跳转登录
  203 + if (!HttpUrlUtils.getUserId()) {
  204 + WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
  205 + return
  206 + }
  207 +
  208 + const params: postInteractAccentionOperateParams = {
  209 + attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
  210 + attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id
  211 + attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id
  212 + // userType: 1,
  213 + // userId: '1', // TODO 用户id需要从本地获取
  214 + status: status,
  215 + }
  216 + PageRepository.postInteractAccentionOperate(params).then(res => {
  217 + console.log(TAG, '关注号主==', JSON.stringify(res.data))
  218 + if (status === 1) {
  219 + this.rmhIsAttention = 0
  220 + } else {
  221 + this.rmhIsAttention = 1
  222 + }
  223 + })
  224 + }
  225 +}
@@ -37,6 +37,10 @@ @@ -37,6 +37,10 @@
37 "value": "18fp" 37 "value": "18fp"
38 }, 38 },
39 { 39 {
  40 + "name": "font_size_18",
  41 + "value": "18fp"
  42 + },
  43 + {
40 "name": "font_size_24", 44 "name": "font_size_24",
41 "value": "24fp" 45 "value": "24fp"
42 }, 46 },
@@ -49,6 +53,10 @@ @@ -49,6 +53,10 @@
49 "value": "36fp" 53 "value": "36fp"
50 }, 54 },
51 { 55 {
  56 + "name": "margin_4_negative",
  57 + "value": "-4vp"
  58 + },
  59 + {
52 "name": "main_margin", 60 "name": "main_margin",
53 "value": "14vp" 61 "value": "14vp"
54 }, 62 },
@@ -77,6 +85,46 @@ @@ -77,6 +85,46 @@
77 "value": "160vp" 85 "value": "160vp"
78 }, 86 },
79 { 87 {
  88 + "name": "margin_80",
  89 + "value": "80vp"
  90 + },
  91 + {
  92 + "name": "margin_2",
  93 + "value": "2vp"
  94 + },
  95 + {
  96 + "name": "margin_5",
  97 + "value": "5vp"
  98 + },
  99 + {
  100 + "name": "margin_7",
  101 + "value": "7vp"
  102 + },
  103 + {
  104 + "name": "margin_20",
  105 + "value": "20vp"
  106 + },
  107 + {
  108 + "name": "margin_24",
  109 + "value": "24vp"
  110 + },
  111 + {
  112 + "name": "margin_25",
  113 + "value": "25vp"
  114 + },
  115 + {
  116 + "name": "margin_28",
  117 + "value": "28vp"
  118 + },
  119 + {
  120 + "name": "margin_48",
  121 + "value": "48vp"
  122 + },
  123 + {
  124 + "name": "margin_60",
  125 + "value": "60vp"
  126 + },
  127 + {
80 "name": "single_row_03_img_height", 128 "name": "single_row_03_img_height",
81 "value": "88vp" 129 "value": "88vp"
82 }, 130 },
@@ -133,6 +181,10 @@ @@ -133,6 +181,10 @@
133 "value": "24vp" 181 "value": "24vp"
134 }, 182 },
135 { 183 {
  184 + "name": "margin_6",
  185 + "value": "6vp"
  186 + },
  187 + {
136 "name": "margin_16", 188 "name": "margin_16",
137 "value": "16vp" 189 "value": "16vp"
138 }, 190 },
@@ -141,6 +193,14 @@ @@ -141,6 +193,14 @@
141 "value": "20vp" 193 "value": "20vp"
142 }, 194 },
143 { 195 {
  196 + "name": "margin_32",
  197 + "value": "32vp"
  198 + },
  199 + {
  200 + "name": "margin_36",
  201 + "value": "36vp"
  202 + },
  203 + {
144 "name": "vp_3", 204 "name": "vp_3",
145 "value": "3vp" 205 "value": "3vp"
146 }, 206 },
@@ -167,6 +227,10 @@ @@ -167,6 +227,10 @@
167 { 227 {
168 "name": "card_comp_pagePadding_tb", 228 "name": "card_comp_pagePadding_tb",
169 "value": "14fp" 229 "value": "14fp"
  230 + },
  231 + {
  232 + "name": "margin_116",
  233 + "value": "116vp"
170 } 234 }
171 ] 235 ]
172 } 236 }
1 -export { DetailPlayLivePage } from './src/main/ets/pages/DetailPlayLivePage'  
  1 +export { DetailPlayLivePage } from './src/main/ets/pages/DetailPlayLivePage'
  2 +
  3 +export { DetailPlayVLivePage } from './src/main/ets/pages/DetailPlayVLivePage'
  1 +import { BottomComponent } from '../widgets/details/BottomComponent';
  2 +import { TabComponent } from '../widgets/details/TabComponent';
  3 +import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
  4 +
  5 +
  6 +@Component
  7 +export struct DetailPlayHLivePage {
  8 + aboutToAppear(): void {
  9 +
  10 + }
  11 +
  12 + build() {
  13 + Column() {
  14 + TopPlayComponent()
  15 + TabComponent()
  16 + BottomComponent()
  17 + }
  18 + .height('100%')
  19 + .width('100%')
  20 + }
  21 +
  22 + onPageShow(): void {
  23 +
  24 + }
  25 +
  26 + aboutToDisappear(): void {
  27 +
  28 + }
  29 +}
  1 +import { BottomComponent } from '../widgets/details/BottomComponent';
  2 +import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
  3 +import { TopPlayVComponent } from '../widgets/details/video/TopPlayVComponet';
  4 +
  5 +
  6 +@Component
  7 +export struct DetailPlayVLivePage {
  8 + aboutToAppear(): void {
  9 +
  10 + }
  11 +
  12 + build() {
  13 + Column() {
  14 + TopPlayVComponent()
  15 + // TabComponent()
  16 + BottomComponent()
  17 + }
  18 + .height('100%')
  19 + .width('100%')
  20 + }
  21 +
  22 + onPageShow(): void {
  23 +
  24 + }
  25 +
  26 + aboutToDisappear(): void {
  27 +
  28 + }
  29 +}
  1 +import { LiveDetailsBean } from 'wdBean/Index';
  2 +import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer/Index';
  3 +import { PlayUIComponent } from './PlayUIComponent';
  4 +
  5 +@Component
  6 +export struct TopPlayVComponent {
  7 + @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
  8 + playerController: WDPlayerController = new WDPlayerController();
  9 +
  10 + aboutToAppear(): void {
  11 + this.playerController.onCanplay = () => {
  12 + this.playerController.play()
  13 + }
  14 + }
  15 +
  16 + updateData() {
  17 + //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
  18 + if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) {
  19 + let playUrl = ''
  20 + if (this.liveDetailsBean.liveInfo.liveState == 'running') {
  21 + playUrl = this.liveDetailsBean.liveInfo.vlive[0].liveUrl
  22 + } else if (this.liveDetailsBean.liveInfo.liveState == 'end') {
  23 + playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
  24 + }
  25 + this.playerController.firstPlay(playUrl);
  26 + }
  27 + }
  28 +
  29 + build() {
  30 + Stack() {
  31 + // https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-image-effect-0000001862607345
  32 + Image(this.liveDetailsBean.fullColumnImgUrls[0].url)
  33 + .height('100%')
  34 + .width('100%')
  35 + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
  36 + .blur(100)
  37 +
  38 + WDPlayerRenderView({
  39 + playerController: this.playerController,
  40 + onLoad: async () => {
  41 + }
  42 + })// .height('100%')
  43 + .width('100%')// 扩展至所有非安全区域
  44 + .onClick(() => {
  45 + this.playerController.play()
  46 + })
  47 + // PlayUIComponent({ playerController: this.playerController })
  48 + }
  49 + // .height('100%')
  50 + .width('100%')
  51 + // 扩展至所有非安全区域
  52 + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
  53 + }
  54 +
  55 + aboutToDisappear(): void {
  56 + this.playerController.pause()
  57 + }
  58 +}
1 import mediaquery from '@ohos.mediaquery'; 1 import mediaquery from '@ohos.mediaquery';
2 import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; 2 import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
3 -import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; 3 +import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
4 import { ContentDetailRequest, devicePLSensorManager } from 'wdDetailPlayApi'; 4 import { ContentDetailRequest, devicePLSensorManager } from 'wdDetailPlayApi';
5 import { PlayControlViewContainer } from '../view/PlayControlViewContainer'; 5 import { PlayControlViewContainer } from '../view/PlayControlViewContainer';
6 import { PlayerDetailContainer } from '../view/PlayerDetailContainer'; 6 import { PlayerDetailContainer } from '../view/PlayerDetailContainer';
@@ -32,6 +32,19 @@ export struct DetailPlayShortVideoPage { @@ -32,6 +32,19 @@ export struct DetailPlayShortVideoPage {
32 @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2 32 @Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
33 @Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 33 @Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
34 @Provide followStatus: string = '0' // 关注状态 34 @Provide followStatus: string = '0' // 关注状态
  35 + @Link @Watch('switchVideoStatusChange') switchVideoStatus: boolean
  36 +
  37 + switchVideoStatusChange() {
  38 + if (this.switchVideoStatus) {
  39 + if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_PAUSE) {
  40 + this.playerController.play()
  41 + }
  42 + } else {
  43 + if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_START) {
  44 + this.playerController.pause()
  45 + }
  46 + }
  47 + }
35 48
36 currentIndexChange() { 49 currentIndexChange() {
37 if (this.currentIndex != this.index) { 50 if (this.currentIndex != this.index) {
@@ -166,6 +179,7 @@ export struct DetailPlayShortVideoPage { @@ -166,6 +179,7 @@ export struct DetailPlayShortVideoPage {
166 }) 179 })
167 .height('100%') 180 .height('100%')
168 .width('100%') 181 .width('100%')
  182 + .margin({ top: this.contentDetailData?.videoInfo[0]?.videoLandScape === 1 ? 218 : 0 })
169 .onClick(() => { 183 .onClick(() => {
170 console.error('WDPlayerRenderView=== onClick') 184 console.error('WDPlayerRenderView=== onClick')
171 this.playerController?.switchPlayOrPause(); 185 this.playerController?.switchPlayOrPause();
@@ -24,6 +24,7 @@ export struct DetailVideoListPage { @@ -24,6 +24,7 @@ export struct DetailVideoListPage {
24 @State currentIndex: number = 0 24 @State currentIndex: number = 0
25 @State interactDataList: InteractDataDTO[] = [] 25 @State interactDataList: InteractDataDTO[] = []
26 @State isFullScreen: boolean = false 26 @State isFullScreen: boolean = false
  27 + @State switchVideoStatus: boolean = false
27 28
28 async aboutToAppear(): Promise<void> { 29 async aboutToAppear(): Promise<void> {
29 30
@@ -157,6 +158,7 @@ export struct DetailVideoListPage { @@ -157,6 +158,7 @@ export struct DetailVideoListPage {
157 ForEach(this.data, (item: ContentDetailDTO, index: number) => { 158 ForEach(this.data, (item: ContentDetailDTO, index: number) => {
158 Column() { 159 Column() {
159 DetailPlayShortVideoPage({ 160 DetailPlayShortVideoPage({
  161 + switchVideoStatus: $switchVideoStatus,
160 contentDetailData: item, 162 contentDetailData: item,
161 currentIndex: this.currentIndex, 163 currentIndex: this.currentIndex,
162 index: index, 164 index: index,
@@ -34,14 +34,15 @@ export struct VideoChannelDetail { @@ -34,14 +34,15 @@ export struct VideoChannelDetail {
34 private channelStrategy: string = '1' // 频道策略 1-推荐;2-时间线 34 private channelStrategy: string = '1' // 频道策略 1-推荐;2-时间线
35 // private topicId?: string = '' // 专题id 35 // private topicId?: string = '' // 专题id
36 // private recommend?: string = '' // 0.非推荐,1.推荐; 36 // private recommend?: string = '' // 0.非推荐,1.推荐;
37 - @State @Watch('navIndexChange') bottomNavIndex: number = 0  
38 - @State @Watch('navIndexChange') topNavIndex: number = 0 37 + @Link @Watch('navIndexChange') bottomNavIndex: number
  38 + @Link @Watch('navIndexChange') topNavIndex: number
39 private swiperController: SwiperController = new SwiperController() 39 private swiperController: SwiperController = new SwiperController()
40 @Provide showComment: boolean = false 40 @Provide showComment: boolean = false
41 @State data: ContentDetailDTO[] = [] 41 @State data: ContentDetailDTO[] = []
42 @State currentIndex: number = 0 42 @State currentIndex: number = 0
43 @State interactDataList: InteractDataDTO[] = [] 43 @State interactDataList: InteractDataDTO[] = []
44 @State totalCount: number = 0 44 @State totalCount: number = 0
  45 + @State switchVideoStatus: boolean = false
45 46
46 /** 47 /**
47 * 监听视频频道激活或失活 48 * 监听视频频道激活或失活
@@ -49,30 +50,22 @@ export struct VideoChannelDetail { @@ -49,30 +50,22 @@ export struct VideoChannelDetail {
49 navIndexChange() { 50 navIndexChange() {
50 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { 51 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
51 // 如果视频在暂停则播放视频 52 // 如果视频在暂停则播放视频
  53 + this.switchVideoStatus = true
52 } else { 54 } else {
53 // 如果视频在播放则暂停视频 55 // 如果视频在播放则暂停视频
  56 + this.switchVideoStatus = false
54 } 57 }
  58 +
55 } 59 }
56 60
57 async aboutToAppear(): Promise<void> { 61 async aboutToAppear(): Promise<void> {
58 - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage  
59 - const windowClass: window.Window = windowStage.getMainWindowSync();  
60 - windowClass.setWindowSystemBarProperties({  
61 - statusBarContentColor: '#ffffff',  
62 - })  
63 - console.error('aboutToAppear groupId', this.groupId)  
64 - console.error('aboutToAppear pageId', this.pageId)  
65 - console.error('aboutToAppear channelId', this.channelId) 62 + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
66 // 根据视频频道传参查询视频楼层信息 63 // 根据视频频道传参查询视频楼层信息
67 this.getRecCompInfo() 64 this.getRecCompInfo()
68 } 65 }
69 66
70 aboutToDisappear(): void { 67 aboutToDisappear(): void {
71 - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage  
72 - const windowClass: window.Window = windowStage.getMainWindowSync();  
73 - windowClass.setWindowSystemBarProperties({  
74 - statusBarContentColor: '#000000',  
75 - }) 68 + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
76 console.error('aboutToDisappear videoChanel') 69 console.error('aboutToDisappear videoChanel')
77 } 70 }
78 71
@@ -105,8 +98,7 @@ export struct VideoChannelDetail { @@ -105,8 +98,7 @@ export struct VideoChannelDetail {
105 } 98 }
106 99
107 await ContentDetailRequest.getRecCompInfo(params).then(res => { 100 await ContentDetailRequest.getRecCompInfo(params).then(res => {
108 - console.log('根据视频频道传参查询视频楼层信息', res.data?.totalCount)  
109 - console.log('根据视频频道传参查询视频楼层信息', JSON.stringify(res.data?.compList)) 101 + console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
110 102
111 this.totalCount = res.data?.totalCount || 0 103 this.totalCount = res.data?.totalCount || 0
112 const list1: batchContentDetailParams = { 104 const list1: batchContentDetailParams = {
@@ -136,8 +128,6 @@ export struct VideoChannelDetail { @@ -136,8 +128,6 @@ export struct VideoChannelDetail {
136 this.batchContentDetail(list1) 128 this.batchContentDetail(list1)
137 this.getContentInteract(list2) 129 this.getContentInteract(list2)
138 130
139 - }).catch((e: BusinessError) => {  
140 - console.error('eeeeeeeeeeeeee', e)  
141 }) 131 })
142 } 132 }
143 133
@@ -147,7 +137,7 @@ export struct VideoChannelDetail { @@ -147,7 +137,7 @@ export struct VideoChannelDetail {
147 async batchContentDetail(list: batchContentDetailParams) { 137 async batchContentDetail(list: batchContentDetailParams) {
148 if (list.contents.length > 0) { 138 if (list.contents.length > 0) {
149 await ContentDetailRequest.batchContentDetail(list).then(res => { 139 await ContentDetailRequest.batchContentDetail(list).then(res => {
150 - console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data)) 140 + console.log('根据视频楼层信息批量查询视频列表', res.data)
151 this.data = this.data.concat(res.data as []) 141 this.data = this.data.concat(res.data as [])
152 }) 142 })
153 } 143 }
@@ -160,7 +150,7 @@ export struct VideoChannelDetail { @@ -160,7 +150,7 @@ export struct VideoChannelDetail {
160 if (list.contentList.length > 0) { 150 if (list.contentList.length > 0) {
161 await ContentDetailRequest.getContentInteract(list).then(res => { 151 await ContentDetailRequest.getContentInteract(list).then(res => {
162 this.interactDataList = res.data || [] 152 this.interactDataList = res.data || []
163 - console.log('根据视频信息批量查询点赞、收藏状态', JSON.stringify(res)) 153 + console.log('根据视频信息批量查询点赞、收藏状态', res.data)
164 }) 154 })
165 } 155 }
166 } 156 }
@@ -171,6 +161,7 @@ export struct VideoChannelDetail { @@ -171,6 +161,7 @@ export struct VideoChannelDetail {
171 ForEach(this.data, (item: ContentDetailDTO, index: number) => { 161 ForEach(this.data, (item: ContentDetailDTO, index: number) => {
172 Column() { 162 Column() {
173 DetailPlayShortVideoPage({ 163 DetailPlayShortVideoPage({
  164 + switchVideoStatus: $switchVideoStatus,
174 contentDetailData: item, 165 contentDetailData: item,
175 currentIndex: this.currentIndex, 166 currentIndex: this.currentIndex,
176 index: index, 167 index: index,
@@ -48,7 +48,9 @@ export struct PlayerTitleComment { @@ -48,7 +48,9 @@ export struct PlayerTitleComment {
48 } 48 }
49 49
50 getName() { 50 getName() {
51 - return this.contentDetailData?.newsSourceName || this.contentDetailData?.editorName || '' 51 + // console.error(this.contentDetailData?.newsSourceName + '===========' + this.contentDetailData?.editorName)
  52 + // this.contentDetailData?.newsSourceName ||
  53 + return this.contentDetailData?.editorName || ''
52 } 54 }
53 55
54 getTitle() { 56 getTitle() {
@@ -41,16 +41,15 @@ class MGPlayRenderViewIns { @@ -41,16 +41,15 @@ class MGPlayRenderViewIns {
41 export struct WDPlayerRenderView { 41 export struct WDPlayerRenderView {
42 private playerController?: WDPlayerController; 42 private playerController?: WDPlayerController;
43 private xComponentController: XComponentController = new XComponentController(); 43 private xComponentController: XComponentController = new XComponentController();
  44 + private insId: string = "WDPlayRenderView" + insIndex;
44 onLoad?: ((event?: object) => void); 45 onLoad?: ((event?: object) => void);
45 - videoWidth: number = 0  
46 - videoHeight: number = 0 46 + @State videoWidth: number = 0
  47 + @State videoHeight: number = 0
47 @State selfSize: Size = new Size('100%', '100%'); 48 @State selfSize: Size = new Size('100%', '100%');
48 - private insId: string = "WDPlayRenderView" + insIndex;  
49 49
50 aboutToAppear() { 50 aboutToAppear() {
51 MGPlayRenderViewIns.add(); 51 MGPlayRenderViewIns.add();
52 52
53 - console.log('playerController', this.playerController)  
54 insIndex++; 53 insIndex++;
55 if (!this.playerController) { 54 if (!this.playerController) {
56 return 55 return
@@ -80,9 +79,7 @@ export struct WDPlayerRenderView { @@ -80,9 +79,7 @@ export struct WDPlayerRenderView {
80 }) 79 })
81 .onLoad(async (event) => { 80 .onLoad(async (event) => {
82 Logger.info(TAG, 'onLoad') 81 Logger.info(TAG, 'onLoad')
83 - let surfaceId = this.xComponentController.getXComponentSurfaceId()  
84 - console.log('surfaceId===', surfaceId)  
85 - console.log('insId===', this.insId) 82 + // const surfaceId = this.xComponentController.getXComponentSurfaceId()
86 this.xComponentController.setXComponentSurfaceSize({ 83 this.xComponentController.setXComponentSurfaceSize({
87 surfaceWidth: 1920, 84 surfaceWidth: 1920,
88 surfaceHeight: 1080 85 surfaceHeight: 1080
@@ -94,27 +91,14 @@ export struct WDPlayerRenderView { @@ -94,27 +91,14 @@ export struct WDPlayerRenderView {
94 }) 91 })
95 .width(this.selfSize.width) 92 .width(this.selfSize.width)
96 .height(this.selfSize.height) 93 .height(this.selfSize.height)
97 - .margin({ top: this.getPlayerMarginTop() })  
98 } 94 }
99 .id(this.insId) 95 .id(this.insId)
100 .onAreaChange(() => { 96 .onAreaChange(() => {
101 // this.updateLayout() 97 // this.updateLayout()
102 }) 98 })
103 .backgroundColor("#000000") 99 .backgroundColor("#000000")
104 - .alignItems(VerticalAlign.Center)  
105 - .justifyContent(FlexAlign.Center)  
106 - .alignItems(this.selfSize.width === '100%' ? VerticalAlign.Top : VerticalAlign.Center)  
107 - .height('100%')  
108 - .width('100%')  
109 } 100 }
110 -  
111 - /**  
112 - * 横屏播放器非居中展示  
113 - */  
114 - getPlayerMarginTop() {  
115 - return this.selfSize.width === '100%' && this.videoWidth > this.videoHeight ? 218 : 0  
116 - }  
117 - 101 +
118 updateLayout() { 102 updateLayout() {
119 let info = componentUtils.getRectangleById(this.insId); 103 let info = componentUtils.getRectangleById(this.insId);
120 if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) { 104 if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) {