Showing
2 changed files
with
39 additions
and
5 deletions
| @@ -39,6 +39,7 @@ export struct ImageAndTextPageComponent { | @@ -39,6 +39,7 @@ export struct ImageAndTextPageComponent { | ||
| 39 | @State isPageEnd: boolean = false | 39 | @State isPageEnd: boolean = false |
| 40 | @State publishTime: string = '' | 40 | @State publishTime: string = '' |
| 41 | @State publishCommentModel: publishCommentModel = new publishCommentModel() | 41 | @State publishCommentModel: publishCommentModel = new publishCommentModel() |
| 42 | + @State operationButtonList: string[] = ['comment', 'collect', 'share'] | ||
| 42 | 43 | ||
| 43 | build() { | 44 | build() { |
| 44 | Column() { | 45 | Column() { |
| @@ -144,7 +145,8 @@ export struct ImageAndTextPageComponent { | @@ -144,7 +145,8 @@ export struct ImageAndTextPageComponent { | ||
| 144 | if (this.contentDetailData?.length) { | 145 | if (this.contentDetailData?.length) { |
| 145 | OperRowListView({ | 146 | OperRowListView({ |
| 146 | contentDetailData: this.contentDetailData[0], | 147 | contentDetailData: this.contentDetailData[0], |
| 147 | - publishCommentModel: this.publishCommentModel | 148 | + publishCommentModel: this.publishCommentModel, |
| 149 | + operationButtonList: this.operationButtonList, | ||
| 148 | }) | 150 | }) |
| 149 | } | 151 | } |
| 150 | } | 152 | } |
| @@ -192,6 +194,9 @@ export struct ImageAndTextPageComponent { | @@ -192,6 +194,9 @@ export struct ImageAndTextPageComponent { | ||
| 192 | this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) | 194 | this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle) |
| 193 | this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) | 195 | this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType) |
| 194 | } | 196 | } |
| 197 | + if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) { | ||
| 198 | + this.operationButtonList = ['comment', 'collect', 'listen', 'share'] | ||
| 199 | + } | ||
| 195 | } | 200 | } |
| 196 | } | 201 | } |
| 197 | } | 202 | } |
| @@ -15,6 +15,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV | @@ -15,6 +15,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV | ||
| 15 | import { LikeComponent } from './LikeComponent'; | 15 | import { LikeComponent } from './LikeComponent'; |
| 16 | import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent'; | 16 | import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent'; |
| 17 | import { publishCommentModel } from '../comment/model/PublishCommentModel' | 17 | import { publishCommentModel } from '../comment/model/PublishCommentModel' |
| 18 | +// import { AudioBarView } from '../MorningEveningPaper/AudioBarView' | ||
| 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 19 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 20 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 20 | import { PageRepository } from '../../repository/PageRepository'; | 21 | import { PageRepository } from '../../repository/PageRepository'; |
| @@ -26,25 +27,27 @@ const TAG = 'OperRowListView'; | @@ -26,25 +27,27 @@ const TAG = 'OperRowListView'; | ||
| 26 | * 稿件详情底部通栏组件:包含返回、评论、点赞、收藏、分享 | 27 | * 稿件详情底部通栏组件:包含返回、评论、点赞、收藏、分享 |
| 27 | * 上层传值: | 28 | * 上层传值: |
| 28 | * 1、(必传) contentDetailData---稿件详情 | 29 | * 1、(必传) contentDetailData---稿件详情 |
| 29 | - * 2、(非必传) operationButtonList---组件展示条件,['comment', 'like', 'collect', 'share'],需要展示什么传什么 | ||
| 30 | - * comment--评论;like--点赞;collect--收藏;share--分享; | 30 | + * 2、(非必传) operationButtonList---组件展示条件, |
| 31 | + * ['comment', 'like', 'collect', 'share'],需要展示什么传什么 | ||
| 32 | + * comment--评论;like--点赞;collect--收藏;listen--音频;share--分享; | ||
| 31 | * | 33 | * |
| 32 | * 传值示例: | 34 | * 传值示例: |
| 33 | OperRowListView({ | 35 | OperRowListView({ |
| 34 | contentDetailData: this.contentDetailData[0], | 36 | contentDetailData: this.contentDetailData[0], |
| 35 | - operationButtonList: ['comment', 'like', 'collect', 'share'] | 37 | + operationButtonList: ['comment', 'like', 'collect', 'listen', 'share'] |
| 36 | }) | 38 | }) |
| 37 | */ | 39 | */ |
| 38 | @Preview | 40 | @Preview |
| 39 | @Component | 41 | @Component |
| 40 | export struct OperRowListView { | 42 | export struct OperRowListView { |
| 41 | @Prop contentDetailData: ContentDetailDTO // 稿件详情 | 43 | @Prop contentDetailData: ContentDetailDTO // 稿件详情 |
| 42 | - @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] // 组件展示条件 | 44 | + @Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件 |
| 43 | @ObjectLink publishCommentModel: publishCommentModel | 45 | @ObjectLink publishCommentModel: publishCommentModel |
| 44 | // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 46 | // @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 45 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 47 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 46 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 48 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 47 | @State likeBean: Record<string, string> = {} | 49 | @State likeBean: Record<string, string> = {} |
| 50 | + @State audioUrl: string= '' | ||
| 48 | needLike: boolean = true | 51 | needLike: boolean = true |
| 49 | 52 | ||
| 50 | async aboutToAppear() { | 53 | async aboutToAppear() { |
| @@ -70,6 +73,11 @@ export struct OperRowListView { | @@ -70,6 +73,11 @@ export struct OperRowListView { | ||
| 70 | this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + '' | 73 | this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + '' |
| 71 | this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + '' | 74 | this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + '' |
| 72 | this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/ | 75 | this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/ |
| 76 | + // 音频需要数据 | ||
| 77 | + if (this.operationButtonList?.includes('listen')) { | ||
| 78 | + this.audioUrl = this.contentDetailData.audioList[0]?.audioUrl || '' | ||
| 79 | + console.log(TAG, 'this.audioUrl+++', this.audioUrl) | ||
| 80 | + } | ||
| 73 | } | 81 | } |
| 74 | 82 | ||
| 75 | build() { | 83 | build() { |
| @@ -95,6 +103,8 @@ export struct OperRowListView { | @@ -95,6 +103,8 @@ export struct OperRowListView { | ||
| 95 | this.builderLike() | 103 | this.builderLike() |
| 96 | } else if (item == 'collect') { | 104 | } else if (item == 'collect') { |
| 97 | this.builderCollect() | 105 | this.builderCollect() |
| 106 | + } else if (item == 'listen') { | ||
| 107 | + this.builderListen() | ||
| 98 | } else if (item == 'share') { | 108 | } else if (item == 'share') { |
| 99 | this.builderShare() | 109 | this.builderShare() |
| 100 | } else { | 110 | } else { |
| @@ -176,6 +186,25 @@ export struct OperRowListView { | @@ -176,6 +186,25 @@ export struct OperRowListView { | ||
| 176 | } | 186 | } |
| 177 | 187 | ||
| 178 | /** | 188 | /** |
| 189 | + * 音频组件 | ||
| 190 | + */ | ||
| 191 | + // this.audioUrl | ||
| 192 | + @Builder | ||
| 193 | + builderListen() { | ||
| 194 | + Column() { | ||
| 195 | + Image($r('app.media.icon_listen')) | ||
| 196 | + .width(24) | ||
| 197 | + .height(24) | ||
| 198 | + .aspectRatio(1) | ||
| 199 | + .interpolation(ImageInterpolation.High) | ||
| 200 | + .onClick((event: ClickEvent) => { | ||
| 201 | + ToastUtils.showToast('音频为公共方法,待开发', 1000); | ||
| 202 | + }) | ||
| 203 | + } | ||
| 204 | + .width(42) | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + /** | ||
| 179 | * 分享组件 | 208 | * 分享组件 |
| 180 | */ | 209 | */ |
| 181 | @Builder | 210 | @Builder |
-
Please register or login to post a comment