zhenghy

视频接入评论

Showing 29 changed files with 126 additions and 27 deletions
@@ -11,11 +11,12 @@ export struct CommentTabComponent { @@ -11,11 +11,12 @@ export struct CommentTabComponent {
11 } 11 }
12 @ObjectLink publishCommentModel: publishCommentModel 12 @ObjectLink publishCommentModel: publishCommentModel
13 @Prop contentDetail: ContentDetailDTO 13 @Prop contentDetail: ContentDetailDTO
  14 + @Prop pageComponentType: number = -1 //1:视频详情页
14 /*展示类型*/ 15 /*展示类型*/
15 @State type: number = 1 16 @State type: number = 1
16 @State placeHolder: string = '说两句...' 17 @State placeHolder: string = '说两句...'
17 @State dialogController: CustomDialogController | null = null; 18 @State dialogController: CustomDialogController | null = null;
18 - styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 19 + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
19 /*回调方法*/ 20 /*回调方法*/
20 dialogControllerConfirm: () => void = () => { 21 dialogControllerConfirm: () => void = () => {
21 } 22 }
@@ -46,16 +47,44 @@ export struct CommentTabComponent { @@ -46,16 +47,44 @@ export struct CommentTabComponent {
46 Row() { 47 Row() {
47 Stack({ alignContent: Alignment.Start }) { 48 Stack({ alignContent: Alignment.Start }) {
48 RelativeContainer() { 49 RelativeContainer() {
49 - Image($r('app.media.comment_img_input_hui'))  
50 - .objectFit(ImageFit.Fill)  
51 - .resizable({ slice: { top: 1, left: 1, right: 20, bottom: 1 } }) 50 +
  51 + if (this.pageComponentType === 1) {
  52 + Row() {
  53 +
  54 + }
  55 + .width('100%')
  56 + .height(30)
  57 + .borderRadius(2)
  58 + .backgroundColor(this.pageComponentType === 1 ? '#1a1a1a' : Color.Transparent)
  59 + .margin({
  60 + right: 16,
  61 + })
52 .alignRules({ 62 .alignRules({
53 top: { anchor: "__container__", align: VerticalAlign.Top }, 63 top: { anchor: "__container__", align: VerticalAlign.Top },
54 left: { anchor: "__container__", align: HorizontalAlign.Start }, 64 left: { anchor: "__container__", align: HorizontalAlign.Start },
55 right: { anchor: "__container__", align: HorizontalAlign.End }, 65 right: { anchor: "__container__", align: HorizontalAlign.End },
56 bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, 66 bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
57 }) 67 })
58 - .id("Image") 68 + .id("RowBg")
  69 + } else {
  70 + Image($r('app.media.comment_img_input_hui'))
  71 + .objectFit(ImageFit.Fill)
  72 + .resizable({
  73 + slice: {
  74 + top: 1,
  75 + left: 1,
  76 + right: 20,
  77 + bottom: 1
  78 + }
  79 + })
  80 + .alignRules({
  81 + top: { anchor: "__container__", align: VerticalAlign.Top },
  82 + left: { anchor: "__container__", align: HorizontalAlign.Start },
  83 + right: { anchor: "__container__", align: HorizontalAlign.End },
  84 + bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
  85 + })
  86 + .id("Image")
  87 + }
59 Text(this.placeHolder) 88 Text(this.placeHolder)
60 .fontSize(12) 89 .fontSize(12)
61 .fontColor('#999999') 90 .fontColor('#999999')
@@ -91,7 +120,7 @@ export struct CommentIconComponent { @@ -91,7 +120,7 @@ export struct CommentIconComponent {
91 @ObjectLink publishCommentModel: publishCommentModel 120 @ObjectLink publishCommentModel: publishCommentModel
92 /*展示类型*/ 121 /*展示类型*/
93 @State type: number = 1 122 @State type: number = 1
94 - styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 123 + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
95 // aboutToAppear(): void { 124 // aboutToAppear(): void {
96 // setTimeout(() => { 125 // setTimeout(() => {
97 // this.publishCommentModel.totalCommentNumer = '444' 126 // this.publishCommentModel.totalCommentNumer = '444'
@@ -21,6 +21,7 @@ const TAG = 'PageComponent'; @@ -21,6 +21,7 @@ const TAG = 'PageComponent';
21 export struct PageComponent { 21 export struct PageComponent {
22 @State private pageModel: PageModel = new PageModel(); 22 @State private pageModel: PageModel = new PageModel();
23 @State private pageAdvModel: PageAdModel = new PageAdModel(); 23 @State private pageAdvModel: PageAdModel = new PageAdModel();
  24 + @State timer: number = -1
24 navIndex: number = 0; 25 navIndex: number = 0;
25 pageId: string = ""; 26 pageId: string = "";
26 channelId: string = ""; 27 channelId: string = "";
@@ -29,6 +30,7 @@ export struct PageComponent { @@ -29,6 +30,7 @@ export struct PageComponent {
29 @Prop @Watch('onAutoRefresh') autoRefresh: number = 0 30 @Prop @Watch('onAutoRefresh') autoRefresh: number = 0
30 private listScroller: Scroller = new Scroller(); 31 private listScroller: Scroller = new Scroller();
31 needload: boolean = true; 32 needload: boolean = true;
  33 +
32 build() { 34 build() {
33 Column() { 35 Column() {
34 if (this.pageModel.viewType == ViewType.LOADING) { 36 if (this.pageModel.viewType == ViewType.LOADING) {
@@ -222,9 +224,10 @@ export struct PageComponent { @@ -222,9 +224,10 @@ export struct PageComponent {
222 } 224 }
223 225
224 onChange() { 226 onChange() {
225 - Logger.info(TAG, `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`); 227 + Logger.info(TAG,
  228 + `onChangezz id: ${this.pageId} , ${this.channelId} , ${this.navIndex} , navIndex: ${this.currentTopNavSelectedIndex}`);
226 if (this.navIndex === this.currentTopNavSelectedIndex) { 229 if (this.navIndex === this.currentTopNavSelectedIndex) {
227 - if(this.needload){ 230 + if (this.needload) {
228 this.getData(); 231 this.getData();
229 } 232 }
230 this.needload = false; 233 this.needload = false;
@@ -242,13 +245,19 @@ export struct PageComponent { @@ -242,13 +245,19 @@ export struct PageComponent {
242 } 245 }
243 246
244 async getData() { 247 async getData() {
245 - Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);  
246 - this.pageModel.pageId = this.pageId;  
247 - this.pageModel.groupId = this.pageId;  
248 - this.pageModel.channelId = this.channelId;  
249 - this.pageModel.currentPage = 1;  
250 - this.pageModel.pageTotalCompSize = 0;  
251 - PageHelper.getInitData(this.pageModel, this.pageAdvModel) 248 + if (this.timer) {
  249 + clearTimeout(this.timer)
  250 + }
  251 + this.timer = setTimeout(() => {
  252 + Logger.info(TAG, `getData id: ${this.pageId} , ${this.channelId} , navIndex: ${this.currentTopNavSelectedIndex}`);
  253 + this.pageModel.pageId = this.pageId;
  254 + this.pageModel.groupId = this.pageId;
  255 + this.pageModel.channelId = this.channelId;
  256 + this.pageModel.currentPage = 1;
  257 + this.pageModel.pageTotalCompSize = 0;
  258 + PageHelper.getInitData(this.pageModel, this.pageAdvModel)
  259 + }, 100)
  260 +
252 } 261 }
253 } 262 }
254 263
@@ -22,7 +22,7 @@ export struct LikeComponent { @@ -22,7 +22,7 @@ export struct LikeComponent {
22 @Prop data: Record<string, string> 22 @Prop data: Record<string, string>
23 enableBtn = true 23 enableBtn = true
24 componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 24 componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
25 - styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 25 + styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) 3 透明背景
26 @State likeCount: number = 0 //点赞数 26 @State likeCount: number = 0 //点赞数
27 27
28 //上层传值 样例 28 //上层传值 样例
@@ -59,6 +59,7 @@ export struct OperRowListView { @@ -59,6 +59,7 @@ export struct OperRowListView {
59 * 7:图集详情页 59 * 7:图集详情页
60 */ 60 */
61 @Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口 61 @Prop componentType: number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式 3:动态Tab内容下的互动入口
  62 + @Prop pageComponentType: number = -1 //1:视频详情页
62 @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 63 @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
63 @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件 64 @State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
64 @State needLike: boolean = true 65 @State needLike: boolean = true
@@ -115,6 +116,8 @@ export struct OperRowListView { @@ -115,6 +116,8 @@ export struct OperRowListView {
115 } 116 }
116 117
117 build() { 118 build() {
  119 + // 视频详情页
  120 +
118 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { 121 Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
119 // AudioDialog() 122 // AudioDialog()
120 Row() { 123 Row() {
@@ -162,6 +165,7 @@ export struct OperRowListView { @@ -162,6 +165,7 @@ export struct OperRowListView {
162 bottom: `${this.bottomSafeHeight}px` 165 bottom: `${this.bottomSafeHeight}px`
163 // bottom: 50 166 // bottom: 50
164 }) 167 })
  168 +
165 } 169 }
166 170
167 /** 171 /**
@@ -174,12 +178,16 @@ export struct OperRowListView { @@ -174,12 +178,16 @@ export struct OperRowListView {
174 CommentTabComponent({ 178 CommentTabComponent({
175 publishCommentModel: this.publishCommentModel, 179 publishCommentModel: this.publishCommentModel,
176 contentDetail: this.contentDetailData, 180 contentDetail: this.contentDetailData,
177 - onCommentFocus: this.onCommentFocus 181 + onCommentFocus: this.onCommentFocus,
  182 + pageComponentType: this.pageComponentType
178 }) 183 })
179 } 184 }
180 } 185 }
181 - .flexShrink(1)  
182 - 186 + .layoutWeight(1)
  187 + .margin({
  188 + right: this.pageComponentType === 1 ? 16 : 0,
  189 + })
  190 +
183 if (this.showCommentIcon) { 191 if (this.showCommentIcon) {
184 Column() { 192 Column() {
185 if (this.publishCommentModel?.targetId) { 193 if (this.publishCommentModel?.targetId) {
@@ -28,11 +28,11 @@ export struct TopPlayComponent { @@ -28,11 +28,11 @@ export struct TopPlayComponent {
28 28
29 updateData() { 29 updateData() {
30 //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 30 //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
31 - if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl && this.liveDetailsBean.liveInfo.previewUrl.length > 0) { 31 + if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.previewUrl &&
  32 + this.liveDetailsBean.liveInfo.previewUrl.length > 0) {
32 this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl 33 this.imgUrl = this.liveDetailsBean.liveInfo.previewUrl
33 Logger.debug(TAG, 'ok+' + `${this.imgUrl}`) 34 Logger.debug(TAG, 'ok+' + `${this.imgUrl}`)
34 - }  
35 - else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { 35 + } else if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
36 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url 36 this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
37 Logger.debug(TAG, 'ok-' + `${this.imgUrl}`) 37 Logger.debug(TAG, 'ok-' + `${this.imgUrl}`)
38 } 38 }
@@ -81,6 +81,7 @@ export struct TopPlayComponent { @@ -81,6 +81,7 @@ export struct TopPlayComponent {
81 .alignSelf(ItemAlign.Center) 81 .alignSelf(ItemAlign.Center)
82 } 82 }
83 83
84 - aboutToDisappear(): void { 84 + async aboutToDisappear(): Promise<void> {
  85 + await this.playerController?.release()
85 } 86 }
86 } 87 }
@@ -115,6 +115,7 @@ export struct PlayerCommentComponent { @@ -115,6 +115,7 @@ export struct PlayerCommentComponent {
115 // 收藏、分享、点赞是否需要根据字段显隐 115 // 收藏、分享、点赞是否需要根据字段显隐
116 OperRowListView({ 116 OperRowListView({
117 styleType: 3, 117 styleType: 3,
  118 + componentType: 4,
118 operationButtonList: ['comment', 'collect', 'share', 'like'], 119 operationButtonList: ['comment', 'collect', 'share', 'like'],
119 contentDetailData: this.contentDetailData, 120 contentDetailData: this.contentDetailData,
120 publishCommentModel: this.publishCommentModel, 121 publishCommentModel: this.publishCommentModel,
@@ -37,11 +37,10 @@ export struct PlayerComponent { @@ -37,11 +37,10 @@ export struct PlayerComponent {
37 } 37 }
38 } 38 }
39 39
40 - aboutToDisappear(): void {  
41 - 40 + async aboutToDisappear(): Promise<void> {
42 this.playerController?.pause() 41 this.playerController?.pause()
43 this.playerController?.stop() 42 this.playerController?.stop()
44 - this.playerController?.release() 43 + await this.playerController?.release()
45 } 44 }
46 45
47 updateData() { 46 updateData() {
@@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView' @@ -3,20 +3,56 @@ import { PlayerTitleView } from './PlayerTitleView'
3 import { PlayerProgressView } from './PlayerProgressView' 3 import { PlayerProgressView } from './PlayerProgressView'
4 import { PlayerCommentView } from './PlayerCommentView' 4 import { PlayerCommentView } from './PlayerCommentView'
5 import { PlayerTimeSeekView } from './PlayerTimeSeekView' 5 import { PlayerTimeSeekView } from './PlayerTimeSeekView'
  6 +import { OperRowListView } from '../../../../../wdComponent/src/main/ets/components/view/OperRowListView'
  7 +import {
  8 + publishCommentModel
  9 +} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
  10 +import { ContentDetailDTO } from 'wdBean/Index';
  11 +import { WindowModel } from 'wdKit/Index';
6 12
7 @Component 13 @Component
8 export struct PlayerBottomView { 14 export struct PlayerBottomView {
9 private playerController?: WDPlayerController; 15 private playerController?: WDPlayerController;
  16 + @Consume bottomSafeHeight: number
10 @Consume showComment?: boolean 17 @Consume showComment?: boolean
11 @Consume isOpenDetail?: boolean 18 @Consume isOpenDetail?: boolean
12 @Consume isDragging?: boolean 19 @Consume isDragging?: boolean
  20 + @Consume contentDetailData: ContentDetailDTO
  21 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
  22 +
  23 + aboutToAppear(): void {
  24 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  25 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  26 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  27 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  28 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  29 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  30 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
  31 + this.publishCommentModel.commentContent = ''
  32 + }
13 33
14 build() { 34 build() {
15 Column() { 35 Column() {
16 PlayerTitleView() 36 PlayerTitleView()
17 PlayerProgressView({ playerController: this.playerController }) 37 PlayerProgressView({ playerController: this.playerController })
18 if (this.showComment) { 38 if (this.showComment) {
19 - PlayerCommentView() 39 + // PlayerCommentView()
  40 + OperRowListView({
  41 + pageComponentType: 1,
  42 + styleType: 3,
  43 + componentType: 4,
  44 + operationButtonList: ['comment',],
  45 + contentDetailData: this.contentDetailData,
  46 + publishCommentModel: this.publishCommentModel,
  47 + showCommentIcon: false,
  48 + onBack: () => {
  49 + WindowModel.shared.setWindowLayoutFullScreen(false)
  50 + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
  51 + }
  52 + })
  53 + .padding({
  54 + bottom: -this.bottomSafeHeight + 'px'
  55 + })
20 } 56 }
21 } 57 }
22 .alignItems(HorizontalAlign.Start) 58 .alignItems(HorizontalAlign.Start)
@@ -5,6 +5,10 @@ @@ -5,6 +5,10 @@
5 "value": "#FFFFFF" 5 "value": "#FFFFFF"
6 }, 6 },
7 { 7 {
  8 + "name": "color_transparent",
  9 + "value": "#00000000"
  10 + },
  11 + {
8 "name": "play_track_color", 12 "name": "play_track_color",
9 "value": "#1AFFFFFF" 13 "value": "#1AFFFFFF"
10 }, 14 },
@@ -3,6 +3,18 @@ @@ -3,6 +3,18 @@
3 { 3 {
4 "name": "shared_desc", 4 "name": "shared_desc",
5 "value": "description" 5 "value": "description"
  6 + },
  7 + {
  8 + "name": "pull_up_load_text",
  9 + "value": "加载中..."
  10 + },
  11 + {
  12 + "name": "pull_down_refresh_text",
  13 + "value": "下拉刷新"
  14 + },
  15 + {
  16 + "name": "release_refresh_text",
  17 + "value": "松开刷新"
6 } 18 }
7 ] 19 ]
8 } 20 }