陈剑华

Merge remote-tracking branch 'origin/main'

... ... @@ -328,6 +328,7 @@ export struct DynamicDetailComponent {
.margin({ left: $r('app.float.margin_2')})
}
.margin({top:$r('app.float.margin_16')})
Blank().layoutWeight(1)
//fixme 评论组件
}
}
... ...
... ... @@ -12,7 +12,7 @@ export struct MultiPictureDetailItemComponent {
async aboutToAppear() {
Logger.info(TAG, 'pictures preview')
// Logger.info(TAG, 'pictures preview')
}
build() {
... ...
import { Logger, SPHelper } from 'wdKit';
import {
NetworkUtil,
Logger,
NetworkType,
SPHelper,
} from 'wdKit';
import { ResponseDTO } from 'wdNetwork';
import {
ContentDetailDTO,
... ... @@ -61,7 +66,15 @@ export struct MultiPictureDetailPageComponent {
familyName: 'BebasNeue_Regular',
familySrc: $rawfile('font/BebasNeue_Regular.otf')
})
this.getContentDetailData()
// 注册监听网络连接
let netStatus = NetworkUtil.isNetConnected()
if(netStatus) {
// 有网络
this.getContentDetailData()
} else {
// 无网络
this.netStatus = 1
}
}
aboutToDisappear() {
... ... @@ -73,7 +86,7 @@ export struct MultiPictureDetailPageComponent {
if (this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean) => {
Swiper(this.swiperController) {
Swiper(this.swiperControllerItem) {
MultiPictureDetailItemComponent({ MultiPictureDetailItem: item })
}
.width('100%')
... ... @@ -256,15 +269,14 @@ export struct MultiPictureDetailPageComponent {
})
.height(px2vp(this.titleHeight) + 64)
} else {
if(this.netStatus !== undefined) {
EmptyComponent({ emptyType: this.netStatus})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
}
if(this.netStatus !== undefined) {
EmptyComponent({ emptyType: $netStatus, emptyButton:true, retry: () => {this.getContentDetailData()}})
.id('e_empty_content')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
OperRowListView({
contentDetailData: this.contentDetailData,
... ... @@ -293,12 +305,9 @@ export struct MultiPictureDetailPageComponent {
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
private getContentDetailData() {
getContentDetailData() {
try {
PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {
// Logger.info(TAG, `fetchDetailData then,navResDTO.timestamp ${resDTO.timestamp}`);
// Logger.info(TAG, `fetchDetailData then,navResDTO: ${JSON.stringify(resDTO)}`);
// Logger.info(TAG, `fetchDetailData then,navResDTO.data: ${JSON.stringify(resDTO.data)}`);
PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then(async (resDTO: ResponseDTO<ContentDetailDTO[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'fetchDetailData is empty');
return
... ... @@ -307,29 +316,25 @@ export struct MultiPictureDetailPageComponent {
Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`);
return
}
this.netStatus = undefined
this.contentDetailData = resDTO.data?.[0];
// this.contentDetailData.photoList = []
if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) {
// 暂无内容
this.netStatus = 0
Logger.info(TAG, `this.netStatus:${JSON.stringify(this.netStatus)}`)
}
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
if (HttpUrlUtils.getUserId()) {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (user_id) {
this.getInteractBrowsOperate()
this.getBatchAttentionStatus()
}
}).catch((err: Error) => {
Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`);
/*// 请求失败处理
if (err.response) {
// 请求已发出,但服务器响应的状态码不在2xx范围内
console.error('请求失败,状态码:', err.response.status);
console.error('响应数据:', err.response.data);
} else if (err.request) {
// 请求已发出,但无响应(例如:网络故障)
console.error('请求已发出,但无响应:', err.request);
} else {
// 发生了其他类型的错误(如配置错误或拒绝权限等)
console.error('请求发生错误:', err.message);
}*/
// 内容获取失败
this.netStatus = 9
})
} catch (exception) {
... ...
... ... @@ -52,7 +52,7 @@ export struct EmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default;
@Link emptyType: number
@State emptyButton: boolean = false
@State timeNum: number = 10
/**
... ...
... ... @@ -121,35 +121,6 @@ export struct LiveHorizontalCardComponent {
}
async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
if (content && content.objectType) {
if (content.objectType === ContentConstants.TYPE_LIVE) {
if (liveDetail && liveDetail[0] && liveDetail[0].liveInfo) {
const liveStyle = liveDetail[0].liveInfo.liveStyle
const liveState = liveDetail[0].liveInfo.liveState
console.error('liveDetail===', liveDetail)
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
liveStyle: liveState === 'wait' ? 0 : liveStyle,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
// Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
} else if (content.objectType === ContentConstants.TYPE_TELETEXT) {
ProcessUtils.processPage(content)
}
}
ProcessUtils.processPage(content)
}
}
\ No newline at end of file
... ...
... ... @@ -113,6 +113,7 @@ export struct AudioDialog {
if (this.playerController) {
// this.onConfirm()
this.playerController.switchPlayOrPause()
this.AudioSuspension.playerController.get().switchPlayOrPause()
this.currentStatus = this.playerController.getStatus()
}
})
... ...
... ... @@ -5,6 +5,8 @@ import router from '@ohos.router';
import { DetailPlayLivePage } from './DetailPlayLivePage'
import { DetailPlayVLivePage } from './DetailPlayVLivePage'
const TAG = 'DetailPlayLiveCommon'
@Entry()
@Component
export struct DetailPlayLiveCommon {
... ... @@ -47,7 +49,7 @@ export struct DetailPlayLiveCommon {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
this.liveStyle = this.liveDetailsBean.liveInfo.liveStyle
console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean)))
console.log(TAG, 'getLiveDetails:', JSON.stringify((this.liveDetailsBean)))
}
},
() => {
... ...
... ... @@ -8,11 +8,11 @@ import { WDPlayerController } from 'wdPlayer/Index';
import { DisplayDirection } from 'wdConstant/Index';
const storage = LocalStorage.getShared();
const TAG = 'DetailPlayVLivePage'
@Entry(storage)
@Component
export struct DetailPlayVLivePage {
TAG: string = 'DetailPlayVLivePage';
private liveViewModel: LiveViewModel = new LiveViewModel()
private playerController: WDPlayerController = new WDPlayerController();
private swiperController: SwiperController = new SwiperController()
... ... @@ -29,6 +29,7 @@ export struct DetailPlayVLivePage {
@State swiperIndex: number = 1
aboutToAppear(): void {
console.log(TAG, 'aboutToAppear')
WindowModel.shared.setWindowLayoutFullScreen(true)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
... ... @@ -86,11 +87,11 @@ export struct DetailPlayVLivePage {
if (data.length > 0) {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean)))
console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean)))
}
},
() => {
(message: string) => {
console.error(TAG, 'getLiveDetails catch', message)
})
}
... ... @@ -99,9 +100,10 @@ export struct DetailPlayVLivePage {
.then(
(data) => {
this.liveRoomDataBean = data
console.log(TAG, 'getLiveRoomData', JSON.stringify((this.liveRoomDataBean)))
},
() => {
(message: string) => {
console.error(TAG, 'getLiveDetails catch', message)
})
}
}
... ...
... ... @@ -2,6 +2,7 @@ import { LiveDetailsBean } from 'wdBean/Index';
import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index';
import componentUtils from '@ohos.arkui.componentUtils';
const TAG = 'PlayerComponent'
@Component
export struct PlayerComponent {
... ... @@ -16,6 +17,7 @@ export struct PlayerComponent {
@State playUrl: string = ''
aboutToAppear(): void {
console.log(TAG, 'aboutToAppear')
if (this.playerController) {
this.playerController.onCanplay = () => {
console.log('可以播放了')
... ... @@ -33,7 +35,6 @@ export struct PlayerComponent {
}
updateData() {
console.error('updateData=============')
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
... ...
... ... @@ -32,19 +32,32 @@ export struct DetailPlayShortVideoPage {
@Provide followStatus: string = '0' // 关注状态
@Provide isOpenDetail: boolean = false // 查看详情按钮点击
@Provide isDragging: boolean = false // 拖动时间进度条
@Consume @Watch('videoStatusChange') switchVideoStatus: boolean
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
/**
* 页面显示重查用户关注、点赞等信息
*/
pageShowChange() {
if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_PAUSE) {
this.playerController.play()
if (this.currentIndex === this.index) {
this.queryNewsInfoOfUser()
if (this.switchVideoStatus) {
this.playerController.play()
}
}
}
pageHideChange() {
if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_START) {
this.playerController.pause()
/**
* 频道切换视频暂停、播放
* 页面显隐视频暂停、播放
*/
videoStatusChange() {
if (this.currentIndex === this.index) {
if (this.switchVideoStatus) {
this.playerController.play()
} else {
this.playerController.pause()
}
}
}
... ...
... ... @@ -22,12 +22,12 @@ export struct DetailVideoListPage {
@Provide showComment: boolean = true
@Provide pageShow: number = -1
@Provide pageHide: number = -1
@Provide switchVideoStatus: boolean = false
@State data: ContentDetailDTO[] = []
@State testData: string[] = ['111', '222', '333']
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State isFullScreen: boolean = false
@State switchVideoStatus: boolean = false
async aboutToAppear(): Promise<void> {
this.openFullScreen()
... ... @@ -57,13 +57,14 @@ export struct DetailVideoListPage {
onPageShow(): void {
console.log(TAG, 'onPageShow')
this.pageShow = Math.random()
this.switchVideoStatus = true
this.openFullScreen()
}
onPageHide(): void {
console.log(TAG, 'onPageHide')
this.pageHide = Math.random()
this.switchVideoStatus = false
this.closeFullScreen()
}
... ...
... ... @@ -46,36 +46,43 @@ export struct VideoChannelDetail {
private swiperController: SwiperController = new SwiperController()
@Provide showComment: boolean = false
@Provide windowWidth: number = AppStorage.get<number>('windowWidth') || 0
@Consume @Watch('pageShowChange') pageShow: number
@Consume @Watch('pageHideChange') pageHide: number
@Provide switchVideoStatus: boolean = false
@State data: ContentDetailDTO[] = []
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State totalCount: number = 0
@State switchVideoStatus: boolean = false
@State isMouted: boolean = false
pageShowChange() {
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
this.barBackgroundColor = Color.Black
this.switchVideoStatus = true
this.openFullScreen()
}
}
pageHideChange() {
this.barBackgroundColor = Color.Transparent
this.switchVideoStatus = false
this.closeFullScreen()
}
/**
* 监听视频频道激活或失活
*/
navIndexChange() {
// if (timer) clearTimeout(timer)
console.log('navIndexChange', this.bottomNavIndex, this.topNavIndex)
// timer = setTimeout(() => {
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
// 如果视频在暂停则播放视频
this.switchVideoStatus = true
this.barBackgroundColor = Color.Black
this.switchVideoStatus = true
this.openFullScreen()
} else {
// 如果视频在播放则暂停视频
this.switchVideoStatus = false
this.barBackgroundColor = Color.Transparent
this.switchVideoStatus = false
this.closeFullScreen()
}
// timer = -1
// }, 100)
}
aboutToAppear() {
... ... @@ -90,16 +97,6 @@ export struct VideoChannelDetail {
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow(): void {
this.openFullScreen()
Logger.info(TAG, 'onPageShow');
}
onPageHide(): void {
this.closeFullScreen()
Logger.info(TAG, 'onPageHide');
}
/**
* 开启沉浸式
* TODO:颜色待根据业务接口修改
... ...