daijian_wd

feat: 底部栏音频图标

... ... @@ -39,6 +39,7 @@ export struct ImageAndTextPageComponent {
@State isPageEnd: boolean = false
@State publishTime: string = ''
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State operationButtonList: string[] = ['comment', 'collect', 'share']
build() {
Column() {
... ... @@ -144,7 +145,8 @@ export struct ImageAndTextPageComponent {
if (this.contentDetailData?.length) {
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel
publishCommentModel: this.publishCommentModel,
operationButtonList: this.operationButtonList,
})
}
}
... ... @@ -192,6 +194,9 @@ export struct ImageAndTextPageComponent {
this.publishCommentModel.keyArticle = String(this.contentDetailData[0]?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData[0]?.newsType)
}
if (this.contentDetailData[0]?.audioList?.length && this.contentDetailData[0]?.audioList[0].audioUrl) {
this.operationButtonList = ['comment', 'collect', 'listen', 'share']
}
}
}
}
... ...
... ... @@ -15,6 +15,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV
import { LikeComponent } from './LikeComponent';
import { CommentTabComponent, CommentIconComponent, } from '../comment/view/CommentTabComponent';
import { publishCommentModel } from '../comment/model/PublishCommentModel'
// import { AudioBarView } from '../MorningEveningPaper/AudioBarView'
import { HttpUrlUtils } from 'wdNetwork/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { PageRepository } from '../../repository/PageRepository';
... ... @@ -26,25 +27,27 @@ const TAG = 'OperRowListView';
* 稿件详情底部通栏组件:包含返回、评论、点赞、收藏、分享
* 上层传值:
* 1、(必传) contentDetailData---稿件详情
* 2、(非必传) operationButtonList---组件展示条件,['comment', 'like', 'collect', 'share'],需要展示什么传什么
* comment--评论;like--点赞;collect--收藏;share--分享;
* 2、(非必传) operationButtonList---组件展示条件,
* ['comment', 'like', 'collect', 'share'],需要展示什么传什么
* comment--评论;like--点赞;collect--收藏;listen--音频;share--分享;
*
* 传值示例:
OperRowListView({
contentDetailData: this.contentDetailData[0],
operationButtonList: ['comment', 'like', 'collect', 'share']
operationButtonList: ['comment', 'like', 'collect', 'listen', 'share']
})
*/
@Preview
@Component
export struct OperRowListView {
@Prop contentDetailData: ContentDetailDTO // 稿件详情
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] // 组件展示条件
@Prop operationButtonList?: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@ObjectLink publishCommentModel: publishCommentModel
// @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
@State audioUrl: string= ''
needLike: boolean = true
async aboutToAppear() {
... ... @@ -70,6 +73,11 @@ export struct OperRowListView {
this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/
// 音频需要数据
if (this.operationButtonList?.includes('listen')) {
this.audioUrl = this.contentDetailData.audioList[0]?.audioUrl || ''
console.log(TAG, 'this.audioUrl+++', this.audioUrl)
}
}
build() {
... ... @@ -95,6 +103,8 @@ export struct OperRowListView {
this.builderLike()
} else if (item == 'collect') {
this.builderCollect()
} else if (item == 'listen') {
this.builderListen()
} else if (item == 'share') {
this.builderShare()
} else {
... ... @@ -176,6 +186,25 @@ export struct OperRowListView {
}
/**
* 音频组件
*/
// this.audioUrl
@Builder
builderListen() {
Column() {
Image($r('app.media.icon_listen'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.onClick((event: ClickEvent) => {
ToastUtils.showToast('音频为公共方法,待开发', 1000);
})
}
.width(42)
}
/**
* 分享组件
*/
@Builder
... ...