王士厅
@@ -89,18 +89,19 @@ export struct Card6Component { @@ -89,18 +89,19 @@ export struct Card6Component {
89 ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 : 89 ((this.contentDTO.newTags?.length > 0 || this.contentDTO.seoTags?.length > 0) || this.contentDTO.objectType == '5') ? 35 :
90 0 ) 90 0 )
91 }.alignContent(Alignment.TopStart) 91 }.alignContent(Alignment.TopStart)
  92 + // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 60: 156)
92 93
93 } 94 }
94 .justifyContent(FlexAlign.Start) 95 .justifyContent(FlexAlign.Start)
95 -  
96 Blank() 96 Blank()
97 //bottom 评论等信息 97 //bottom 评论等信息
98 CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO }) 98 CardSourceInfo({ compDTO: this.compDTO, contentDTO: this.contentDTO })
  99 +
99 } 100 }
100 .alignItems(HorizontalAlign.Start) 101 .alignItems(HorizontalAlign.Start)
101 .justifyContent(FlexAlign.Start) 102 .justifyContent(FlexAlign.Start)
102 .width('64%') 103 .width('64%')
103 - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) 104 +
104 105
105 Stack({alignContent: Alignment.BottomEnd}) { 106 Stack({alignContent: Alignment.BottomEnd}) {
106 Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '') 107 Image(this.loadImg ? this.contentDTO.coverUrl || this.contentDTO.fullColumnImgUrls?.[0]?.url || this.contentDTO.fullColumnImgUrls?.[0]?.fullUrl : '')
@@ -110,6 +111,7 @@ export struct Card6Component { @@ -110,6 +111,7 @@ export struct Card6Component {
110 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) 111 .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156)
111 CardMediaInfo({ contentDTO: this.contentDTO }) 112 CardMediaInfo({ contentDTO: this.contentDTO })
112 } 113 }
  114 +
113 } 115 }
114 .onClick((event: ClickEvent) => { 116 .onClick((event: ClickEvent) => {
115 InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName) 117 InfomationCardClick.track(this.compDTO, this.contentDTO, this.pageId, this.pageName)
@@ -123,6 +125,7 @@ export struct Card6Component { @@ -123,6 +125,7 @@ export struct Card6Component {
123 top: $r('app.float.card_comp_pagePadding_tb'), 125 top: $r('app.float.card_comp_pagePadding_tb'),
124 bottom: $r('app.float.card_comp_pagePadding_tb') 126 bottom: $r('app.float.card_comp_pagePadding_tb')
125 }) 127 })
  128 +
126 .width(CommonConstants.FULL_WIDTH) 129 .width(CommonConstants.FULL_WIDTH)
127 // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) 130 // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217)
128 .justifyContent(FlexAlign.SpaceBetween) 131 .justifyContent(FlexAlign.SpaceBetween)
@@ -3,7 +3,7 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' @@ -3,7 +3,7 @@ import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
3 import { WDRouterRule } from 'wdRouter/Index' 3 import { WDRouterRule } from 'wdRouter/Index'
4 import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog' 4 import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'
5 import { Logger } from 'wdKit'; 5 import { Logger } from 'wdKit';
6 -import { window } from '@kit.ArkUI'; 6 +import { font, window } from '@kit.ArkUI';
7 7
8 /** 8 /**
9 * 读报纸半屏弹窗 9 * 读报纸半屏弹窗
@@ -56,6 +56,11 @@ export struct ENewspaperListDialog { @@ -56,6 +56,11 @@ export struct ENewspaperListDialog {
56 } 56 }
57 57
58 async aboutToAppear() { 58 async aboutToAppear() {
  59 + //注册字体
  60 + font.registerFont({
  61 + familyName: 'BebasNeueBold',
  62 + familySrc: $rawfile('font/BebasNeueBold.otf')
  63 + })
59 // 屏幕高度 - 滑动高度计算 64 // 屏幕高度 - 滑动高度计算
60 let windowClass: window.Window = await window.getLastWindow(getContext(this)); 65 let windowClass: window.Window = await window.getLastWindow(getContext(this));
61 let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height) 66 let changeHeight = 85 + 44 + px2vp(windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).topRect.height)
@@ -151,7 +156,7 @@ export struct ENewspaperListDialog { @@ -151,7 +156,7 @@ export struct ENewspaperListDialog {
151 Column() { 156 Column() {
152 if (itemIndex == 0) { 157 if (itemIndex == 0) {
153 Text(item.pageNum + '版:' + item.pageName) 158 Text(item.pageNum + '版:' + item.pageName)
154 - .fontSize($r('app.float.font_size_14')) 159 + .fontSize($r('app.float.font_size_13'))
155 .fontColor($r('app.color.color_ED2800')) 160 .fontColor($r('app.color.color_ED2800'))
156 .fontWeight(600) 161 .fontWeight(600)
157 .width('100%') 162 .width('100%')
@@ -165,7 +170,7 @@ export struct ENewspaperListDialog { @@ -165,7 +170,7 @@ export struct ENewspaperListDialog {
165 Column() { 170 Column() {
166 if (positionItem.shortTitle) { 171 if (positionItem.shortTitle) {
167 Text(positionItem.shortTitle) 172 Text(positionItem.shortTitle)
168 - .fontSize($r('app.float.font_size_14')) 173 + .fontSize($r('app.float.font_size_13'))
169 .fontColor($r('app.color.color_222222')) 174 .fontColor($r('app.color.color_222222'))
170 .fontWeight(600) 175 .fontWeight(600)
171 // .maxLines(2) 176 // .maxLines(2)
@@ -176,7 +181,7 @@ export struct ENewspaperListDialog { @@ -176,7 +181,7 @@ export struct ENewspaperListDialog {
176 181
177 if (positionItem.title) { 182 if (positionItem.title) {
178 Text(positionItem.title) 183 Text(positionItem.title)
179 - .fontSize($r('app.float.font_size_17')) 184 + .fontSize($r('app.float.font_size_16'))
180 .fontColor($r('app.color.color_222222')) 185 .fontColor($r('app.color.color_222222'))
181 .fontWeight(600) 186 .fontWeight(600)
182 .margin({ 187 .margin({
@@ -187,7 +192,7 @@ export struct ENewspaperListDialog { @@ -187,7 +192,7 @@ export struct ENewspaperListDialog {
187 192
188 if (positionItem.downTitle) { 193 if (positionItem.downTitle) {
189 Text(positionItem.downTitle) 194 Text(positionItem.downTitle)
190 - .fontSize($r('app.float.font_size_14')) 195 + .fontSize($r('app.float.font_size_13'))
191 .fontColor($r('app.color.color_222222')) 196 .fontColor($r('app.color.color_222222'))
192 .fontWeight(600) 197 .fontWeight(600)
193 .margin({ 198 .margin({
@@ -197,7 +202,7 @@ export struct ENewspaperListDialog { @@ -197,7 +202,7 @@ export struct ENewspaperListDialog {
197 } 202 }
198 if (positionItem.newsTxt) { 203 if (positionItem.newsTxt) {
199 Text(positionItem.newsTxt) 204 Text(positionItem.newsTxt)
200 - .fontSize($r('app.float.font_size_14')) 205 + .fontSize($r('app.float.font_size_13'))
201 .fontColor($r('app.color.color_999999')) 206 .fontColor($r('app.color.color_999999'))
202 .lineHeight(25) 207 .lineHeight(25)
203 .margin({ 208 .margin({
1 import { NetworkUtil, SPHelper } from 'wdKit'; 1 import { NetworkUtil, SPHelper } from 'wdKit';
2 import { SpConstants } from 'wdConstant'; 2 import { SpConstants } from 'wdConstant';
3 3
4 -async function onlyWifiLoadImg() : Promise<boolean> { 4 +async function onlyWifiLoadImg(): Promise<boolean> {
5 let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false; 5 let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_IMAGE_SWITCH, '') || false;
6 - let isNetConnected = NetworkUtil.isNetConnected(); 6 + if (!loadImageOnlyWifiSwitch) {
  7 + // 开关没开,直接让加载图片
  8 + return true
  9 + }
7 let netWorkStatus = NetworkUtil.getNetworkType(); 10 let netWorkStatus = NetworkUtil.getNetworkType();
8 -  
9 - if (isNetConnected) {  
10 - if (netWorkStatus === NetworkUtil.TYPE_WIFI) {  
11 - return true;  
12 - } else {  
13 - if (loadImageOnlyWifiSwitch) {  
14 - return false  
15 - } else {  
16 - return true;  
17 - }  
18 - }  
19 - } else {  
20 - return false; 11 + // 开关打开,wifi下才加载图片
  12 + if (netWorkStatus === NetworkUtil.TYPE_WIFI) {
  13 + return true
21 } 14 }
  15 + return false
22 } 16 }
23 17
24 export { onlyWifiLoadImg } 18 export { onlyWifiLoadImg }
@@ -16,7 +16,7 @@ import { CommentDialogView } from '../view/CommentDialogView'; @@ -16,7 +16,7 @@ import { CommentDialogView } from '../view/CommentDialogView';
16 import { window } from '@kit.ArkUI'; 16 import { window } from '@kit.ArkUI';
17 import { PlayerFullScreenView } from '../view/PlayerFullScreenView'; 17 import { PlayerFullScreenView } from '../view/PlayerFullScreenView';
18 import { OperRowListView, publishCommentModel } from 'wdComponent/Index'; 18 import { OperRowListView, publishCommentModel } from 'wdComponent/Index';
19 - 19 +import {ParamType,TrackConstants } from 'wdTracking/Index';
20 const TAG = 'DetailPlayShortVideoPage'; 20 const TAG = 'DetailPlayShortVideoPage';
21 21
22 /** 22 /**
@@ -49,6 +49,8 @@ export struct DetailPlayShortVideoPage { @@ -49,6 +49,8 @@ export struct DetailPlayShortVideoPage {
49 @Consume showComment: boolean // 是否显示底部评论,首页视频频道传false 49 @Consume showComment: boolean // 是否显示底部评论,首页视频频道传false
50 @State imageVisible: boolean = true 50 @State imageVisible: boolean = true
51 @State ratio: number = 16 / 9 51 @State ratio: number = 16 / 9
  52 + pageParam: ParamType = {}
  53 + PageName: string = ''
52 54
53 /** 55 /**
54 * 页面显示重查用户关注、点赞等信息 56 * 页面显示重查用户关注、点赞等信息
@@ -91,7 +93,7 @@ export struct DetailPlayShortVideoPage { @@ -91,7 +93,7 @@ export struct DetailPlayShortVideoPage {
91 } else { 93 } else {
92 this.queryNewsInfoOfUser() 94 this.queryNewsInfoOfUser()
93 if (!this.playerController.getPlayer()) { 95 if (!this.playerController.getPlayer()) {
94 - this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || ''); 96 + this.playerController.firstPlay(this.contentDetailData?.videoInfo[0]?.videoUrl || '',this.PageName,this.PageName,this.pageParam);
95 } else { 97 } else {
96 await this.playerController.play() 98 await this.playerController.play()
97 this.imageVisible = false 99 this.imageVisible = false
@@ -165,9 +167,30 @@ export struct DetailPlayShortVideoPage { @@ -165,9 +167,30 @@ export struct DetailPlayShortVideoPage {
165 } 167 }
166 this.queryNewsInfoOfUser() 168 this.queryNewsInfoOfUser()
167 169
168 - 170 + this.contentTrackingDict()
  171 + }
  172 + contentTrackingDict(){
  173 + this.pageParam = {
  174 + 'contentType': `${this.contentDetailData.newsType}`,
  175 + 'contentId': `${this.contentDetailData.newsId}`,
  176 + 'contentName': `${this.contentDetailData.newsTitle || ''}`,
  177 + }
  178 + if(this.contentDetailData.newsType == 1) {
  179 + this.PageName = TrackConstants.PageName.VideoDetail // 点播
  180 + } else if(this.contentDetailData.newsType == 2) {
  181 + this.PageName = TrackConstants.PageName.Live_Detail // 直播
  182 + } else if(this.contentDetailData.newsType == 5) {
  183 + this.PageName = TrackConstants.PageName.Summary_Detail // 专题详情页
  184 + } else if(this.contentDetailData.newsType == 8) {
  185 + this.PageName = TrackConstants.PageName.Article_Detail // 图文详情页
  186 + } else if(this.contentDetailData.newsType == 9) {
  187 + this.PageName = TrackConstants.PageName.Atlas_Detail // 图集详情页
  188 + } else if(this.contentDetailData.newsType == 14 || this.contentDetailData.newsType == 15) {
  189 + this.PageName = TrackConstants.PageName.DynamicDetail // 动态图文/动态视频
  190 + }
  191 + console.log('视频详情页',JSON.stringify(this.pageParam))
  192 + console.log('视频详情页2',JSON.stringify(this.PageName))
169 } 193 }
170 -  
171 async aboutToDisappear(): Promise<void> { 194 async aboutToDisappear(): Promise<void> {
172 console.log(TAG, 'aboutToDisappear', this.index) 195 console.log(TAG, 'aboutToDisappear', this.index)
173 await this.playerController?.pause() 196 await this.playerController?.pause()
@@ -251,7 +274,7 @@ export struct DetailPlayShortVideoPage { @@ -251,7 +274,7 @@ export struct DetailPlayShortVideoPage {
251 playerController: this.playerController, 274 playerController: this.playerController,
252 onLoad: async () => { 275 onLoad: async () => {
253 if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) { 276 if (this.contentDetailData != null && this.contentDetailData?.videoInfo[0] != null) {
254 - this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl); 277 + this.playerController.firstPlay(this.contentDetailData.videoInfo[0].videoUrl,this.PageName,this.PageName,this.pageParam);
255 } 278 }
256 } 279 }
257 }) 280 })
@@ -38,9 +38,8 @@ export struct PlayerRightView { @@ -38,9 +38,8 @@ export struct PlayerRightView {
38 @Consume showCommentList: boolean 38 @Consume showCommentList: boolean
39 @Consume displayDirection: DisplayDirection 39 @Consume displayDirection: DisplayDirection
40 @Consume publishCommentModel: publishCommentModel 40 @Consume publishCommentModel: publishCommentModel
41 - // @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空 41 + @State likesStyle: number | string = 1 // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空
42 @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以 42 @State openLikes: boolean = false // 是否可以点赞 1:可以 0:不可以
43 - @State likesStyle: number | string = this.contentDetailData.likesStyle // 赞样式 1红心(点赞) 2大拇指(祈福) 3蜡烛(默哀) 4置空  
44 pageParam: ParamType = {} 43 pageParam: ParamType = {}
45 PageName: string = '' 44 PageName: string = ''
46 followUserId: string = '' 45 followUserId: string = ''
@@ -8,6 +8,8 @@ @@ -8,6 +8,8 @@
8 "version": "1.0.0", 8 "version": "1.0.0",
9 "dependencies": { 9 "dependencies": {
10 "wdKit": "file:../../commons/wdKit", 10 "wdKit": "file:../../commons/wdKit",
11 - "premierlibrary": "file:./libs/premierlibrary.har" 11 + "premierlibrary": "file:./libs/premierlibrary.har",
  12 + "wdTracking": "file:../wdTracking",
  13 + "wdBean": "file:../../features/wdBean"
12 } 14 }
13 } 15 }
@@ -3,6 +3,9 @@ import prompt from '@ohos.promptAction'; @@ -3,6 +3,9 @@ import prompt from '@ohos.promptAction';
3 import { Logger } from '../utils/Logger'; 3 import { Logger } from '../utils/Logger';
4 import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants'; 4 import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants';
5 import { BusinessError } from '@ohos.base'; 5 import { BusinessError } from '@ohos.base';
  6 +import { TrackingPlay } from 'wdTracking/Index';
  7 +import { ParamType } from 'wdTracking/Index';
  8 +import { DateTimeUtils } from 'wdKit/Index';
6 9
7 @Observed 10 @Observed
8 export class WDPlayerController { 11 export class WDPlayerController {
@@ -17,6 +20,12 @@ export class WDPlayerController { @@ -17,6 +20,12 @@ export class WDPlayerController {
17 private seekTime: number = 0; 20 private seekTime: number = 0;
18 private positionY: number = 0; 21 private positionY: number = 0;
19 private startTime: number = 0; 22 private startTime: number = 0;
  23 + private pageParam: ParamType = {}
  24 + private pageName: string = ''
  25 + private creatStartTime:number = 0;//开始加载时间
  26 + private creatEndTime:number = 0;//加载完成时间
  27 + private prepareTime:number = 0; //加载时间
  28 + private currentPlayTime:number = 0; //当前播放时间
20 public onVideoSizeChange?: (width: number, height: number) => void; 29 public onVideoSizeChange?: (width: number, height: number) => void;
21 public onTimeUpdate?: (position: number, duration: number) => void; 30 public onTimeUpdate?: (position: number, duration: number) => void;
22 public onVolumeUpdate?: (volume: number) => void; 31 public onVolumeUpdate?: (volume: number) => void;
@@ -28,6 +37,9 @@ export class WDPlayerController { @@ -28,6 +37,9 @@ export class WDPlayerController {
28 public videoWidth: number = 0 37 public videoWidth: number = 0
29 public videoHeight: number = 0 38 public videoHeight: number = 0
30 39
  40 +
  41 +
  42 +
31 constructor() { 43 constructor() {
32 Logger.error("初始化") 44 Logger.error("初始化")
33 this.initPromise = this.createAVPlayer(); 45 this.initPromise = this.createAVPlayer();
@@ -123,6 +135,8 @@ export class WDPlayerController { @@ -123,6 +135,8 @@ export class WDPlayerController {
123 }); 135 });
124 this.avPlayer?.on(Events.ERROR, (error) => { 136 this.avPlayer?.on(Events.ERROR, (error) => {
125 this.playError(error.message); 137 this.playError(error.message);
  138 + console.log('播放错误',JSON.stringify(error))
  139 + TrackingPlay.videoPlayError(error.message, this.pageName, this.pageName, this.pageParam)
126 }) 140 })
127 this.avPlayer?.on('seekDone', (time: number) => { 141 this.avPlayer?.on('seekDone', (time: number) => {
128 this.initProgress(time); 142 this.initProgress(time);
@@ -148,8 +162,18 @@ export class WDPlayerController { @@ -148,8 +162,18 @@ export class WDPlayerController {
148 this.surfaceId = surfaceId 162 this.surfaceId = surfaceId
149 } 163 }
150 164
151 - async firstPlay(url: string) { 165 + async firstPlay(url: string,pageId?: string, pageName?: string, pageParam?: ParamType) {
152 this.url = url; 166 this.url = url;
  167 + //加载时长prepareTime
  168 + this.creatStartTime = DateTimeUtils.getTimeStamp()
  169 + console.log('开始创建',JSON.stringify(this.creatStartTime))
  170 + this.prepareTime = 0
  171 + if(pageName){
  172 + this.pageName = pageName
  173 + }
  174 + if(pageParam){
  175 + this.pageParam = pageParam
  176 + }
153 if (this.avPlayer == null) { 177 if (this.avPlayer == null) {
154 Logger.error("等待") 178 Logger.error("等待")
155 await this.initPromise; 179 await this.initPromise;
@@ -166,6 +190,11 @@ export class WDPlayerController { @@ -166,6 +190,11 @@ export class WDPlayerController {
166 } 190 }
167 Logger.error("开始播放", this.url) 191 Logger.error("开始播放", this.url)
168 this.avPlayer.url = this.url; 192 this.avPlayer.url = this.url;
  193 + //加载时长prepareTime
  194 + this.creatEndTime = DateTimeUtils.getTimeStamp()
  195 + this.prepareTime = 0
  196 + this.prepareTime = Math.floor((this.creatEndTime - this.creatStartTime)/1000)
  197 + console.log('开始播放2',JSON.stringify(this.prepareTime))
169 } 198 }
170 199
171 async release() { 200 async release() {
@@ -271,6 +300,7 @@ export class WDPlayerController { @@ -271,6 +300,7 @@ export class WDPlayerController {
271 } 300 }
272 if (mode === SliderChangeMode.End) { 301 if (mode === SliderChangeMode.End) {
273 this.seekTime = Math.floor(value * this.duration / 100); 302 this.seekTime = Math.floor(value * this.duration / 100);
  303 + this.currentPlayTime = this.seekTime
274 this.avPlayer?.seek(this.seekTime); 304 this.avPlayer?.seek(this.seekTime);
275 } 305 }
276 } 306 }
@@ -288,6 +318,7 @@ export class WDPlayerController { @@ -288,6 +318,7 @@ export class WDPlayerController {
288 } 318 }
289 319
290 initProgress(time: number) { 320 initProgress(time: number) {
  321 + this.currentPlayTime=Math.floor(time / 1000);
291 let nowSeconds = Math.floor(time / 1000); 322 let nowSeconds = Math.floor(time / 1000);
292 let totalSeconds = Math.floor(this.duration / 1000); 323 let totalSeconds = Math.floor(this.duration / 1000);
293 if (this.onTimeUpdate) { 324 if (this.onTimeUpdate) {
@@ -357,6 +388,24 @@ export class WDPlayerController { @@ -357,6 +388,24 @@ export class WDPlayerController {
357 388
358 watchStatus() { 389 watchStatus() {
359 console.log('watchStatus', this.status) 390 console.log('watchStatus', this.status)
  391 + if(this.status == 1){
  392 + console.log('播放视频')
  393 + console.log('播放视频prepareTime',JSON.stringify(this.prepareTime))
  394 + console.log('播放视频pageName',JSON.stringify(this.pageName))
  395 + console.log('播放视频pageParam',JSON.stringify(this.pageParam))
  396 + // 播放埋点
  397 + TrackingPlay.videoPositivePlay(Number(this.prepareTime),this.pageName, this.pageName, this.pageParam)
  398 + }
  399 + if(this.status == 2){
  400 + let initDuration = Math.floor(Number(this.duration)/1000)
  401 + console.log('播放结束')
  402 + console.log('播放结束currentPlayTime',JSON.stringify(this.currentPlayTime))
  403 + console.log('播放结束initDuration',JSON.stringify(initDuration))
  404 + console.log('播放结束pageName',JSON.stringify(this.pageName))
  405 + console.log('播放结束pageParam',JSON.stringify(this.pageParam))
  406 + // 播放结束埋点
  407 + TrackingPlay.videoPlayEnd(this.currentPlayTime, initDuration, this.currentPlayTime, this.pageName, this.pageName, this.pageParam)
  408 + }
360 if (this.onStatusChange) { 409 if (this.onStatusChange) {
361 this.onStatusChange(this.status) 410 this.onStatusChange(this.status)
362 } 411 }
@@ -25,7 +25,7 @@ export class TrackingPlay { @@ -25,7 +25,7 @@ export class TrackingPlay {
25 Tracking.event("video_positive_pybk", params) 25 Tracking.event("video_positive_pybk", params)
26 } 26 }
27 27
28 - // 视频 播放结束 28 + // 视频 播放结束 currentPlayTime:当前时长,totalTime:总时长 ,browseTime:浏览时长,
29 static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) { 29 static videoPlayEnd(currentPlayTime: number, totalTime: number, browseTime: number, pageId: string, pageName: string, extParams: ParamType) {
30 let params = TrackingUtils.generateParams(extParams) 30 let params = TrackingUtils.generateParams(extParams)
31 if (pageId.length) { 31 if (pageId.length) {
@@ -13,7 +13,8 @@ @@ -13,7 +13,8 @@
13 "@ohos/pulltorefresh": "^2.0.5", 13 "@ohos/pulltorefresh": "^2.0.5",
14 "@mpaas/udid": "0.0.2", 14 "@mpaas/udid": "0.0.2",
15 "@mpaas/upgrade": "0.0.2", 15 "@mpaas/upgrade": "0.0.2",
16 - "@mpaas/framework": "0.0.2" 16 + "@mpaas/framework": "0.0.2",
  17 + "@ohos/imageknife": "^2.1.2"
17 }, 18 },
18 "dynamicDependencies": {} 19 "dynamicDependencies": {}
19 } 20 }
@@ -7,6 +7,7 @@ import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/Mine @@ -7,6 +7,7 @@ import { MinePageComponent } from 'wdComponent/src/main/ets/components/page/Mine
7 import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index'; 7 import { CompUtils, TopNavigationComponent, TopNavigationComponentNew } from 'wdComponent/Index';
8 import { VideoChannelPage } from './VideoChannelPage'; 8 import { VideoChannelPage } from './VideoChannelPage';
9 import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel'; 9 import ChannelViewModel from 'wdComponent/src/main/ets/viewmodel/ChannelViewModel';
  10 +import { ImageKnifeComponent, ImageKnifeOption, NONE } from '@ohos/imageknife';
10 11
11 const TAG = 'BottomNavigationComponent'; 12 const TAG = 'BottomNavigationComponent';
12 PersistentStorage.persistProp('channelIds', ''); 13 PersistentStorage.persistProp('channelIds', '');
@@ -134,16 +135,26 @@ export struct BottomNavigationComponent { @@ -134,16 +135,26 @@ export struct BottomNavigationComponent {
134 @Builder 135 @Builder
135 tabBarBuilder(navItem: BottomNavDTO, index: number) { 136 tabBarBuilder(navItem: BottomNavDTO, index: number) {
136 Stack({ alignContent: Alignment.Bottom }) { 137 Stack({ alignContent: Alignment.Bottom }) {
137 - Image(this.getBottomIcon(navItem, this.currentNavIndex === index))  
138 - .height(CommonConstants.FULL_PARENT) 138 + // Image(this.getBottomIcon(navItem, this.currentNavIndex === index))
  139 + // .height(CommonConstants.FULL_PARENT)
  140 + // .padding({
  141 + // bottom: 15,
  142 + // left: 10,
  143 + // right: 10,
  144 + // top: 2
  145 + // })
  146 + // .aspectRatio(this.ASPECT_RATIO_1_1)
  147 + // .alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index))
  148 + ImageKnifeComponent({ imageKnifeOption: this.getBottomImageKnifeOption(navItem, this.currentNavIndex === index) })
139 .padding({ 149 .padding({
140 bottom: 15, 150 bottom: 15,
141 left: 10, 151 left: 10,
142 right: 10, 152 right: 10,
143 top: 2 153 top: 2
144 }) 154 })
145 - .aspectRatio(this.ASPECT_RATIO_1_1)  
146 - .alt(this.getBottomLocalIcon(navItem, this.currentNavIndex === index)) 155 + .width('100%')
  156 + .height('100%')
  157 + .enabled(false)
147 158
148 Text(navItem.name) 159 Text(navItem.name)
149 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') }) 160 .margin({ bottom: $r('app.float.bottom_navigation_margin_bottom') })
@@ -157,6 +168,7 @@ export struct BottomNavigationComponent { @@ -157,6 +168,7 @@ export struct BottomNavigationComponent {
157 .height($r('app.float.bottom_navigation_barHeight')) 168 .height($r('app.float.bottom_navigation_barHeight'))
158 .hoverEffect(HoverEffect.Highlight) 169 .hoverEffect(HoverEffect.Highlight)
159 .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) 170 .visibility(this.displayDirection === DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
  171 + // .hitTestBehavior(HitTestMode.Block)
160 .onClick(() => { 172 .onClick(() => {
161 Logger.info(TAG, `onChange, index: ${index}`); 173 Logger.info(TAG, `onChange, index: ${index}`);
162 this.onBottomNavigationIndexChange(navItem, index) 174 this.onBottomNavigationIndexChange(navItem, index)
@@ -164,6 +176,24 @@ export struct BottomNavigationComponent { @@ -164,6 +176,24 @@ export struct BottomNavigationComponent {
164 176
165 } 177 }
166 178
  179 + getBottomImageKnifeOption(navItem: BottomNavDTO, isSelect: boolean): ImageKnifeOption {
  180 + let defaultIcon = this.getBottomLocalIcon(navItem, isSelect)
  181 + let url = this.getBottomIcon(navItem, isSelect)
  182 +
  183 + let imageKnifeOption: ImageKnifeOption = {
  184 + loadSrc: url,
  185 + // 占位图使用本地资源
  186 + placeholderSrc: defaultIcon,
  187 + // 失败占位图使用本地资源
  188 + errorholderSrc: defaultIcon,
  189 + // 是否开启一级内存缓存
  190 + isCacheable: true,
  191 + // 磁盘缓存none
  192 + strategy: new NONE()
  193 + };
  194 + return imageKnifeOption
  195 + }
  196 +
167 private getBottomIcon(navItem: BottomNavDTO, isSelect: boolean): string | Resource { 197 private getBottomIcon(navItem: BottomNavDTO, isSelect: boolean): string | Resource {
168 if (!navItem) { 198 if (!navItem) {
169 return '' 199 return ''
@@ -176,10 +206,10 @@ export struct BottomNavigationComponent { @@ -176,10 +206,10 @@ export struct BottomNavigationComponent {
176 // 获取常规icon 206 // 获取常规icon
177 icon = isSelect ? navItem.iconC : navItem.icon 207 icon = isSelect ? navItem.iconC : navItem.icon
178 } 208 }
179 - if (StringUtils.isEmpty(icon) || icon.includes('.pag')) {  
180 - // 兜底,获取预置的本地icon  
181 - return this.getBottomLocalIcon(navItem, isSelect)  
182 - } 209 + // if (StringUtils.isEmpty(icon) || icon.includes('.pag')) {
  210 + // // 兜底,获取预置的本地icon
  211 + // return this.getBottomLocalIcon(navItem, isSelect)
  212 + // }
183 return icon 213 return icon
184 } 214 }
185 215
@@ -17,6 +17,7 @@ import { TrackingModule } from 'wdTracking/Index' @@ -17,6 +17,7 @@ import { TrackingModule } from 'wdTracking/Index'
17 import { JSON } from '@kit.ArkTS' 17 import { JSON } from '@kit.ArkTS'
18 import app from '@system.app' 18 import app from '@system.app'
19 import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index' 19 import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index'
  20 +import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife'
20 21
21 const TAG = "[StartupManager]" 22 const TAG = "[StartupManager]"
22 23
@@ -58,6 +59,14 @@ export class StartupManager { @@ -58,6 +59,14 @@ export class StartupManager {
58 HostManager.changeHost(spHostUrl as HostEnum) 59 HostManager.changeHost(spHostUrl as HostEnum)
59 } 60 }
60 61
  62 + // 初始化全局ImageKnife
  63 + ImageKnife.with(this.context);
  64 + let imageKnife: ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife()
  65 + if (imageKnife != undefined) {
  66 + //设置全局内存缓存大小张数
  67 + imageKnife.setLruCacheSize(100, 100 * 1204 * 1024)
  68 + }
  69 +
61 // 友盟预初始化 70 // 友盟预初始化
62 this.preInitUmentStat() 71 this.preInitUmentStat()
63 72