zhenghy

修改视频评论

Showing 24 changed files with 154 additions and 8 deletions
  1 +/**
  2 + * 直播页面点赞动画
  3 + */
  4 +
  5 +interface animationItem {
  6 + x: string | number;
  7 + y: string | number;
  8 + opacity: number;
  9 + name: string;
  10 + key: string;
  11 + url: Resource
  12 +}
  13 +
  14 +@Component
  15 +export struct LikeAnimationView {
  16 + @State @Watch('countChange') count: number = 0
  17 + @State imgList: Resource[] =
  18 + [$r('app.media.like_animation_1'), $r('app.media.like_animation_2'), $r('app.media.like_animation_3')]
  19 + @State animationList: animationItem[] = []
  20 +
  21 + countChange() {
  22 + this.animationList.push({
  23 + name: 'xxxx',
  24 + x: 0,
  25 + y: 0,
  26 + opacity: 1,
  27 + key: Math.random() + '',
  28 + url: this.getRandomUrl()
  29 +
  30 + })
  31 + }
  32 +
  33 + getRandomUrl(): Resource {
  34 + if (Math.random() >= 0 && Math.random() >= 0.33) {
  35 + return this.imgList[0]
  36 + } else if (Math.random() >= 0.33 && Math.random() >= 0.66) {
  37 + return this.imgList[1]
  38 + } else {
  39 + return this.imgList[2]
  40 + }
  41 + }
  42 +
  43 + startAnimation() {
  44 +
  45 + }
  46 +
  47 + stopAnimation() {
  48 +
  49 + }
  50 +
  51 + aboutToAppear(): void {
  52 + }
  53 +
  54 + aboutToDisappear(): void {
  55 + }
  56 +
  57 + build() {
  58 + Stack() {
  59 + ForEach(this.animationList, (item: animationItem) => {
  60 + Image(item.url)
  61 + .width(48)
  62 + .height(48)
  63 + }, (item: animationItem) => item.key)
  64 + }
  65 +
  66 + }
  67 +}
  1 +import { ContentDetailDTO } from 'wdBean/Index'
  2 +import {
  3 + publishCommentModel
  4 +} from '../../../../../wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
  5 +import { CommentComponent } from '../../../../../wdComponent/src/main/ets/components/comment/view/CommentComponent'
  6 +
  7 +@Component
  8 +export struct CommentComponentPage {
  9 + scroller: Scroller = new Scroller()
  10 + @Consume contentDetailData: ContentDetailDTO
  11 + @Consume showCommentList: boolean
  12 + @State publishCommentModel: publishCommentModel = new publishCommentModel()
  13 +
  14 + aboutToAppear(): void {
  15 +
  16 + this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
  17 + this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
  18 + this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
  19 + this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
  20 + this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
  21 + this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
  22 + this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
  23 + }
  24 +
  25 + build() {
  26 + Scroll(this.scroller) {
  27 + Stack() {
  28 + CommentComponent({
  29 + publishCommentModel: this.publishCommentModel
  30 + })
  31 + Image($r("app.media.ic_close_black"))
  32 + .width(20)
  33 + .height(20)
  34 + .onClick(() => {
  35 + this.showCommentList = false
  36 + })
  37 + .margin({ top: 10, right: 20 })
  38 + .position({ x: '100%' })
  39 + .markAnchor({ x: '100%' })
  40 +
  41 + }
  42 + }
  43 + .zIndex(1000)
  44 + .backgroundColor(Color.White)
  45 +
  46 + }
  47 +}
1 import { ContentDetailDTO, InteractDataDTO } from 'wdBean'; 1 import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
2 -import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer'; 2 +import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
3 import { ContentDetailRequest } from 'wdDetailPlayApi'; 3 import { ContentDetailRequest } from 'wdDetailPlayApi';
4 import { 4 import {
5 batchLikeAndCollectParams, 5 batchLikeAndCollectParams,
@@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index'; @@ -11,6 +11,7 @@ import { HttpUtils } from 'wdNetwork/Index';
11 import { DateTimeUtils } from 'wdKit/Index'; 11 import { DateTimeUtils } from 'wdKit/Index';
12 import { PlayerBottomView } from '../view/PlayerBottomView'; 12 import { PlayerBottomView } from '../view/PlayerBottomView';
13 import { PlayerRightView } from '../view/PlayerRightView'; 13 import { PlayerRightView } from '../view/PlayerRightView';
  14 +import { CommentComponentPage } from './CommentComponentPage';
14 15
15 const TAG = 'DetailPlayShortVideoPage'; 16 const TAG = 'DetailPlayShortVideoPage';
16 17
@@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage { @@ -32,6 +33,7 @@ export struct DetailPlayShortVideoPage {
32 @Provide followStatus: string = '0' // 关注状态 33 @Provide followStatus: string = '0' // 关注状态
33 @Provide isOpenDetail: boolean = false // 查看详情按钮点击 34 @Provide isOpenDetail: boolean = false // 查看详情按钮点击
34 @Provide isDragging: boolean = false // 拖动时间进度条 35 @Provide isDragging: boolean = false // 拖动时间进度条
  36 + @Provide showCommentList: boolean = false
35 @Consume @Watch('videoStatusChange') switchVideoStatus: boolean 37 @Consume @Watch('videoStatusChange') switchVideoStatus: boolean
36 @Consume @Watch('pageShowChange') pageShow: number 38 @Consume @Watch('pageShowChange') pageShow: number
37 @Consume topSafeHeight: number 39 @Consume topSafeHeight: number
@@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage { @@ -148,6 +150,7 @@ export struct DetailPlayShortVideoPage {
148 this.progressVal = Math.floor(position * 100 / duration); 150 this.progressVal = Math.floor(position * 100 / duration);
149 } 151 }
150 this.queryNewsInfoOfUser() 152 this.queryNewsInfoOfUser()
  153 +
151 } 154 }
152 155
153 async aboutToDisappear(): Promise<void> { 156 async aboutToDisappear(): Promise<void> {
@@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage { @@ -163,10 +166,14 @@ export struct DetailPlayShortVideoPage {
163 PlayerBottomView({ 166 PlayerBottomView({
164 playerController: this.playerController 167 playerController: this.playerController
165 }) 168 })
  169 +
166 PlayerRightView({ 170 PlayerRightView({
167 playerController: this.playerController 171 playerController: this.playerController
168 }) 172 })
169 173
  174 + CommentComponentPage({}).visibility(this.showCommentList ? Visibility.Visible : Visibility.None)
  175 + .position({ y: '100%' })
  176 + .markAnchor({ y: '100%' })
170 } 177 }
171 .height('100%') 178 .height('100%')
172 .width('100%') 179 .width('100%')
@@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage { @@ -192,6 +199,7 @@ export struct DetailPlayShortVideoPage {
192 199
193 @Builder 200 @Builder
194 playerViewBuilder() { 201 playerViewBuilder() {
  202 +
195 WDPlayerRenderView({ 203 WDPlayerRenderView({
196 playerController: this.playerController, 204 playerController: this.playerController,
197 onLoad: async () => { 205 onLoad: async () => {
@@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage { @@ -205,10 +213,13 @@ export struct DetailPlayShortVideoPage {
205 .padding({ 213 .padding({
206 bottom: this.videoLandScape === 1 ? 115 : 0, 214 bottom: this.videoLandScape === 1 ? 115 : 0,
207 }) 215 })
  216 + .layoutWeight(1)
208 .align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center) 217 .align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
209 .onClick(() => { 218 .onClick(() => {
210 console.error('WDPlayerRenderView=== onClick') 219 console.error('WDPlayerRenderView=== onClick')
211 this.playerController?.switchPlayOrPause(); 220 this.playerController?.switchPlayOrPause();
212 }) 221 })
  222 +
  223 +
213 } 224 }
214 } 225 }
@@ -43,7 +43,7 @@ export struct DetailDialog { @@ -43,7 +43,7 @@ export struct DetailDialog {
43 .height(200) 43 .height(200)
44 44
45 Row() { 45 Row() {
46 - Image($r('app.media.ic_close')) 46 + Image($r("app.media.ic_close_white"))
47 .height(24).margin({ top: 20 }).onClick(() => { 47 .height(24).margin({ top: 20 }).onClick(() => {
48 this.controller.close() 48 this.controller.close()
49 if (this.isOpenDetail) { 49 if (this.isOpenDetail) {
@@ -13,7 +13,7 @@ import { WindowModel } from 'wdKit/Index'; @@ -13,7 +13,7 @@ import { WindowModel } from 'wdKit/Index';
13 @Component 13 @Component
14 export struct PlayerBottomView { 14 export struct PlayerBottomView {
15 private playerController?: WDPlayerController; 15 private playerController?: WDPlayerController;
16 - @Consume bottomSafeHeight: number 16 + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
17 @Consume showComment?: boolean 17 @Consume showComment?: boolean
18 @Consume isOpenDetail?: boolean 18 @Consume isOpenDetail?: boolean
19 @Consume isDragging?: boolean 19 @Consume isDragging?: boolean
@@ -32,6 +32,7 @@ export struct PlayerRightView { @@ -32,6 +32,7 @@ export struct PlayerRightView {
32 @Consume isOpenDetail: boolean 32 @Consume isOpenDetail: boolean
33 @Consume isDragging: boolean 33 @Consume isDragging: boolean
34 @Consume showComment?: boolean 34 @Consume showComment?: boolean
  35 + @Consume showCommentList: boolean
35 @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 36 @State likesStyle: number = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
36 37
37 aboutToAppear() { 38 aboutToAppear() {
@@ -343,7 +344,8 @@ export struct PlayerRightView { @@ -343,7 +344,8 @@ export struct PlayerRightView {
343 } 344 }
344 .margin({ bottom: 20 }) 345 .margin({ bottom: 20 })
345 .onClick((event: ClickEvent) => { 346 .onClick((event: ClickEvent) => {
346 - ToastUtils.showToast('评论为公共方法,待开发', 1000); 347 + // ToastUtils.showToast('评论为公共方法,待开发', 1000);
  348 + this.showCommentList = true
347 }) 349 })
348 } 350 }
349 351
@@ -9,6 +9,10 @@ @@ -9,6 +9,10 @@
9 "value": "#00000000" 9 "value": "#00000000"
10 }, 10 },
11 { 11 {
  12 + "name": "color_222222",
  13 + "value": "#222222"
  14 + },
  15 + {
12 "name": "play_track_color", 16 "name": "play_track_color",
13 "value": "#1AFFFFFF" 17 "value": "#1AFFFFFF"
14 }, 18 },
@@ -33,6 +37,18 @@ @@ -33,6 +37,18 @@
33 "value": "#4DFFFFFF" 37 "value": "#4DFFFFFF"
34 }, 38 },
35 { 39 {
  40 + "name": "color_666666",
  41 + "value": "#666666"
  42 + },
  43 + {
  44 + "name": "color_B0B0B0",
  45 + "value": "#B0B0B0"
  46 + },
  47 + {
  48 + "name": "color_EDEDED",
  49 + "value": "#EDEDED"
  50 + },
  51 + {
36 "name": "divider_color", 52 "name": "divider_color",
37 "value": "#D3D3D3" 53 "value": "#D3D3D3"
38 }, 54 },
@@ -5,6 +5,10 @@ @@ -5,6 +5,10 @@
5 "value": "description" 5 "value": "description"
6 }, 6 },
7 { 7 {
  8 + "name": "footer_text",
  9 + "value": "已显示全部内容"
  10 + },
  11 + {
8 "name": "pull_up_load_text", 12 "name": "pull_up_load_text",
9 "value": "加载中..." 13 "value": "加载中..."
10 }, 14 },
@@ -94,10 +94,9 @@ export struct WDPlayerRenderView { @@ -94,10 +94,9 @@ export struct WDPlayerRenderView {
94 .renderFit(RenderFit.RESIZE_COVER) 94 .renderFit(RenderFit.RESIZE_COVER)
95 } 95 }
96 96
97 - // .onAreaChange(() => {  
98 - // this.updateLayout()  
99 - // })  
100 - 97 + .onAreaChange(() => {
  98 + this.updateLayout()
  99 + })
101 .backgroundColor("#000000") 100 .backgroundColor("#000000")
102 101
103 // .height('100%') 102 // .height('100%')