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
zhenghy
2024-05-08 14:34:56 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
852aad26a466e9b745190e8638ac5bb952b41a74
852aad26
1 parent
769f2281
竖屏直播接入评论
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
14 deletions
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerCommentComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerInfoComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
852aad2
...
...
@@ -49,13 +49,16 @@ export struct OperRowListView {
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
@State audioUrl: string= ''
@State audioUrl: string = ''
@State bgColor: ResourceColor = Color.White
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
needLike: boolean = true
// async aboutToAppear() {
async onDetailUpdated() {
if (!this.contentDetailData) return
if (!this.contentDetailData) {
return
}
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractDataStatus()
...
...
@@ -123,7 +126,7 @@ export struct OperRowListView {
.justifyContent(FlexAlign.Start)
}
.width('100%')
.backgroundColor(
Color.White
)
.backgroundColor(
this.bgColor
)
.padding({
top: 10,
// bottom: `${this.bottomSafeHeight}px`
...
...
@@ -173,7 +176,8 @@ export struct OperRowListView {
builderCollect() {
Column() {
Stack({ alignContent: Alignment.TopEnd }) {
Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check') : $r('app.media.iv_live_comment_collect_un'))
Image(this.newsStatusOfUser?.collectStatus == 1 ? $r('app.media.ic_collect_check') :
$r('app.media.iv_live_comment_collect_un'))
.width(24)
.height(24)
.interpolation(ImageInterpolation.High)
...
...
@@ -273,7 +277,7 @@ export struct OperRowListView {
PageRepository.postExecuteCollectRecord(params).then(res => {
if (this.newsStatusOfUser) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
if
(this.newsStatusOfUser.collectStatus === 1)
{
if
(this.newsStatusOfUser.collectStatus === 1)
{
promptAction.showToast({ message: '收藏成功' })
}
this.queryContentInteractCount()
...
...
@@ -299,7 +303,8 @@ export struct OperRowListView {
this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum)
this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum)
// 评论组件需要数据
if (Number.parseInt(this.interactData.commentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) {
if (Number.parseInt(this.interactData.commentNum) >
Number.parseInt(this.publishCommentModel.totalCommentNumer)) {
this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' || '0'
}
}
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerCommentComponent.ets
View file @
852aad2
import { LiveDetailsBean, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index'
import {
Action, ContentDetailDTO,
LiveDetailsBean, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index'
import { LiveCommentComponent } from 'wdComponent/Index'
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
import { OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView'
import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
import { DisplayDirection, ViewType } from 'wdConstant/Index'
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { ResponseDTO } from 'wdNetwork/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { ChartItemCompereComponent } from './ChartItemCompereComponent'
import { ChatItemComponent } from './ChartItemComponent'
import { router } from '@kit.ArkUI'
const TAG = "PlayerCommentComponent"
@Component
export struct PlayerCommentComponent {
...
...
@@ -15,10 +21,25 @@ export struct PlayerCommentComponent {
@Consume displayDirection: DisplayDirection
@State private pageModel: PageModel = new PageModel()
@State liveChatList: Array<LiveRoomItemBean> = []
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State publishCommentModel: publishCommentModel = new publishCommentModel()
@State contentId: string = ''
@State relId: string = ''
@State relType: string = ''
scroller: Scroller = new Scroller()
aboutToAppear(): void {
this.getLiveChatList()
const action: Action = router.getParams() as Action
if (action) {
this.contentId = action.params?.contentID || ''
if (action.params && action.params.extra) {
this.relId = action.params.extra.relId || ''
this.relType = action.params.extra.relType || ''
}
this.getContentDetail(this.contentId, this.relId, this.relType)
}
}
liveDetailsBeanChange() {
...
...
@@ -58,6 +79,32 @@ export struct PlayerCommentComponent {
})
}
async getContentDetail(contentId: string, relId: string, relType: string) {
await ContentDetailRequest.getContentDetail({
contentId: contentId,
relId: relId,
relType: relType
}).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
console.log(TAG, 'getContentDetail:', JSON.stringify(resDTO.data))
if (resDTO.data) {
this.contentDetailData = resDTO.data?.[0];
if (this.contentDetailData?.openComment) {
this.publishCommentModel.targetId = String(this.contentDetailData?.newsId || '')
this.publishCommentModel.targetRelId = String(this.contentDetailData?.reLInfo?.relId)
this.publishCommentModel.targetTitle = this.contentDetailData?.newsTitle
this.publishCommentModel.targetRelType = String(this.contentDetailData?.reLInfo?.relType)
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
}
}
})
}
build() {
Column() {
List({ scroller: this.scroller }) {
...
...
@@ -76,9 +123,17 @@ export struct PlayerCommentComponent {
.scrollBar(BarState.Off)
.margin({ bottom: 20 })
LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
OperRowListView({
bgColor: Color.Transparent,
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
})
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
.backgroundColor(Color.Black)
// LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
// .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
// .backgroundColor(Color.Black)
}.alignItems(HorizontalAlign.Start)
}
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerComponent.ets
View file @
852aad2
...
...
@@ -10,6 +10,8 @@ export struct PlayerComponent {
@Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
@Consume isShowControl: boolean
@Consume liveState: string
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State imgUrl: string = ''
...
...
@@ -92,6 +94,11 @@ export struct PlayerComponent {
.width('100%')
.align(Alignment.Top)
.alignContent(Alignment.Top)
.onClick(() => {
if (this.liveState === 'end') {
this.isShowControl = !this.isShowControl
}
})
}
.height('100%')
.width('100%')
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerInfoComponent.ets
View file @
852aad2
...
...
@@ -26,11 +26,11 @@ export struct PlayerInfoComponent {
.width('100%')
.height('100%')
.index(this.swiperIndex)
.onClick(() => {
if (this.liveState === 'end') {
this.isShowControl = !this.isShowControl
}
})
// .onClick(() => {
// if (this.liveState === 'end') {
// this.isShowControl = !this.isShowControl
// }
// })
.onChange((index) => {
this.swiperIndex = index
})
...
...
Please
register
or
login
to post a comment