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
yumaochao
2024-05-28 17:54:37 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
4233585b8c572c628c12973878af05809f0a1e01
4233585b
2 parents
1b073744
fdb83434
Merge branch 'main' of
http://192.168.1.42/developOne/harmonyPool
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
212 additions
and
79 deletions
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentListDialog.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
sight_harmony/features/wdComponent/src/main/ets/model/MinePageDatasModel.ets
sight_harmony/features/wdComponent/src/main/ets/utils/lazyloadImg.ets
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLivePage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/CommentDialogView.ets
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
sight_harmony/features/wdPlayer/oh-package.json5
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPlay.ets
sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
sight_harmony/products/phone/src/main/ets/pages/view/MultiPictureDetailPageComponent.ets
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentListDialog.ets
View file @
4233585
...
...
@@ -38,7 +38,11 @@ export struct CommentListDialogView {
}
closeAction() {
this.showCommentList = false
if (this.onClose) {
this.onClose()
} else {
this.showCommentList = false
}
}
build() {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/ChannelSubscriptionLayout.ets
View file @
4233585
...
...
@@ -20,12 +20,10 @@ struct ChannelSubscriptionLayout {
//当前选中的频道
@Link currentTopNavSelectedIndex: number;
@Prop homeChannelList: TopNavDTO []
@Prop indexSettingChannelId: number
@Link myChannelList: TopNavDTO []
@Link moreChannelList: TopNavDTO []
@Link localChannelList: TopNavDTO []
@Link channelIds: number []
@StorageLink('channelIds') storeChannelIds: string = ''
@State isShow: boolean = false
@State dragItem: number = -1
private dragRefOffsetX: number = 0
...
...
@@ -34,7 +32,7 @@ struct ChannelSubscriptionLayout {
@State offsetY: number = 0
private FIX_VP_X: number = 80
private FIX_VP_Y: number = 48
@State indexSetting
TabIndex: number = 0
@State indexSetting
ChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
@State isEditIng: boolean = false
@State currentTopNavSelectedItem: TopNavDTO = {} as TopNavDTO
changeTab: (index: number) => void = () => {
...
...
@@ -50,13 +48,13 @@ struct ChannelSubscriptionLayout {
let channelIdTmp = this.channelIds.splice(index1, 1)
this.myChannelList.splice(index2, 0, tmp[0])
this.channelIds.splice(index2, 0, channelIdTmp[0])
this.storeChannelIds = this.channelIds.join(','
)
AppStorage.setOrCreate('channelIds', this.channelIds.join(',')
)
}
//删除频道
delChannelItem(index: number){
let item = this.myChannelList.splice(index, 1)[0]
this.channelIds.splice(index, 1)
this.storeChannelIds = this.channelIds.join(','
)
AppStorage.setOrCreate('channelIds', this.channelIds.join(',')
)
if (item.moreChannel === '1') {
this.moreChannelList.unshift(item)
}
...
...
@@ -68,7 +66,7 @@ struct ChannelSubscriptionLayout {
addChannelItem(item: TopNavDTO){
this.channelIds.push(item.channelId)
this.myChannelList.push(item)
this.storeChannelIds = this.channelIds.join(','
)
AppStorage.setOrCreate('channelIds', this.channelIds.join(',')
)
}
itemMove(index: number, newIndex: number): void {
...
...
@@ -265,6 +263,7 @@ struct ChannelSubscriptionLayout {
.alignContent(Alignment.Start)
.height(36)
.onClick(() => {
this.indexSettingChannelId = item.channelId
AppStorage.set('indexSettingChannelId', item.channelId)
})
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/TopNavigationComponentNew.ets
View file @
4233585
...
...
@@ -13,9 +13,6 @@ import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'
const TAG = 'TopNavigationComponent';
PersistentStorage.persistProp('channelIds', '');
PersistentStorage.persistProp('indexSettingChannelId', 2002);
const storage = LocalStorage.getShared();
/**
...
...
@@ -48,11 +45,11 @@ export struct TopNavigationComponentNew {
@State currentTopNavSelectedIndex: number = 0;
// 顶导数据
@State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
@St
orageProp('indexSettingChannelId') indexSettingChannelId: number =
2002
@St
ate indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') ||
2002
//我的频道id列表
@State channelIds: number[] = []
//本地缓存频道id列表
@St
orageProp('channelIds') storageChannelIds: string =
''
@St
ate storageChannelIds: string = AppStorage.get<string>('channelIds') ||
''
@State homeChannelList: TopNavDTO[] = []
// 我的频道列表
@State myChannelList: TopNavDTO[] = []
...
...
@@ -191,7 +188,6 @@ export struct TopNavigationComponentNew {
this.topBar()
ChannelSubscriptionLayout({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
indexSettingChannelId: this.indexSettingChannelId,
homeChannelList: this.homeChannelList,
myChannelList: $myChannelList,
moreChannelList: $moreChannelList,
...
...
@@ -406,18 +402,29 @@ export struct TopNavigationComponentNew {
//频道分类
if (item.name !== '播报') { //暂时隐藏播报
if (item.myChannel === '1') {
if (item.myChannel === '1'
&& !this.storageChannelIds
) {
_myChannelList.push(item)
_channelIds.push(item.channelId)
} else if (item.moreChannel === '1') {
}
if (item.moreChannel === '1') {
this.moreChannelList.push(item)
} else if (item.localChannel === '1' && item.myChannel !== '1') {
}
if (item.localChannel === '1' && item.myChannel !== '1') {
this.localChannelList.push(item)
}
}
})
if(this.storageChannelIds){
_storageChannelIds.forEach((_item:string)=>{
let index = defaultList.findIndex(ele => Number(_item) === ele.channelId)
if(index > -1){
_myChannelList.push(defaultList[index])
_channelIds.push(defaultList[index].channelId)
}
})
}
if (cityName) {
let index = _myChannelList.findIndex(ele => cityName.includes(ele.name))
const localChannelitem = _myChannelList.splice(index, 1)[0];
...
...
@@ -466,10 +473,6 @@ export struct TopNavigationComponentNew {
this.changePage(this.currentTopNavSelectedIndex)
}
aboutToDisappear() {
AppStorage.set('channelIds', this.channelIds.join(','))
}
onTopNavigationDataUpdated() {
Logger.info(TAG,
`onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
...
...
sight_harmony/features/wdComponent/src/main/ets/dialog/ENewspaperListDialog.ets
View file @
4233585
...
...
@@ -3,7 +3,7 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { WDRouterRule } from 'wdRouter/Index'
import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
import { Logger } from 'wdKit';
import { window } from '@kit.ArkUI';
import {
font,
window } from '@kit.ArkUI';
/**
* 读报纸半屏弹窗
...
...
@@ -56,6 +56,11 @@ export struct ENewspaperListDialog {
}
async aboutToAppear() {
//注册字体
font.registerFont({
familyName: 'BebasNeueBold',
familySrc: $rawfile('font/BebasNeueBold.otf')
})
// 屏幕高度 - 滑动高度计算
let windowClass: window.Window = await window.getLastWindow(getContext(this));
let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
...
...
@@ -151,7 +156,7 @@ export struct ENewspaperListDialog {
Column() {
if (itemIndex == 0) {
Text(item.pageNum + '版:' + item.pageName)
.fontSize($r('app.float.font_size_1
4
'))
.fontSize($r('app.float.font_size_1
3
'))
.fontColor($r('app.color.color_ED2800'))
.fontWeight(600)
.width('100%')
...
...
@@ -165,7 +170,7 @@ export struct ENewspaperListDialog {
Column() {
if (positionItem.shortTitle) {
Text(positionItem.shortTitle)
.fontSize($r('app.float.font_size_1
4
'))
.fontSize($r('app.float.font_size_1
3
'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
// .maxLines(2)
...
...
@@ -176,7 +181,7 @@ export struct ENewspaperListDialog {
if (positionItem.title) {
Text(positionItem.title)
.fontSize($r('app.float.font_size_1
7
'))
.fontSize($r('app.float.font_size_1
6
'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.margin({
...
...
@@ -187,7 +192,7 @@ export struct ENewspaperListDialog {
if (positionItem.downTitle) {
Text(positionItem.downTitle)
.fontSize($r('app.float.font_size_1
4
'))
.fontSize($r('app.float.font_size_1
3
'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.margin({
...
...
@@ -197,7 +202,7 @@ export struct ENewspaperListDialog {
}
if (positionItem.newsTxt) {
Text(positionItem.newsTxt)
.fontSize($r('app.float.font_size_1
4
'))
.fontSize($r('app.float.font_size_1
3
'))
.fontColor($r('app.color.color_999999'))
.lineHeight(25)
.margin({
...
...
sight_harmony/features/wdComponent/src/main/ets/model/MinePageDatasModel.ets
View file @
4233585
...
...
@@ -73,9 +73,9 @@ class MinePageDatasModel{
this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon')))
// this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon')))
// this.personalData.push(new MinePagePersonalFunctionsItem("留言板",$r('app.media.mine_msgboard_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("预约",$r('app.media.mine_order_icon')))
this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon')))
return this.personalData
}
...
...
sight_harmony/features/wdComponent/src/main/ets/utils/lazyloadImg.ets
View file @
4233585
import { NetworkUtil, SPHelper } from 'wdKit';
import { SpConstants } from 'wdConstant';
async function onlyWifiLoadImg()
: Promise<boolean> {
async function onlyWifiLoadImg(): Promise<boolean> {
let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false;
let isNetConnected = NetworkUtil.isNetConnected();
if (!loadImageOnlyWifiSwitch) {
// 开关没开,直接让加载图片
return true
}
let netWorkStatus = NetworkUtil.getNetworkType();
if (isNetConnected) {
if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
return true;
} else {
if (loadImageOnlyWifiSwitch) {
return false
} else {
return true;
}
}
} else {
return false;
// 开关打开,wifi下才加载图片
if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
return true
}
return false
}
export { onlyWifiLoadImg }
\ No newline at end of file
...
...
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayLivePage.ets
View file @
4233585
import { ContentDetailDTO, Live
DetailsBean, Live
RoomDataBean } from 'wdBean/Index';
import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import { TabComponent } from '../widgets/details/TabComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
...
...
@@ -6,12 +6,9 @@ import { DisplayDirection } from 'wdConstant/Index';
import mediaquery from '@ohos.mediaquery';
import { Logger, WindowModel } from 'wdKit/Index';
import { router, window } from '@kit.ArkUI';
import { devicePLSensorManager } from 'wdDetailPlayApi/Index';
import { LiveCommentComponent } from 'wdComponent/Index';
import { WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index';
import { OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView';
import { WDAliPlayerController } from 'wdPlayer/Index';
import { LiveOperRowListView } from 'wdComponent';
import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
import { ResponseDTO } from 'wdNetwork/Index';
let TAG: string = 'DetailPlayLivePage';
...
...
@@ -37,7 +34,6 @@ export struct DetailPlayLivePage {
@Consume @Watch('onBackPressCus') pageBackPress: number
@Consume contentDetailData: ContentDetailDTO
@Consume publishCommentModel: publishCommentModel
@Consume liveDetailsBean: LiveDetailsBean
aboutToAppear(): void {
Logger.info(TAG, `wyj-aboutToAppear`)
...
...
@@ -65,13 +61,15 @@ export struct DetailPlayLivePage {
build() {
Column() {
TopPlayComponent({ playerController: this.playerController })
.height(this.displayDirection == DisplayDirection.VERTICAL ?211:'100%')
.height(this.displayDirection == DisplayDirection.VERTICAL ? 211 : '100%')
TabComponent({ tabs: this.tabs, changeToTab: this.changeToTab })
.layoutWeight(1)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
OperRowListView({
componentType: 4,
LiveOperRowListView({
operationButtonList: ['comment', 'collect', 'share', 'like'],
styleType: 1,
contentDetailData: this.contentDetailData,
...
...
@@ -81,8 +79,7 @@ export struct DetailPlayLivePage {
// 切换到大家聊
this.changeToTab = Math.random()
}
})
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
}).visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
// LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
// .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
...
...
@@ -120,7 +117,9 @@ export struct DetailPlayLivePage {
}
getLiveDetails() {
const data = this.liveDetailsBean
const data = this.contentDetailData
// console.error("XXXXZZZZ", 'contentDetailData ----liveState==>' + data.liveInfo?.liveState)
// console.error("XXXXZZZZ", 'contentDetailData ----liveStyle==>' + data.liveInfo?.liveStyle)
if (data.liveInfo?.liveState == 'wait') {
//直播样式 0-正常模式 , 1-隐藏直播间,2-隐藏大家聊 【人民号发布是竖屏的,为空】
if (data.liveInfo?.liveStyle == 1) {
...
...
@@ -131,7 +130,13 @@ export struct DetailPlayLivePage {
this.tabs = ['简介', '直播间', '大家聊']
}
} else {
this.tabs = ['直播间', '大家聊']
if (data.liveInfo?.liveStyle == 1) {
this.tabs = ['大家聊']
} else if (data.liveInfo?.liveStyle == 2) {
this.tabs = ['直播间',]
} else {
this.tabs = ['直播间', '大家聊']
}
}
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/pages/DetailPlayShortVideoPage.ets
View file @
4233585
...
...
@@ -16,7 +16,7 @@ import { CommentDialogView } from '../view/CommentDialogView';
import { window } from '@kit.ArkUI';
import { PlayerFullScreenView } from '../view/PlayerFullScreenView';
import { OperRowListView, publishCommentModel } from 'wdComponent/Index';
import {ParamType,TrackConstants } from 'wdTracking/Index';
const TAG = 'DetailPlayShortVideoPage';
/**
...
...
@@ -49,6 +49,8 @@ export struct DetailPlayShortVideoPage {
@Consume showComment: boolean // 是否显示底部评论,首页视频频道传false
@State imageVisible: boolean = true
@State ratio: number = 16 / 9
pageParam: ParamType = {}
PageName: string = ''
/**
* 页面显示重查用户关注、点赞等信息
...
...
@@ -91,7 +93,7 @@ export struct DetailPlayShortVideoPage {
} else {
this.queryNewsInfoOfUser()
if (!this.playerController.getPlayer()) {
this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '');
this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || ''
,this.PageName,this.PageName,this.pageParam
);
} else {
await this.playerController.play()
this.imageVisible = false
...
...
@@ -165,9 +167,30 @@ export struct DetailPlayShortVideoPage {
}
this.queryNewsInfoOfUser()
this.contentTrackingDict()
}
contentTrackingDict(){
this.pageParam = {
'contentType': `${this.contentDetailData.newsType}`,
'contentId': `${this.contentDetailData.newsId}`,
'contentName': `${this.contentDetailData.newsTitle || ''}`,
}
if(this.contentDetailData.newsType == 1) {
this.PageName = TrackConstants.PageName.VideoDetail // 点播
} else if(this.contentDetailData.newsType == 2) {
this.PageName = TrackConstants.PageName.Live_Detail // 直播
} else if(this.contentDetailData.newsType == 5) {
this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页
} else if(this.contentDetailData.newsType == 8) {
this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页
} else if(this.contentDetailData.newsType == 9) {
this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页
} else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
}
console.log('视频详情页',JSON.stringify(this.pageParam))
console.log('视频详情页2',JSON.stringify(this.PageName))
}
async aboutToDisappear(): Promise<void> {
console.log(TAG, 'aboutToDisappear', this.index)
await this.playerController?.pause()
...
...
@@ -182,7 +205,8 @@ export struct DetailPlayShortVideoPage {
index: $index,
currentIndex: $currentIndex,
showCommentList: $showCommentList,
publishCommentModel: $publishCommentModel
publishCommentModel: $publishCommentModel,
interactData: $interactData,
})
this.playerViewBuilder()
...
...
@@ -250,7 +274,7 @@ export struct DetailPlayShortVideoPage {
playerController: this.playerController,
onLoad: async () => {
if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) {
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl);
this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl
,this.PageName,this.PageName,this.pageParam
);
}
}
})
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/CommentDialogView.ets
View file @
4233585
import { ContentDetailDTO, PageInfoDTO } from 'wdBean/Index'
import { ContentDetailDTO,
InteractDataDTO,
PageInfoDTO } from 'wdBean/Index'
import { CommentListDialogView, publishCommentModel } from 'wdComponent/Index'
...
...
@@ -9,6 +9,7 @@ export struct CommentDialogView {
@Link currentIndex: number
@Link publishCommentModel: publishCommentModel
@Consume contentDetailData: ContentDetailDTO
@Link interactData: InteractDataDTO
@State fakePageInfo: PageInfoDTO = {} as PageInfoDTO
@State dialogOffsetY: number = 0 // (this.windowHeight - this.windowWidth * 9 / 16)
...
...
@@ -34,6 +35,9 @@ export struct CommentDialogView {
pageInfo: this.fakePageInfo,
onClose: () => {
this.showCommentList = false
if (Number.parseInt(this.publishCommentModel.totalCommentNumer) > Number.parseInt(this.interactData.commentNum + "")) {
this.interactData.commentNum = Number.parseInt(this.publishCommentModel.totalCommentNumer)
}
}
})
}
...
...
sight_harmony/features/wdDetailPlayShortVideo/src/main/ets/view/PlayerRightView.ets
View file @
4233585
...
...
@@ -38,9 +38,8 @@ export struct PlayerRightView {
@Consume showCommentList: boolean
@Consume displayDirection: DisplayDirection
@Consume publishCommentModel: publishCommentModel
//
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
@State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
@State likesStyle: number | string = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
pageParam: ParamType = {}
PageName: string = ''
followUserId: string = ''
...
...
@@ -387,7 +386,7 @@ export struct PlayerRightView {
.width(32)
.aspectRatio(1)
Text(this.
transNum2String('commentNum') ||
'抢首评')
Text(this.
interactData.commentNum > 0 ? this.transNum2String('commentNum') :
'抢首评')
.width('100%')
.fontWeight(500)
.textAlign(TextAlign.Center)
...
...
sight_harmony/features/wdPlayer/oh-package.json5
View file @
4233585
...
...
@@ -8,6 +8,8 @@
"version"
:
"1.0.0"
,
"dependencies"
:
{
"wdKit"
:
"file:../../commons/wdKit"
,
"premierlibrary"
:
"file:./libs/premierlibrary.har"
"premierlibrary"
:
"file:./libs/premierlibrary.har"
,
"wdTracking"
:
"file:../wdTracking"
,
"wdBean"
:
"file:../../features/wdBean"
}
}
...
...
sight_harmony/features/wdPlayer/src/main/ets/controller/WDPlayerController.ets
View file @
4233585
...
...
@@ -3,6 +3,9 @@ import prompt from '@ohos.promptAction';
import { Logger } from '../utils/Logger';
import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';
import { BusinessError } from '@ohos.base';
import { TrackingPlay } from 'wdTracking/Index';
import { ParamType } from 'wdTracking/Index';
import { DateTimeUtils } from 'wdKit/Index';
@Observed
export class WDPlayerController {
...
...
@@ -17,6 +20,12 @@ export class WDPlayerController {
private seekTime: number = 0;
private positionY: number = 0;
private startTime: number = 0;
private pageParam: ParamType = {}
private pageName: string = ''
private creatStartTime:number = 0;//开始加载时间
private creatEndTime:number = 0;//加载完成时间
private prepareTime:number = 0; //加载时间
private currentPlayTime:number = 0; //当前播放时间
public onVideoSizeChange?: (width: number, height: number) => void;
public onTimeUpdate?: (position: number, duration: number) => void;
public onVolumeUpdate?: (volume: number) => void;
...
...
@@ -28,6 +37,9 @@ export class WDPlayerController {
public videoWidth: number = 0
public videoHeight: number = 0
constructor() {
Logger.error("初始化")
this.initPromise = this.createAVPlayer();
...
...
@@ -123,6 +135,8 @@ export class WDPlayerController {
});
this.avPlayer?.on(Events.ERROR, (error) => {
this.playError(error.message);
console.log('播放错误',JSON.stringify(error))
TrackingPlay.videoPlayError(error.message, this.pageName, this.pageName, this.pageParam)
})
this.avPlayer?.on('seekDone', (time: number) => {
this.initProgress(time);
...
...
@@ -148,8 +162,18 @@ export class WDPlayerController {
this.surfaceId = surfaceId
}
async firstPlay(url: string) {
async firstPlay(url: string
,pageId?: string, pageName?: string, pageParam?: ParamType
) {
this.url = url;
//加载时长prepareTime
this.creatStartTime = DateTimeUtils.getTimeStamp()
console.log('开始创建',JSON.stringify(this.creatStartTime))
this.prepareTime = 0
if(pageName){
this.pageName = pageName
}
if(pageParam){
this.pageParam = pageParam
}
if (this.avPlayer == null) {
Logger.error("等待")
await this.initPromise;
...
...
@@ -166,6 +190,11 @@ export class WDPlayerController {
}
Logger.error("开始播放", this.url)
this.avPlayer.url = this.url;
//加载时长prepareTime
this.creatEndTime = DateTimeUtils.getTimeStamp()
this.prepareTime = 0
this.prepareTime = Math.floor((this.creatEndTime - this.creatStartTime)/1000)
console.log('开始播放2',JSON.stringify(this.prepareTime))
}
async release() {
...
...
@@ -271,6 +300,7 @@ export class WDPlayerController {
}
if (mode === SliderChangeMode.End) {
this.seekTime = Math.floor(value * this.duration / 100);
this.currentPlayTime = this.seekTime
this.avPlayer?.seek(this.seekTime);
}
}
...
...
@@ -288,6 +318,7 @@ export class WDPlayerController {
}
initProgress(time: number) {
this.currentPlayTime=Math.floor(time / 1000);
let nowSeconds = Math.floor(time / 1000);
let totalSeconds = Math.floor(this.duration / 1000);
if (this.onTimeUpdate) {
...
...
@@ -357,6 +388,24 @@ export class WDPlayerController {
watchStatus() {
console.log('watchStatus', this.status)
if(this.status == 1){
console.log('播放视频')
console.log('播放视频prepareTime',JSON.stringify(this.prepareTime))
console.log('播放视频pageName',JSON.stringify(this.pageName))
console.log('播放视频pageParam',JSON.stringify(this.pageParam))
// 播放埋点
TrackingPlay.videoPositivePlay(Number(this.prepareTime),this.pageName, this.pageName, this.pageParam)
}
if(this.status == 2){
let initDuration = Math.floor(Number(this.duration)/1000)
console.log('播放结束')
console.log('播放结束currentPlayTime',JSON.stringify(this.currentPlayTime))
console.log('播放结束initDuration',JSON.stringify(initDuration))
console.log('播放结束pageName',JSON.stringify(this.pageName))
console.log('播放结束pageParam',JSON.stringify(this.pageParam))
// 播放结束埋点
TrackingPlay.videoPlayEnd(this.currentPlayTime, initDuration, this.currentPlayTime, this.pageName, this.pageName, this.pageParam)
}
if (this.onStatusChange) {
this.onStatusChange(this.status)
}
...
...
sight_harmony/features/wdTracking/src/main/ets/tracking/TrackingPlay.ets
View file @
4233585
...
...
@@ -25,7 +25,7 @@ export class TrackingPlay {
Tracking.event("video_positive_pybk", params)
}
// 视频 播放结束
// 视频 播放结束
currentPlayTime:当前时长,totalTime:总时长 ,browseTime:浏览时长,
static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
let params = TrackingUtils.generateParams(extParams)
if (pageId.length) {
...
...
sight_harmony/products/phone/src/main/ets/pages/view/BottomNavigationComponent.ets
View file @
4233585
...
...
@@ -7,8 +7,12 @@ import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/Mine
import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index';
import { VideoChannelPage } from './VideoChannelPage';
import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel';
import { ImageKnifeComponent, ImageKnifeOption, NONE } from '@ohos/imageknife';
const TAG = 'BottomNavigationComponent';
PersistentStorage.persistProp('channelIds', '');
PersistentStorage.persistProp('indexSettingChannelId', 2002);
let storage = LocalStorage.getShared();
/**
...
...
@@ -131,16 +135,26 @@ export struct BottomNavigationComponent {
@Builder
tabBarBuilder(navItem: BottomNavDTO, index: number) {
Stack({ alignContent: Alignment.Bottom }) {
Image(this.getBottomIcon(navItem, this.currentNavIndex === index))
.height(CommonConstants.FULL_PARENT)
// Image(this.getBottomIcon(navItem, this.currentNavIndex === index))
// .height(CommonConstants.FULL_PARENT)
// .padding({
// bottom: 15,
// left: 10,
// right: 10,
// top: 2
// })
// .aspectRatio(this.ASPECT_RATIO_1_1)
// .alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index))
ImageKnifeComponent({ imageKnifeOption: this.getBottomImageKnifeOption(navItem, this.currentNavIndex === index) })
.padding({
bottom: 15,
left: 10,
right: 10,
top: 2
})
.aspectRatio(this.ASPECT_RATIO_1_1)
.alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index))
.width('100%')
.height('100%')
.enabled(false)
Text(navItem.name)
.margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
...
...
@@ -154,6 +168,7 @@ export struct BottomNavigationComponent {
.height($r('app.float.bottom_navigation_barHeight'))
.hoverEffect(HoverEffect.Highlight)
.visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
// .hitTestBehavior(HitTestMode.Block)
.onClick(() => {
Logger.info(TAG, `onChange, index: ${index}`);
this.onBottomNavigationIndexChange(navItem, index)
...
...
@@ -161,6 +176,24 @@ export struct BottomNavigationComponent {
}
getBottomImageKnifeOption(navItem: BottomNavDTO, isSelect: boolean): ImageKnifeOption {
let defaultIcon = this.getBottomLocalIcon(navItem, isSelect)
let url = this.getBottomIcon(navItem, isSelect)
let imageKnifeOption: ImageKnifeOption = {
loadSrc: url,
// 占位图使用本地资源
placeholderSrc: defaultIcon,
// 失败占位图使用本地资源
errorholderSrc: defaultIcon,
// 是否开启一级内存缓存
isCacheable: true,
// 磁盘缓存none
strategy: new NONE()
};
return imageKnifeOption
}
private getBottomIcon(navItem: BottomNavDTO, isSelect: boolean): string | Resource {
if (!navItem) {
return ''
...
...
@@ -173,10 +206,10 @@ export struct BottomNavigationComponent {
// 获取常规icon
icon = isSelect ? navItem.iconC : navItem.icon
}
if (StringUtils.isEmpty(icon) || icon.includes('.pag')) {
// 兜底,获取预置的本地icon
return this.getBottomLocalIcon(navItem, isSelect)
}
// if (StringUtils.isEmpty(icon) || icon.includes('.pag')) {
// // 兜底,获取预置的本地icon
// return this.getBottomLocalIcon(navItem, isSelect)
// }
return icon
}
...
...
sight_harmony/products/phone/src/main/ets/pages/view/MultiPictureDetailPageComponent.ets
View file @
4233585
...
...
@@ -6,7 +6,8 @@ import {
postInteractBrowsOperateParams,
postBatchAttentionStatusParams,
postInteractAccentionOperateParams,
Params
Params,
InteractDataDTO
} from 'wdBean';
import display from '@ohos.display';
import { DateTimeUtils } from 'wdKit/Index';
...
...
@@ -59,6 +60,7 @@ export struct MultiPictureDetailPageComponent {
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
@State currentOffset: number = 0
@State duration: number = 0
@Provide interactData: InteractDataDTO = {} as InteractDataDTO
pageParam: ParamType = {}
followUserId: string = ''
followUserName: string = ''
...
...
@@ -116,7 +118,8 @@ export struct MultiPictureDetailPageComponent {
index: $index,
currentIndex: $currentIndex,
showCommentList: $showCommentList,
publishCommentModel: $publishCommentModel
publishCommentModel: $publishCommentModel,
interactData:$interactData
})
}
...
...
sight_harmony/products/phone/src/main/ets/startupmanager/StartupManager.ets
View file @
4233585
...
...
@@ -17,6 +17,7 @@ import { TrackingModule } from 'wdTracking/Index'
import { JSON } from '@kit.ArkTS'
import app from '@system.app'
import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index'
import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife'
const TAG = "[StartupManager]"
...
...
@@ -58,6 +59,14 @@ export class StartupManager {
HostManager.changeHost(spHostUrl as HostEnum)
}
// 初始化全局ImageKnife
ImageKnife.with(this.context);
let imageKnife: ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife()
if (imageKnife != undefined) {
//设置全局内存缓存大小张数
imageKnife.setLruCacheSize(100, 100 * 1204 * 1024)
}
// 友盟预初始化
this.preInitUmentStat()
...
...
Please
register
or
login
to post a comment