Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: 18497图集详情页,图片上滑或下滑,返回上一页面,页面退出效果明显,参考视频中安卓退出效果 ref |> 处理音频播控中心暂停后再播放问题 ref |> 调整评论弹框上面点赞需要登录问题 fix: 轮播卡修复点右边的稿件,跳到左边稿件的详情了 未授权不提示失败 滑动后滑块不消失
Showing
8 changed files
with
65 additions
and
20 deletions
| @@ -53,7 +53,10 @@ export struct ImageDownloadComponent { | @@ -53,7 +53,10 @@ export struct ImageDownloadComponent { | ||
| 53 | } catch (error) { | 53 | } catch (error) { |
| 54 | const err: BusinessError = error as BusinessError; | 54 | const err: BusinessError = error as BusinessError; |
| 55 | //console.info(`Failed to save photo. Code is ${err.code}, message is ${err.message}`); | 55 | //console.info(`Failed to save photo. Code is ${err.code}, message is ${err.message}`); |
| 56 | - promptAction.showToast({ message: '保存图片失败!' }); | 56 | + if (this.isGranted) { |
| 57 | + promptAction.showToast({ message: '保存图片失败!' }); | ||
| 58 | + } | ||
| 59 | + | ||
| 57 | } | 60 | } |
| 58 | } | 61 | } |
| 59 | }) | 62 | }) |
| @@ -161,11 +164,12 @@ export struct ImageDownloadComponent { | @@ -161,11 +164,12 @@ export struct ImageDownloadComponent { | ||
| 161 | * @returns | 164 | * @returns |
| 162 | */ | 165 | */ |
| 163 | async saveImage(buffer: ArrayBuffer | string): Promise<void> { | 166 | async saveImage(buffer: ArrayBuffer | string): Promise<void> { |
| 164 | - //console.info(`cj2024 saveImage buffer ${buffer}`) | 167 | + //console.info(`cj2024 saveImage buffer ${buffer} isGranted = ${this.isGranted}`) |
| 165 | if (!this.isGranted) { | 168 | if (!this.isGranted) { |
| 166 | //跳转权限设置 | 169 | //跳转权限设置 |
| 167 | // const permissionUtil = new PermissionUtil(); | 170 | // const permissionUtil = new PermissionUtil(); |
| 168 | PermissionUtil.reqPermissionsFromUser(['ohos.permission.READ_MEDIA'], this).then((res) => { | 171 | PermissionUtil.reqPermissionsFromUser(['ohos.permission.READ_MEDIA'], this).then((res) => { |
| 172 | + //console.info(`cj2024 saveImage res ${res}`) | ||
| 169 | this.isGranted = res; | 173 | this.isGranted = res; |
| 170 | }); | 174 | }); |
| 171 | } else { | 175 | } else { |
| @@ -192,7 +196,10 @@ export struct ImageDownloadComponent { | @@ -192,7 +196,10 @@ export struct ImageDownloadComponent { | ||
| 192 | await asset.close(fd); | 196 | await asset.close(fd); |
| 193 | promptAction.showToast({ message: '已保存至相册!' }); | 197 | promptAction.showToast({ message: '已保存至相册!' }); |
| 194 | } else { | 198 | } else { |
| 195 | - promptAction.showToast({ message: '保存图片失败!' }); | 199 | + if (this.isGranted) { |
| 200 | + promptAction.showToast({ message: '保存图片失败!' }); | ||
| 201 | + } | ||
| 202 | + | ||
| 196 | throw new Error('Failed to create asset'); | 203 | throw new Error('Failed to create asset'); |
| 197 | } | 204 | } |
| 198 | } | 205 | } |
| @@ -48,6 +48,7 @@ export struct CommentComponent { | @@ -48,6 +48,7 @@ export struct CommentComponent { | ||
| 48 | 48 | ||
| 49 | // 是否在弹框中 | 49 | // 是否在弹框中 |
| 50 | @Provide inDialog: boolean = false | 50 | @Provide inDialog: boolean = false |
| 51 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 51 | 52 | ||
| 52 | // 在自定义组件即将析构销毁时将dialogControlle置空 | 53 | // 在自定义组件即将析构销毁时将dialogControlle置空 |
| 53 | aboutToDisappear() { | 54 | aboutToDisappear() { |
| @@ -158,7 +159,8 @@ export struct CommentComponent { | @@ -158,7 +159,8 @@ export struct CommentComponent { | ||
| 158 | commentHeaderView({ | 159 | commentHeaderView({ |
| 159 | item: item, | 160 | item: item, |
| 160 | dialogController: this.dialogController, | 161 | dialogController: this.dialogController, |
| 161 | - publishCommentModel: this.publishCommentModel | 162 | + publishCommentModel: this.publishCommentModel, |
| 163 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 162 | }) | 164 | }) |
| 163 | } | 165 | } |
| 164 | 166 | ||
| @@ -194,7 +196,8 @@ export struct CommentComponent { | @@ -194,7 +196,8 @@ export struct CommentComponent { | ||
| 194 | ChildCommentItem({ | 196 | ChildCommentItem({ |
| 195 | item: childItem, | 197 | item: childItem, |
| 196 | dialogController: this.dialogController, | 198 | dialogController: this.dialogController, |
| 197 | - publishCommentModel: this.publishCommentModel | 199 | + publishCommentModel: this.publishCommentModel, |
| 200 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 198 | }); | 201 | }); |
| 199 | } | 202 | } |
| 200 | .onClick(() => { | 203 | .onClick(() => { |
| @@ -209,7 +212,8 @@ export struct CommentComponent { | @@ -209,7 +212,8 @@ export struct CommentComponent { | ||
| 209 | ChildCommentItem({ | 212 | ChildCommentItem({ |
| 210 | item: childItem, | 213 | item: childItem, |
| 211 | dialogController: this.dialogController, | 214 | dialogController: this.dialogController, |
| 212 | - publishCommentModel: this.publishCommentModel | 215 | + publishCommentModel: this.publishCommentModel, |
| 216 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 213 | }); | 217 | }); |
| 214 | } | 218 | } |
| 215 | .onClick(() => { | 219 | .onClick(() => { |
| @@ -319,6 +323,7 @@ struct ChildCommentItem { | @@ -319,6 +323,7 @@ struct ChildCommentItem { | ||
| 319 | @Consume contentDetailData: ContentDetailDTO | 323 | @Consume contentDetailData: ContentDetailDTO |
| 320 | 324 | ||
| 321 | @Consume inDialog: boolean | 325 | @Consume inDialog: boolean |
| 326 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 322 | 327 | ||
| 323 | build() { | 328 | build() { |
| 324 | Column() { | 329 | Column() { |
| @@ -388,7 +393,8 @@ struct ChildCommentItem { | @@ -388,7 +393,8 @@ struct ChildCommentItem { | ||
| 388 | commentFooterView({ | 393 | commentFooterView({ |
| 389 | item: this.item, | 394 | item: this.item, |
| 390 | dialogController: this.dialogController, | 395 | dialogController: this.dialogController, |
| 391 | - publishCommentModel: this.publishCommentModel | 396 | + publishCommentModel: this.publishCommentModel, |
| 397 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 392 | }).margin({ left: 95, right: 16 }) | 398 | }).margin({ left: 95, right: 16 }) |
| 393 | }.alignItems(HorizontalAlign.Start) | 399 | }.alignItems(HorizontalAlign.Start) |
| 394 | .width('100%') | 400 | .width('100%') |
| @@ -430,7 +436,7 @@ struct ChildCommentItem { | @@ -430,7 +436,7 @@ struct ChildCommentItem { | ||
| 430 | 436 | ||
| 431 | commentViewModel.jumpToAccountPage(this.item, () => { | 437 | commentViewModel.jumpToAccountPage(this.item, () => { |
| 432 | if (this.inDialog) { | 438 | if (this.inDialog) { |
| 433 | - PublicDialogManager.shareInstance().closeLastDialog() | 439 | + if (this.dialogBeforeJumpOtherPageAction) { this.dialogBeforeJumpOtherPageAction() } |
| 434 | } | 440 | } |
| 435 | }) | 441 | }) |
| 436 | }) | 442 | }) |
| @@ -541,6 +547,7 @@ struct commentHeaderView { | @@ -541,6 +547,7 @@ struct commentHeaderView { | ||
| 541 | @ObjectLink item: commentItemModel | 547 | @ObjectLink item: commentItemModel |
| 542 | 548 | ||
| 543 | @Consume inDialog: boolean | 549 | @Consume inDialog: boolean |
| 550 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 544 | 551 | ||
| 545 | build() { | 552 | build() { |
| 546 | Column() { | 553 | Column() { |
| @@ -598,7 +605,8 @@ struct commentHeaderView { | @@ -598,7 +605,8 @@ struct commentHeaderView { | ||
| 598 | commentFooterView({ | 605 | commentFooterView({ |
| 599 | item: this.item, | 606 | item: this.item, |
| 600 | dialogController: this.dialogController, | 607 | dialogController: this.dialogController, |
| 601 | - publishCommentModel: this.publishCommentModel | 608 | + publishCommentModel: this.publishCommentModel, |
| 609 | + dialogBeforeJumpOtherPageAction: this.dialogBeforeJumpOtherPageAction | ||
| 602 | }).margin({ left: 59, right: 16 }) | 610 | }).margin({ left: 59, right: 16 }) |
| 603 | }.alignItems(HorizontalAlign.Start) | 611 | }.alignItems(HorizontalAlign.Start) |
| 604 | .padding({bottom: 8}) | 612 | .padding({bottom: 8}) |
| @@ -640,7 +648,7 @@ struct commentHeaderView { | @@ -640,7 +648,7 @@ struct commentHeaderView { | ||
| 640 | 648 | ||
| 641 | commentViewModel.jumpToAccountPage(this.item, () => { | 649 | commentViewModel.jumpToAccountPage(this.item, () => { |
| 642 | if (this.inDialog) { | 650 | if (this.inDialog) { |
| 643 | - PublicDialogManager.shareInstance().closeLastDialog() | 651 | + if (this.dialogBeforeJumpOtherPageAction) { this.dialogBeforeJumpOtherPageAction() } |
| 644 | } | 652 | } |
| 645 | }) | 653 | }) |
| 646 | }) | 654 | }) |
| @@ -676,6 +684,7 @@ struct commentFooterView { | @@ -676,6 +684,7 @@ struct commentFooterView { | ||
| 676 | @ObjectLink item: commentItemModel | 684 | @ObjectLink item: commentItemModel |
| 677 | 685 | ||
| 678 | @Consume inDialog: boolean | 686 | @Consume inDialog: boolean |
| 687 | + private dialogBeforeJumpOtherPageAction: () => void = () => {} | ||
| 679 | 688 | ||
| 680 | build() { | 689 | build() { |
| 681 | Row() { | 690 | Row() { |
| @@ -748,7 +757,7 @@ struct commentFooterView { | @@ -748,7 +757,7 @@ struct commentFooterView { | ||
| 748 | const user_id = HttpUtils.getUserId() | 757 | const user_id = HttpUtils.getUserId() |
| 749 | if (!user_id) { | 758 | if (!user_id) { |
| 750 | if (this.inDialog) { | 759 | if (this.inDialog) { |
| 751 | - PublicDialogManager.shareInstance().closeLastDialog() | 760 | + if (this.dialogBeforeJumpOtherPageAction) { this.dialogBeforeJumpOtherPageAction() } |
| 752 | } | 761 | } |
| 753 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 762 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 754 | return | 763 | return |
| @@ -117,7 +117,12 @@ struct CommentListDialog { | @@ -117,7 +117,12 @@ struct CommentListDialog { | ||
| 117 | publishCommentModel: this.publishCommentModel, | 117 | publishCommentModel: this.publishCommentModel, |
| 118 | fixedHeightMode: true, | 118 | fixedHeightMode: true, |
| 119 | inDialog: true, | 119 | inDialog: true, |
| 120 | - showTitleComponent: false | 120 | + showTitleComponent: false, |
| 121 | + dialogBeforeJumpOtherPageAction: () => { | ||
| 122 | + if (this.onClose) { | ||
| 123 | + this.onClose() | ||
| 124 | + } | ||
| 125 | + } | ||
| 121 | }).layoutWeight(1) | 126 | }).layoutWeight(1) |
| 122 | 127 | ||
| 123 | OperRowListView({ | 128 | OperRowListView({ |
| @@ -93,6 +93,11 @@ export struct ZhCarouselLayout01 { | @@ -93,6 +93,11 @@ export struct ZhCarouselLayout01 { | ||
| 93 | item: item, | 93 | item: item, |
| 94 | length: this.compDTO.operDataList.length | 94 | length: this.compDTO.operDataList.length |
| 95 | }) | 95 | }) |
| 96 | + .onClick((event: ClickEvent) => { | ||
| 97 | + InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) | ||
| 98 | + Logger.info(TAG, `ZhCarouselLayout01 onClick event index: ${index}`) | ||
| 99 | + ProcessUtils.processPage(item) | ||
| 100 | + }) | ||
| 96 | }) | 101 | }) |
| 97 | } | 102 | } |
| 98 | .borderRadius($r('app.float.image_border_radius')) | 103 | .borderRadius($r('app.float.image_border_radius')) |
| @@ -162,11 +167,6 @@ export struct ZhCarouselLayout01 { | @@ -162,11 +167,6 @@ export struct ZhCarouselLayout01 { | ||
| 162 | }) | 167 | }) |
| 163 | .backgroundColor(0xffffff) | 168 | .backgroundColor(0xffffff) |
| 164 | .width(CommonConstants.FULL_WIDTH) | 169 | .width(CommonConstants.FULL_WIDTH) |
| 165 | - .onClick((event: ClickEvent) => { | ||
| 166 | - InfomationCardClick.track(this.compDTO, this.compDTO.operDataList[this.swiperIndex], this.pageId, this.pageName) | ||
| 167 | - Logger.info(TAG, `ZhCarouselLayout01 onClick event index: ${this.swiperIndex}`); | ||
| 168 | - ProcessUtils.processPage(this.compDTO.operDataList[this.swiperIndex]) | ||
| 169 | - }) | ||
| 170 | } else { | 170 | } else { |
| 171 | EmptyComponent({ emptyHeight: 200 }) | 171 | EmptyComponent({ emptyHeight: 200 }) |
| 172 | } | 172 | } |
| @@ -24,6 +24,13 @@ export struct MultiPictureListPage { | @@ -24,6 +24,13 @@ export struct MultiPictureListPage { | ||
| 24 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 24 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 25 | // @Provide bgc: Color = Color.White; | 25 | // @Provide bgc: Color = Color.White; |
| 26 | @Provide duration: number = 0 | 26 | @Provide duration: number = 0 |
| 27 | + @State noAnimation: boolean = true | ||
| 28 | + | ||
| 29 | + pageTransition() { | ||
| 30 | + // PageTransitionEnter({ duration: this.noAnimation ? 0 : 300 }) | ||
| 31 | + PageTransitionExit({ duration: !this.noAnimation ? 0 : 300 }) | ||
| 32 | + } | ||
| 33 | + | ||
| 27 | 34 | ||
| 28 | aboutToAppear(): void { | 35 | aboutToAppear(): void { |
| 29 | //获取宽高尺寸 | 36 | //获取宽高尺寸 |
| @@ -65,6 +72,7 @@ export struct MultiPictureListPage { | @@ -65,6 +72,7 @@ export struct MultiPictureListPage { | ||
| 65 | }) | 72 | }) |
| 66 | .onClick(() => { | 73 | .onClick(() => { |
| 67 | this.onBack(); | 74 | this.onBack(); |
| 75 | + this.noAnimation = false | ||
| 68 | router.back(); | 76 | router.back(); |
| 69 | }) | 77 | }) |
| 70 | .id("backImg") | 78 | .id("backImg") |
| @@ -328,9 +328,10 @@ export struct PlayerFullScreenView { | @@ -328,9 +328,10 @@ export struct PlayerFullScreenView { | ||
| 328 | if (this.showOperator == false) { | 328 | if (this.showOperator == false) { |
| 329 | this.restartTimer(); | 329 | this.restartTimer(); |
| 330 | } else { | 330 | } else { |
| 331 | - if (this.isTouched) { | 331 | + // if (this.isTouched) { |
| 332 | this.showOperator = false | 332 | this.showOperator = false |
| 333 | - } | 333 | + // } |
| 334 | + // this.restartTimer(); | ||
| 334 | } | 335 | } |
| 335 | } | 336 | } |
| 336 | } | 337 | } |
| @@ -224,7 +224,7 @@ export class BackgroundAudioController { | @@ -224,7 +224,7 @@ export class BackgroundAudioController { | ||
| 224 | listenPlayEvents() { | 224 | listenPlayEvents() { |
| 225 | this.lastSession?.on('play', () => { | 225 | this.lastSession?.on('play', () => { |
| 226 | Logger.debug(TAG, `on play `); | 226 | Logger.debug(TAG, `on play `); |
| 227 | - this.avplayerController?.play() | 227 | + this.avplayerController?.resume() |
| 228 | this.hasSetupProgress = false | 228 | this.hasSetupProgress = false |
| 229 | }); | 229 | }); |
| 230 | this.lastSession?.on('pause', () => { | 230 | this.lastSession?.on('pause', () => { |
| @@ -249,6 +249,21 @@ export class WDPlayerController { | @@ -249,6 +249,21 @@ export class WDPlayerController { | ||
| 249 | this.avPlayer?.pause(); | 249 | this.avPlayer?.pause(); |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | + async resume() { | ||
| 253 | + if (this.status == PlayerConstants.STATUS_PAUSE) { | ||
| 254 | + Logger.debug(TAG, "start resume") | ||
| 255 | + this.avPlayer?.play(); | ||
| 256 | + return | ||
| 257 | + } | ||
| 258 | + if (this.status == PlayerConstants.STATUS_COMPLETION) { | ||
| 259 | + Logger.debug(TAG, "start resume") | ||
| 260 | + this.avPlayer?.seek(0); | ||
| 261 | + this.avPlayer?.play(); | ||
| 262 | + return | ||
| 263 | + } | ||
| 264 | + this.play() | ||
| 265 | + } | ||
| 266 | + | ||
| 252 | async play() { | 267 | async play() { |
| 253 | // if (this.avPlayer == null) { | 268 | // if (this.avPlayer == null) { |
| 254 | // await this.initPromise; | 269 | // await this.initPromise; |
-
Please register or login to post a comment