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
陈剑华
2024-05-10 17:06:41 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
cb7b50edc02ac36f5cd329334fa98f426f44c812
cb7b50ed
2 parents
90d4d06f
08c9d09f
Merge remote-tracking branch 'origin/main'
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
110 additions
and
88 deletions
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLiveCommon.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLivePage.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/TabChatComponent.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerCommentComponent.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/VideoChannelDetail.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerCommentView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
cb7b50e
...
...
@@ -51,12 +51,12 @@ export struct OperRowListView {
@State operationButtonList: string[] = ['comment', 'collect', 'share'] // 组件展示条件
@ObjectLink publishCommentModel: publishCommentModel
@State styleType: number = 1
// @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
@State audioUrl: string = ''
@State bgColor: ResourceColor = Color.White
@State showCommentIcon: boolean = true
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
needLike: boolean = true
...
...
@@ -65,6 +65,7 @@ export struct OperRowListView {
console.info(TAG, '3333----', this.needLike)
this.handleStyle()
}
async onDetailUpdated() {
console.info(TAG, '111111----', this.styleType)
this.handleStyle()
...
...
@@ -166,6 +167,7 @@ export struct OperRowListView {
}
.flexShrink(1)
if (this.showCommentIcon) {
Column() {
if (this.publishCommentModel?.targetId) {
CommentIconComponent({ publishCommentModel: this.publishCommentModel, styleType: this.styleType })
...
...
@@ -174,6 +176,8 @@ export struct OperRowListView {
.width(46)
}
}
/**
* 点赞组件
*/
...
...
@@ -264,6 +268,8 @@ export struct OperRowListView {
this.bgColor = Color.White
} else if (this.styleType == 2) {
this.bgColor = Color.Black
} else if (this.styleType == 3) {
this.bgColor = Color.Transparent
}
}
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLiveCommon.ets
View file @
cb7b50e
...
...
@@ -13,21 +13,21 @@ const TAG = 'DetailPlayLiveCommon'
@Component
export struct DetailPlayLiveCommon {
private liveViewModel: LiveViewModel = new LiveViewModel()
@State liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
@State liveState: string = ''
@State liveStyle: number = -1
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
@Provide relId: string = ''
@Provide contentId: string = ''
@Provide relType: string = ''
@Provide liveState: string = ''
@Provide liveStyle: number = -1
@Provide playUrl: string = ''
@Provide imgUrl: string = ''
@Provide pageShow: number = -1
@Provide pageHide: number = -1
@Provide pageBackPress: number = -1
@Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@Provide publishCommentModel: publishCommentModel = new publishCommentModel()
async aboutToAppear(): Promise<void> {
Logger.debug(TAG, 'aboutToAppear')
//https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340
const par: Action = router.getParams() as Action;
const params = par?.params;
this.relId = params?.extra?.relId || '';
...
...
@@ -43,7 +43,7 @@ export struct DetailPlayLiveCommon {
if (this.liveState === 'wait' || this.liveStyle === 0) {
DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType })
} else if (this.liveStyle === 1) {
DetailPlayVLivePage(
{ contentId: this.contentId, relId: this.relId, relType: this.relType }
)
DetailPlayVLivePage()
}
}
.height('100%')
...
...
@@ -70,6 +70,7 @@ export struct DetailPlayLiveCommon {
this.publishCommentModel.targetRelObjectId = String(this.contentDetailData?.reLInfo?.relObjectId)
this.publishCommentModel.keyArticle = String(this.contentDetailData?.keyArticle)
this.publishCommentModel.targetType = String(this.contentDetailData?.newsType)
this.publishCommentModel.commentContent = ''
// }
}
})
...
...
@@ -86,6 +87,15 @@ export struct DetailPlayLiveCommon {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle
if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
}
if (this.liveDetailsBean.liveInfo.liveState == 'end') {
this.playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
}
console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean)))
}
},
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLivePage.ets
View file @
cb7b50e
...
...
@@ -24,7 +24,6 @@ export struct DetailPlayLivePage {
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
@Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
@Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean
@State tabs: string[] = []
@State changeToTab: number = -1
...
...
@@ -35,6 +34,7 @@ export struct DetailPlayLivePage {
@Consume @Watch('onBackPressCus') pageBackPress: number
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
@Consume liveDetailsBean: LiveDetailsBean
aboutToAppear(): void {
Logger.info(TAG, `wyj-aboutToAppear`)
...
...
@@ -66,6 +66,7 @@ export struct DetailPlayLivePage {
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onCommentFocus: () => {
// 切换到大家聊
this.changeToTab = Math.random()
...
...
@@ -113,15 +114,12 @@ export struct DetailPlayLivePage {
}
getLiveDetails() {
this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType)
.then(
(data) => {
if (data.length > 0) {
if (data[0].liveInfo?.liveState == 'wait') {
const data = this.liveDetailsBean
if (data.liveInfo?.liveState == 'wait') {
//直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】
if (data[0]
.liveInfo?.liveStyle == 1) {
if (data
.liveInfo?.liveStyle == 1) {
this.tabs = ['简介', '大家聊']
} else if (data[0]
.liveInfo?.liveStyle == 2) {
} else if (data
.liveInfo?.liveStyle == 2) {
this.tabs = ['简介', '直播间',]
} else {
this.tabs = ['简介', '直播间', '大家聊']
...
...
@@ -129,12 +127,7 @@ export struct DetailPlayLivePage {
} else {
this.tabs = ['直播间', '大家聊']
}
this.liveDetailsBean = data[0]
}
},
() => {
})
}
getLiveRoomData() {
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayVLivePage.ets
View file @
cb7b50e
...
...
@@ -20,30 +20,21 @@ export struct DetailPlayVLivePage {
private swiperController: SwiperController = new SwiperController()
@Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
@Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean
@Provide isShowControl: boolean = false
@Provide liveState: string = ''
@Provide playUrl: string = ''
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL //横竖屏,默认竖屏
@Consume liveState: string
@Consume liveStyle: number
@Consume playUrl: string
@Consume imgUrl: string
@Consume @Watch('openFullScreen') pageShow: number
@Consume @Watch('closeFullScreen') pageHide: number
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
@Consume contentId: string
@Consume liveDetailsBean: LiveDetailsBean
@State swiperIndex: number = 1
@State imgUrl: string = ''
aboutToAppear(): void {
console.log(TAG, 'aboutToAppear')
this.openFullScreen()
//https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340
let par: Action = router.getParams() as Action;
let params = par?.params;
this.relId = params?.extra?.relId || '';
this.relType = params?.extra?.relType || '';
this.contentId = params?.contentID || '';
this.getLiveDetails()
this.getLiveRoomData()
}
...
...
@@ -66,6 +57,7 @@ export struct DetailPlayVLivePage {
build() {
Stack() {
// 直播背景图,模糊处理
Image(this.imgUrl)
.height('100%')
.width('100%')
...
...
@@ -87,12 +79,13 @@ export struct DetailPlayVLivePage {
playerController: this.playerController
})
}
PlayerInfoComponent({
playerController: this.playerController,
swiperController: this.swiperController,
swiperIndex: $swiperIndex
})
// 清屏按钮
Image($r('app.media.icon_live_more'))
.width(40)
.aspectRatio(1)
...
...
@@ -103,37 +96,12 @@ export struct DetailPlayVLivePage {
this.swiperController.showNext()
})
}
}
.height('100%')
.width('100%')
}
getLiveDetails() {
this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType)
.then(
(data) => {
if (data.length > 0) {
this.liveDetailsBean = data[0]
this.liveState =
this.liveDetailsBean.liveInfo?.liveState //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
}
if (this.liveDetailsBean.liveInfo.liveState == 'end') {
this.playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
}
console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean)))
}
},
(message: string) => {
console.error(TAG, 'getLiveDetails catch', message)
})
}
getLiveRoomData() {
this.liveViewModel.getLiveRoomData(this.contentId)
.then(
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/TabChatComponent.ets
View file @
cb7b50e
...
...
@@ -7,7 +7,8 @@ import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
import { ViewType } from 'wdConstant/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { TabChatItemComponent } from './TabChatItemComponent'
import { Logger } from 'wdKit';
import { EmitterEventId, EmitterUtils, Logger } from 'wdKit';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
const TAG: string = 'TabChatComponent';
...
...
@@ -17,9 +18,28 @@ export struct TabChatComponent {
liveViewModel: LiveViewModel = new LiveViewModel()
@State liveChatList: Array<LiveRoomItemBean> = []
@Consume liveDetailsBean: LiveDetailsBean
@Consume publishCommentModel: publishCommentModel
aboutToAppear(): void {
this.getLiveChatList()
//注册通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, async (targetId?: string) => {
if (targetId) {
if (targetId == this.publishCommentModel.targetId) {
const info = {
senderUserAvatarUrl: this.publishCommentModel.lastCommentModel.fromUserHeader,
senderUserName: this.publishCommentModel.lastCommentModel.fromUserName,
text: this.publishCommentModel.lastCommentModel.commentContent,
} as LiveRoomItemBean
this.liveChatList.push(info)
this.pageModel.viewType = ViewType.LOADED;
// this.scroller.scrollEdge(Edge.Bottom)
console.log(TAG, '发布评论:', JSON.stringify(this.publishCommentModel.lastCommentModel))
}
}
})
}
build() {
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerCommentComponent.ets
View file @
cb7b50e
...
...
@@ -3,14 +3,14 @@ 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 { DisplayDirection,
SpConstants,
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'
import { WindowModel } from 'wdKit/Index'
import {
EmitterEventId, EmitterUtils, SPHelper,
WindowModel } from 'wdKit/Index'
const TAG = "PlayerCommentComponent"
...
...
@@ -24,24 +24,37 @@ export struct PlayerCommentComponent {
@State liveChatList: Array<LiveRoomItemBean> = []
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
@State contentId: string = ''
@State relId: string = ''
@State relType: string = ''
scroller: Scroller = new Scroller()
async aboutToAppear(): Promise<void> {
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.getLiveChatList()
//注册通知
EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, async (targetId?: string) => {
if (targetId) {
if (targetId == this.publishCommentModel.targetId) {
const info = {
senderUserName: this.publishCommentModel.lastCommentModel.fromUserName,
text: this.publishCommentModel.lastCommentModel.commentContent,
} as LiveRoomItemBean
this.liveChatList.push(info)
this.scroller.scrollEdge(Edge.Bottom)
console.log(TAG, '发布评论:', JSON.stringify(this.publishCommentModel.lastCommentModel))
}
}
})
}
this.getLiveChatList()
generateRandomString() {
let result = '';
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
const charactersLength = characters.length;
for (let i = 0; i < 6; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
liveDetailsBeanChange() {
...
...
@@ -99,11 +112,13 @@ export struct PlayerCommentComponent {
.scrollBar(BarState.Off)
.margin({ bottom: 20 })
// 收藏、分享、点赞是否需要根据字段显隐
OperRowListView({
bgColor: Color.Transparent
,
styleType: 3
,
operationButtonList: ['comment', 'collect', 'share', 'like'],
contentDetailData: this.contentDetailData,
publishCommentModel: this.publishCommentModel,
showCommentIcon: false,
onBack: () => {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
cb7b50e
...
...
@@ -36,6 +36,7 @@ export struct DetailPlayShortVideoPage {
@Consume @Watch('pageShowChange') pageShow: number
@Consume topSafeHeight: number
@State imageVisible: boolean = true
@Consume windowWidth: number
/**
* 页面显示重查用户关注、点赞等信息
...
...
@@ -71,7 +72,7 @@ export struct DetailPlayShortVideoPage {
currentIndexChange() {
if (this.currentIndex != this.index) {
this.playerController.pause()
if (this.index <
this.currentIndex - 3
&& this.playerController.getPlayer()) {
if (this.index <
= this.currentIndex - 2
&& this.playerController.getPlayer()) {
this.playerController.release()
}
...
...
@@ -171,24 +172,26 @@ export struct DetailPlayShortVideoPage {
.width('100%')
}
/**
* 视频首帧图,用于快速显示
* 竖屏封面顶部仍然有点偏移,待处理
*/
@Builder
playerCoverBuilder() {
Image(this.contentDetailData?.
videoInfo?.[0]?.
firstFrameImageUri)
Image(this.contentDetailData?.firstFrameImageUri)
.width('100%')
.height('auto')
.margin({
top: this.topSafeHeight + 'px'
})
.padding({
bottom: this.videoLandScape === 1 ? 115 : 0,
})
.align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
})// .align(this.videoLandScape === 0 ? Alignment.Top : Alignment.Center)
.fitOriginalSize(true)
.autoResize(true)
.position({ x: 0, y: this.videoLandScape === 0 ? 0 : '50%' })
.markAnchor({ y: this.videoLandScape === 0 ? 0 : '50%' })
// .visibility(this.imageVisible ? Visibility.Visible : Visibility.None)
}
@Builder
playerViewBuilder() {
// 播放窗口
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/VideoChannelDetail.ets
View file @
cb7b50e
...
...
@@ -243,7 +243,7 @@ export struct VideoChannelDetail {
}, (item: ContentDetailDTO) => item.newsId + '')
}
.visibility(this.isMouted ? Visibility.Visible : Visibility.None)
.cachedCount(-
1)
// .cachedCount(
1)
.indicator(false)
.vertical(true)
.loop(false)
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerCommentView.ets
View file @
cb7b50e
import router from '@ohos.router';
import { ContentDetailDTO } from 'wdBean/Index';
@Component
export struct PlayerCommentView {
@Consume showComment?: boolean
@Consume isOpenDetail?: boolean
@Consume contentDetailData: ContentDetailDTO
@State comment: string = '';
build() {
...
...
@@ -16,6 +18,7 @@ export struct PlayerCommentView {
router.back();
})
if (this.contentDetailData.openComment === 1) {
TextInput({ placeholder: '说两句...', text: this.comment })
.placeholderColor('#999999')
.placeholderFont({ size: 14 })
...
...
@@ -28,6 +31,8 @@ export struct PlayerCommentView {
.height(30)
.margin({ left: 12 })
}
}
.backgroundColor(Color.Black)
.alignItems(VerticalAlign.Center)
.padding({
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
View file @
cb7b50e
...
...
@@ -167,7 +167,9 @@ export struct PlayerRightView {
this.userBuilderView()
this.likeBuilderView()
this.collectBuilderView()
if (this.contentDetailData.openComment === 1) {
this.commentBuilderView()
}
this.shareBuilderView()
}
...
...
Please
register
or
login
to post a comment