Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
2 changed files
with
89 additions
and
39 deletions
| @@ -29,7 +29,9 @@ export struct WdWebLocalComponent { | @@ -29,7 +29,9 @@ export struct WdWebLocalComponent { | ||
| 29 | @State sliderStartTime: string = ''; | 29 | @State sliderStartTime: string = ''; |
| 30 | @State currentTime: number = 0; | 30 | @State currentTime: number = 0; |
| 31 | @State durationTime: number = 0; | 31 | @State durationTime: number = 0; |
| 32 | + @State progressOpacity: number = 1 | ||
| 32 | @State durationStringTime: string = ''; | 33 | @State durationStringTime: string = ''; |
| 34 | + private progressTimerNumber: number = 0 | ||
| 33 | @State isPause: boolean = true; | 35 | @State isPause: boolean = true; |
| 34 | controller: VideoController = new VideoController() | 36 | controller: VideoController = new VideoController() |
| 35 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; | 37 | @StorageProp('currentBreakpoint') @Watch("currentChanged")currentBreakpoint: string = 'sm'; |
| @@ -172,7 +174,7 @@ export struct WdWebLocalComponent { | @@ -172,7 +174,7 @@ export struct WdWebLocalComponent { | ||
| 172 | this.positionLeft = Number(data?.data?.positionLeft) || 0 | 174 | this.positionLeft = Number(data?.data?.positionLeft) || 0 |
| 173 | this.positionTop = Number(data?.data?.positionTop) || 0 | 175 | this.positionTop = Number(data?.data?.positionTop) || 0 |
| 174 | this.videoLandscape = data?.data?.videoLandscape || '1' | 176 | this.videoLandscape = data?.data?.videoLandscape || '1' |
| 175 | - this.controller.start() | 177 | + this.startPlay() |
| 176 | } | 178 | } |
| 177 | } | 179 | } |
| 178 | /** | 180 | /** |
| @@ -206,6 +208,26 @@ export struct WdWebLocalComponent { | @@ -206,6 +208,26 @@ export struct WdWebLocalComponent { | ||
| 206 | } | 208 | } |
| 207 | } | 209 | } |
| 208 | 210 | ||
| 211 | + startPlay() { | ||
| 212 | + this.cancelProgressTimer() | ||
| 213 | + this.controller.start() | ||
| 214 | + this.startProgressTimer() | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + startProgressTimer() { | ||
| 218 | + this.progressTimerNumber = setTimeout(() => { | ||
| 219 | + animateTo({duration: 1000}, () => { | ||
| 220 | + this.progressOpacity = 0 | ||
| 221 | + }) | ||
| 222 | + }, 3000) | ||
| 223 | + } | ||
| 224 | + cancelProgressTimer() { | ||
| 225 | + if (this.progressTimerNumber > 0) { | ||
| 226 | + clearTimeout(this.progressTimerNumber) | ||
| 227 | + this.progressTimerNumber = 0 | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | + | ||
| 209 | @Builder | 231 | @Builder |
| 210 | videoComp(){ | 232 | videoComp(){ |
| 211 | Video({ | 233 | Video({ |
| @@ -221,6 +243,7 @@ export struct WdWebLocalComponent { | @@ -221,6 +243,7 @@ export struct WdWebLocalComponent { | ||
| 221 | .objectFit(ImageFit.Contain) | 243 | .objectFit(ImageFit.Contain) |
| 222 | .onFinish(()=>{ | 244 | .onFinish(()=>{ |
| 223 | this.isEndPlay = true | 245 | this.isEndPlay = true |
| 246 | + this.currentTime = 0 | ||
| 224 | }) | 247 | }) |
| 225 | .onStart(() => { | 248 | .onStart(() => { |
| 226 | this.isPause = false | 249 | this.isPause = false |
| @@ -248,13 +271,23 @@ export struct WdWebLocalComponent { | @@ -248,13 +271,23 @@ export struct WdWebLocalComponent { | ||
| 248 | WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT) | 271 | WindowModel.shared.setPreferredOrientation(window.Orientation.PORTRAIT) |
| 249 | } | 272 | } |
| 250 | }) | 273 | }) |
| 274 | + .onClick(() => { | ||
| 275 | + animateTo({duration: 1000}, () => { | ||
| 276 | + if (this.progressOpacity <= 0) { | ||
| 277 | + this.progressOpacity = 1 | ||
| 278 | + } else { | ||
| 279 | + this.progressOpacity = 0 | ||
| 280 | + } | ||
| 281 | + }) | ||
| 282 | + }) | ||
| 251 | 283 | ||
| 252 | if (this.isEndPlay){ | 284 | if (this.isEndPlay){ |
| 253 | Column(){ | 285 | Column(){ |
| 254 | Image($r('app.media.icon_replay')).width(40).height(40) | 286 | Image($r('app.media.icon_replay')).width(40).height(40) |
| 255 | .onClick(() => { | 287 | .onClick(() => { |
| 256 | this.isEndPlay = false | 288 | this.isEndPlay = false |
| 257 | - this.controller.start() | 289 | + this.progressOpacity = 1 |
| 290 | + this.startPlay() | ||
| 258 | }) | 291 | }) |
| 259 | 292 | ||
| 260 | Text('重播').fontColor(Color.White).fontSize(14) | 293 | Text('重播').fontColor(Color.White).fontSize(14) |
| @@ -271,9 +304,10 @@ export struct WdWebLocalComponent { | @@ -271,9 +304,10 @@ export struct WdWebLocalComponent { | ||
| 271 | .height(24) | 304 | .height(24) |
| 272 | .onClick(() => { | 305 | .onClick(() => { |
| 273 | if (this.isPause) { | 306 | if (this.isPause) { |
| 274 | - this.controller.start() | 307 | + this.startPlay() |
| 275 | } else { | 308 | } else { |
| 276 | this.controller.pause() | 309 | this.controller.pause() |
| 310 | + this.cancelProgressTimer() | ||
| 277 | } | 311 | } |
| 278 | }) | 312 | }) |
| 279 | Row() { | 313 | Row() { |
| @@ -298,6 +332,13 @@ export struct WdWebLocalComponent { | @@ -298,6 +332,13 @@ export struct WdWebLocalComponent { | ||
| 298 | .blockSize({ width: 18, height: 12 }) | 332 | .blockSize({ width: 18, height: 12 }) |
| 299 | .onChange((value: number, mode: SliderChangeMode) => { | 333 | .onChange((value: number, mode: SliderChangeMode) => { |
| 300 | this.controller.setCurrentTime(value); | 334 | this.controller.setCurrentTime(value); |
| 335 | + if (mode == SliderChangeMode.End) { | ||
| 336 | + if (this.isPause) { | ||
| 337 | + this.startPlay() | ||
| 338 | + } else { | ||
| 339 | + this.startProgressTimer() | ||
| 340 | + } | ||
| 341 | + } | ||
| 301 | }) | 342 | }) |
| 302 | Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)) | 343 | Text(DateTimeUtils.getFormattedDuration(this.durationTime * 1000)) |
| 303 | .fontSize(12) | 344 | .fontSize(12) |
| @@ -313,7 +354,11 @@ export struct WdWebLocalComponent { | @@ -313,7 +354,11 @@ export struct WdWebLocalComponent { | ||
| 313 | // this.controller.requestFullscreen(true) | 354 | // this.controller.requestFullscreen(true) |
| 314 | // }) | 355 | // }) |
| 315 | } | 356 | } |
| 316 | - .opacity(0.8) | 357 | + .opacity(this.progressOpacity) |
| 358 | + .linearGradient({ | ||
| 359 | + direction: GradientDirection.Top, // 渐变方向 | ||
| 360 | + colors: [[0x20000000, 0.0], [Color.Transparent, 1.0]] // [0x80000000, 0.5], | ||
| 361 | + }) | ||
| 317 | .width("100%") | 362 | .width("100%") |
| 318 | .justifyContent(FlexAlign.SpaceAround) | 363 | .justifyContent(FlexAlign.SpaceAround) |
| 319 | } | 364 | } |
| @@ -578,48 +578,53 @@ struct footerExpandedView { | @@ -578,48 +578,53 @@ struct footerExpandedView { | ||
| 578 | 578 | ||
| 579 | build() { | 579 | build() { |
| 580 | Row() { | 580 | Row() { |
| 581 | - if (this.item.expanded) { | ||
| 582 | - Row() { | ||
| 583 | - Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1) | ||
| 584 | - if (this.item.childsHasMore) { | 581 | + Row() { |
| 582 | + if (this.item.expanded) { | ||
| 583 | + Row() { | ||
| 584 | + Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1) | ||
| 585 | + if (this.item.childsHasMore) { | ||
| 586 | + Row() { | ||
| 587 | + Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14) | ||
| 588 | + Image($r('app.media.comment_unfold')).width(12).height(12) | ||
| 589 | + }.margin({ left: 6 }) | ||
| 590 | + .onClick(() => { | ||
| 591 | + if (this.item.isLoading) { | ||
| 592 | + return | ||
| 593 | + } | ||
| 594 | + this.item.isLoading = true | ||
| 595 | + fetchChildContentCommentList(this.contentId, this.contentType, this.item) | ||
| 596 | + }) | ||
| 597 | + } | ||
| 585 | Row() { | 598 | Row() { |
| 586 | - Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14) | ||
| 587 | - Image($r('app.media.comment_unfold')).width(12).height(12) | 599 | + Text('收起').fontColor($r('app.color.color_222222')).fontSize(14) |
| 600 | + Image($r('app.media.comment_pickUp')).width(12).height(12) | ||
| 588 | }.margin({ left: 6 }) | 601 | }.margin({ left: 6 }) |
| 589 | .onClick(() => { | 602 | .onClick(() => { |
| 590 | - if (this.item.isLoading) { | ||
| 591 | - return | ||
| 592 | - } | ||
| 593 | - this.item.isLoading = true | ||
| 594 | - fetchChildContentCommentList(this.contentId, this.contentType, this.item) | 603 | + this.item.pageNum = 1 |
| 604 | + this.item.expanded = false | ||
| 605 | + this.item.childComments = [] | ||
| 606 | + this.item.childCommentsLazyDataSource.clear() | ||
| 595 | }) | 607 | }) |
| 596 | - } | 608 | + }.margin({ left: 53 }) |
| 609 | + } else { | ||
| 597 | Row() { | 610 | Row() { |
| 598 | - Text('收起').fontColor($r('app.color.color_222222')).fontSize(14) | ||
| 599 | - Image($r('app.media.comment_pickUp')).width(12).height(12) | ||
| 600 | - }.margin({ left: 6 }) | 611 | + Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1) |
| 612 | + Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 }) | ||
| 613 | + Image($r('app.media.comment_unfold')).width(12).height(12) | ||
| 614 | + }.margin({ left: 53 }) | ||
| 601 | .onClick(() => { | 615 | .onClick(() => { |
| 602 | - this.item.pageNum = 1 | ||
| 603 | - this.item.expanded = false | ||
| 604 | - this.item.childComments = [] | ||
| 605 | - this.item.childCommentsLazyDataSource.clear() | 616 | + if (this.item.isLoading) { |
| 617 | + return | ||
| 618 | + } | ||
| 619 | + this.item.isLoading = true | ||
| 620 | + fetchChildContentCommentList(this.contentId, this.contentType, this.item) | ||
| 606 | }) | 621 | }) |
| 607 | - }.margin({ left: 53 }) | ||
| 608 | - } else { | ||
| 609 | - Row() { | ||
| 610 | - Text().backgroundColor($r('app.color.color_EDEDED')).width(24).height(1) | ||
| 611 | - Text('查看更多回复').fontColor($r('app.color.color_222222')).fontSize(14).margin({ left: 6 }) | ||
| 612 | - Image($r('app.media.comment_unfold')).width(12).height(12) | ||
| 613 | - }.margin({ left: 53 }) | ||
| 614 | - .onClick(() => { | ||
| 615 | - if (this.item.isLoading) { | ||
| 616 | - return | ||
| 617 | - } | ||
| 618 | - this.item.isLoading = true | ||
| 619 | - fetchChildContentCommentList(this.contentId, this.contentType, this.item) | ||
| 620 | - }) | ||
| 621 | - } | ||
| 622 | - }.height(30) | 622 | + } |
| 623 | + }.height(20) | ||
| 624 | + // .backgroundColor(Color.Green) | ||
| 625 | + }.height(24) | ||
| 626 | + .alignItems(VerticalAlign.Top) | ||
| 627 | + // .backgroundColor(Color.Gray) | ||
| 623 | } | 628 | } |
| 624 | } | 629 | } |
| 625 | 630 |
-
Please register or login to post a comment