Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
daijian_wd
2024-04-28 19:01:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
917033646608aae539e51bdef3f529b4dc477dd2
91703364
1 parent
f538b646
feat: 底部栏音频图标
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
5 deletions
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
9170336
...
...
@@ -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']
}
}
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
9170336
...
...
@@ -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
...
...
Please
register
or
login
to post a comment