Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
57 changed files
with
599 additions
and
220 deletions
| @@ -171,6 +171,24 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | @@ -171,6 +171,24 @@ export class LazyDataSource<T> extends BasicDataSource<T> { | ||
| 171 | } | 171 | } |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | + // 删除index指定索引位置的元素 | ||
| 175 | + public deleteItems(startIndex: number, count?: number): void { | ||
| 176 | + if (startIndex < 0) { | ||
| 177 | + return | ||
| 178 | + } | ||
| 179 | + this.dataArray.splice(startIndex, count || (this.dataArray.length - startIndex)); | ||
| 180 | + let to = 0 | ||
| 181 | + if (count == undefined) { | ||
| 182 | + to = this.dataArray.length - 1 | ||
| 183 | + } else { | ||
| 184 | + to = count + startIndex | ||
| 185 | + if (to >= this.dataArray.length) { | ||
| 186 | + to = this.dataArray.length - 1; | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + this.notifyDataMove(startIndex, to); | ||
| 190 | + } | ||
| 191 | + | ||
| 174 | // 删除最后1个元素 | 192 | // 删除最后1个元素 |
| 175 | public pop(): void { | 193 | public pop(): void { |
| 176 | this.deleteItem() | 194 | this.deleteItem() |
| @@ -42,23 +42,23 @@ export class HttpParams { | @@ -42,23 +42,23 @@ export class HttpParams { | ||
| 42 | switch (HostManager.getHost()) { | 42 | switch (HostManager.getHost()) { |
| 43 | case HostEnum.HOST_UAT: | 43 | case HostEnum.HOST_UAT: |
| 44 | headers['X-Ca-Stage'] = 'PRE' | 44 | headers['X-Ca-Stage'] = 'PRE' |
| 45 | - headers['Authorization'] = 'APPCODE 83092caa603a421aa0222308b3f6b27a' | ||
| 46 | - headers['appCode'] = '83092caa603a421aa0222308b3f6b27a' | 45 | + headers['Authorization'] = 'APPCODE 5e1b07c336ac48ae90794fc4d69beaf9' |
| 46 | + headers['appCode'] = '5e1b07c336ac48ae90794fc4d69beaf9' | ||
| 47 | break | 47 | break |
| 48 | case HostEnum.HOST_SIT: | 48 | case HostEnum.HOST_SIT: |
| 49 | headers['X-Ca-Stage'] = 'TEST' | 49 | headers['X-Ca-Stage'] = 'TEST' |
| 50 | - headers['Authorization'] = 'APPCODE 0af1f9085e484c97b2a44704bae72c07' | ||
| 51 | - headers['appCode'] = '0af1f9085e484c97b2a44704bae72c07' | 50 | + headers['Authorization'] = 'APPCODE b7d32f50747d456d8c84ae51f3baaf56' |
| 51 | + headers['appCode'] = 'b7d32f50747d456d8c84ae51f3baaf56' | ||
| 52 | break | 52 | break |
| 53 | case HostEnum.HOST_PRODUCT: | 53 | case HostEnum.HOST_PRODUCT: |
| 54 | headers['X-Ca-Stage'] = 'RELEASE' | 54 | headers['X-Ca-Stage'] = 'RELEASE' |
| 55 | - headers['Authorization'] = 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6' | ||
| 56 | - headers['appCode'] = '3d4181bceeb94d9780e10dbb6c67bbf6' | 55 | + headers['Authorization'] = 'APPCODE c148017260324c3ba7e612757e8146c1' |
| 56 | + headers['appCode'] = 'c148017260324c3ba7e612757e8146c1' | ||
| 57 | break | 57 | break |
| 58 | case HostEnum.HOST_DEV: | 58 | case HostEnum.HOST_DEV: |
| 59 | headers['X-Ca-Stage'] = 'TEST' | 59 | headers['X-Ca-Stage'] = 'TEST' |
| 60 | - headers['Authorization'] = 'APPCODE ff33172859e14f9a8299e3bd769e79f9' | ||
| 61 | - headers['appCode'] = 'ff33172859e14f9a8299e3bd769e79f9' | 60 | + headers['Authorization'] = 'APPCODE 9272b6a5ad0549a0ab399d0011109793' |
| 61 | + headers['appCode'] = '9272b6a5ad0549a0ab399d0011109793' | ||
| 62 | break | 62 | break |
| 63 | default: | 63 | default: |
| 64 | break | 64 | break |
| @@ -82,26 +82,7 @@ export class HttpParams { | @@ -82,26 +82,7 @@ export class HttpParams { | ||
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | private static getVersion() { | 84 | private static getVersion() { |
| 85 | - // TODO | 85 | + // TODO build时间,待对接build生成属性 |
| 86 | return '202401242103'; | 86 | return '202401242103'; |
| 87 | } | 87 | } |
| 88 | - | ||
| 89 | - private static getVersionCode() { | ||
| 90 | - // TODO | ||
| 91 | - return '10000'; | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - public static getVersionName() { | ||
| 95 | - // TODO 读取配置 | ||
| 96 | - return '1.0.0'; | ||
| 97 | - } | ||
| 98 | - | ||
| 99 | - //获取机型 | ||
| 100 | - static getPhoneModel() { | ||
| 101 | - return 'getPhoneModel' | ||
| 102 | - } | ||
| 103 | - //获取当前手机系统版本号 | ||
| 104 | - static getSystemVersion() { | ||
| 105 | - return 'getSystemVersion' | ||
| 106 | - } | ||
| 107 | } | 88 | } |
| @@ -20,6 +20,7 @@ | @@ -20,6 +20,7 @@ | ||
| 20 | "wdJsBridge": "file:../../commons/wdJsBridge", | 20 | "wdJsBridge": "file:../../commons/wdJsBridge", |
| 21 | "wdDetailPlayApi": "file:../../features/wdDetailPlayApi", | 21 | "wdDetailPlayApi": "file:../../features/wdDetailPlayApi", |
| 22 | "wdHwAbility": "file:../../features/wdHwAbility", | 22 | "wdHwAbility": "file:../../features/wdHwAbility", |
| 23 | - "wdShare": "file:../../features/wdShare" | 23 | + "wdShare": "file:../../features/wdShare", |
| 24 | + "wdTracking": "file:../../features/wdTracking" | ||
| 24 | } | 25 | } |
| 25 | } | 26 | } |
| @@ -321,6 +321,7 @@ export struct ENewspaperPageComponent { | @@ -321,6 +321,7 @@ export struct ENewspaperPageComponent { | ||
| 321 | if (this.isOpenListDialog) { | 321 | if (this.isOpenListDialog) { |
| 322 | ENewspaperListDialog({ | 322 | ENewspaperListDialog({ |
| 323 | newspaperListBean: this.newspaperListBean, | 323 | newspaperListBean: this.newspaperListBean, |
| 324 | + scrollIndex: this.swiperIndex, | ||
| 324 | closeDialog: () => { | 325 | closeDialog: () => { |
| 325 | this.isOpenListDialog = false | 326 | this.isOpenListDialog = false |
| 326 | } | 327 | } |
| 1 | import { FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; | 1 | import { FeedbackTypeBean, PhotoListBean } from 'wdBean/Index'; |
| 2 | -import { FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 2 | +import { AppUtils, |
| 3 | + DeviceUtil, | ||
| 4 | + FastClickUtil, Logger, NetworkUtil, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index'; | ||
| 3 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 5 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 4 | import { CustomTitleUI } from './reusable/CustomTitleUI' | 6 | import { CustomTitleUI } from './reusable/CustomTitleUI' |
| 5 | import { picker } from '@kit.CoreFileKit'; | 7 | import { picker } from '@kit.CoreFileKit'; |
| @@ -8,7 +10,6 @@ import { router } from '@kit.ArkUI'; | @@ -8,7 +10,6 @@ import { router } from '@kit.ArkUI'; | ||
| 8 | import { CommonConstants } from 'wdConstant/Index'; | 10 | import { CommonConstants } from 'wdConstant/Index'; |
| 9 | import { ProcessUtils } from 'wdRouter/Index'; | 11 | import { ProcessUtils } from 'wdRouter/Index'; |
| 10 | import { HashMap } from '@kit.ArkTS'; | 12 | import { HashMap } from '@kit.ArkTS'; |
| 11 | -import { HttpParams } from 'wdNetwork/src/main/ets/http/HttpCommonParams'; | ||
| 12 | 13 | ||
| 13 | const TAG = 'FeedBackActivity' | 14 | const TAG = 'FeedBackActivity' |
| 14 | 15 | ||
| @@ -355,8 +356,8 @@ export struct FeedBackActivity { | @@ -355,8 +356,8 @@ export struct FeedBackActivity { | ||
| 355 | map.set("userName", UserDataLocal.getUserName()); | 356 | map.set("userName", UserDataLocal.getUserName()); |
| 356 | } | 357 | } |
| 357 | //设备 | 358 | //设备 |
| 358 | - map.set("appVersion", "V" + HttpParams.getVersionName()); | ||
| 359 | - map.set("appDevice", "harmony" + HttpParams.getSystemVersion() + " " + HttpParams.getPhoneModel()); | 359 | + map.set("appVersion", "V" + AppUtils.getAppVersionName()); |
| 360 | + map.set("appDevice", "harmony" + DeviceUtil.getDisplayVersion() + " " + DeviceUtil.getProductModel()); | ||
| 360 | // //投诉图片 | 361 | // //投诉图片 |
| 361 | // if (imageUrl.size() > 0) { | 362 | // if (imageUrl.size() > 0) { |
| 362 | // String[] str = imageUrl.toArray(new String[imageUrl.size()]); | 363 | // String[] str = imageUrl.toArray(new String[imageUrl.size()]); |
| @@ -244,8 +244,10 @@ export struct MorningEveningPaperComponent { | @@ -244,8 +244,10 @@ export struct MorningEveningPaperComponent { | ||
| 244 | topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject }) | 244 | topicInfoView({ frontLinkObject: this.pageInfoBean?.topicInfo?.frontLinkObject }) |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | - ListItem() { | ||
| 248 | - this.AudioBarView(this.simpleAudioDialog) | 247 | + if (this.audioPlayUrl.length > 0){ |
| 248 | + ListItem() { | ||
| 249 | + this.AudioBarView(this.simpleAudioDialog) | ||
| 250 | + } | ||
| 249 | } | 251 | } |
| 250 | } | 252 | } |
| 251 | 253 |
| @@ -39,7 +39,7 @@ export struct topicInfoView { | @@ -39,7 +39,7 @@ export struct topicInfoView { | ||
| 39 | .borderRadius(2) | 39 | .borderRadius(2) |
| 40 | .padding({ left: 6, top: 4, bottom: 4 }) | 40 | .padding({ left: 6, top: 4, bottom: 4 }) |
| 41 | 41 | ||
| 42 | - Image($r('app.media.more'))// .height($r('app.float.top_arrow_size')) | 42 | + Image($r('app.media.more_w'))// .height($r('app.float.top_arrow_size')) |
| 43 | .width(12) | 43 | .width(12) |
| 44 | .height(12) | 44 | .height(12) |
| 45 | .margin({ left: 4, right: 7 }) | 45 | .margin({ left: 4, right: 7 }) |
| @@ -90,9 +90,6 @@ export struct SpacialTopicPageComponent { | @@ -90,9 +90,6 @@ export struct SpacialTopicPageComponent { | ||
| 90 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') | 90 | this.publishCommentModel.targetType = String(this.contentDetailData?.newsType || '') |
| 91 | this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') | 91 | this.publishCommentModel.visitorComment = String(this.contentDetailData?.visitorComment || '') |
| 92 | // } | 92 | // } |
| 93 | - if (this.contentDetailData[0]?.openComment) { | ||
| 94 | - this.operationButtonList = ['collect', 'share'] | ||
| 95 | - } | ||
| 96 | this.trySendData2H5() | 93 | this.trySendData2H5() |
| 97 | } | 94 | } |
| 98 | } | 95 | } |
| 1 | import { CompDTO } from 'wdBean/Index'; | 1 | import { CompDTO } from 'wdBean/Index'; |
| 2 | import { DateTimeUtils, Logger } from 'wdKit/Index'; | 2 | import { DateTimeUtils, Logger } from 'wdKit/Index'; |
| 3 | +import { PageHelper } from '../../viewmodel/PageHelper'; | ||
| 3 | import PageModel from '../../viewmodel/PageModel'; | 4 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| @@ -61,6 +62,7 @@ export struct CardAdvBottom { | @@ -61,6 +62,7 @@ export struct CardAdvBottom { | ||
| 61 | } | 62 | } |
| 62 | if (currentIndex >= 0) { | 63 | if (currentIndex >= 0) { |
| 63 | this.pageModel.compList.deleteItem(currentIndex) | 64 | this.pageModel.compList.deleteItem(currentIndex) |
| 65 | + PageHelper.updateFirstPageEndIndex(this.pageModel, true, currentIndex) | ||
| 64 | } | 66 | } |
| 65 | } | 67 | } |
| 66 | } | 68 | } |
| 1 | import { CompDTO } from 'wdBean/Index'; | 1 | import { CompDTO } from 'wdBean/Index'; |
| 2 | import { DateTimeUtils, Logger } from 'wdKit/Index'; | 2 | import { DateTimeUtils, Logger } from 'wdKit/Index'; |
| 3 | +import {PageHelper} from '../../viewmodel/PageHelper'; | ||
| 3 | import PageModel from '../../viewmodel/PageModel'; | 4 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| @@ -73,6 +74,7 @@ export struct CardAdvTop { | @@ -73,6 +74,7 @@ export struct CardAdvTop { | ||
| 73 | } | 74 | } |
| 74 | if (currentIndex >= 0) { | 75 | if (currentIndex >= 0) { |
| 75 | this.pageModel.compList.deleteItem(currentIndex) | 76 | this.pageModel.compList.deleteItem(currentIndex) |
| 77 | + PageHelper.updateFirstPageEndIndex(this.pageModel, true, currentIndex) | ||
| 76 | } | 78 | } |
| 77 | } | 79 | } |
| 78 | } | 80 | } |
| @@ -58,6 +58,7 @@ export struct Card15Component { | @@ -58,6 +58,7 @@ export struct Card15Component { | ||
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | .fontSize($r('app.float.font_size_18')) | 60 | .fontSize($r('app.float.font_size_18')) |
| 61 | + .lineHeight(26) | ||
| 61 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 62 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 62 | .width(CommonConstants.FULL_WIDTH) | 63 | .width(CommonConstants.FULL_WIDTH) |
| 63 | .textOverflowStyle(2) | 64 | .textOverflowStyle(2) |
| @@ -92,7 +92,7 @@ export struct Card6Component { | @@ -92,7 +92,7 @@ export struct Card6Component { | ||
| 92 | .alignItems(HorizontalAlign.Start) | 92 | .alignItems(HorizontalAlign.Start) |
| 93 | .justifyContent(FlexAlign.Start) | 93 | .justifyContent(FlexAlign.Start) |
| 94 | .width('64%') | 94 | .width('64%') |
| 95 | - .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) | 95 | + .height(this.contentDTO.appStyle === CompStyle.Card_13 ? '' : 156) |
| 96 | 96 | ||
| 97 | Stack() { | 97 | Stack() { |
| 98 | Image(this.loadImg ? this.contentDTO.coverUrl : '') | 98 | Image(this.loadImg ? this.contentDTO.coverUrl : '') |
| @@ -102,7 +102,6 @@ export struct Card6Component { | @@ -102,7 +102,6 @@ export struct Card6Component { | ||
| 102 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) | 102 | .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 78 : 156) |
| 103 | CardMediaInfo({ contentDTO: this.contentDTO }) | 103 | CardMediaInfo({ contentDTO: this.contentDTO }) |
| 104 | } | 104 | } |
| 105 | - .alignContent(Alignment.BottomEnd) | ||
| 106 | } | 105 | } |
| 107 | .onClick((event: ClickEvent) => { | 106 | .onClick((event: ClickEvent) => { |
| 108 | this.clicked = true; | 107 | this.clicked = true; |
| @@ -118,5 +117,6 @@ export struct Card6Component { | @@ -118,5 +117,6 @@ export struct Card6Component { | ||
| 118 | .width(CommonConstants.FULL_WIDTH) | 117 | .width(CommonConstants.FULL_WIDTH) |
| 119 | // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) | 118 | // .height(this.contentDTO.appStyle === CompStyle.Card_13 ? 107 : 217) |
| 120 | .justifyContent(FlexAlign.SpaceBetween) | 119 | .justifyContent(FlexAlign.SpaceBetween) |
| 120 | + .alignItems(VerticalAlign.Top) | ||
| 121 | } | 121 | } |
| 122 | } | 122 | } |
| @@ -99,6 +99,7 @@ export struct CommentTabComponent { | @@ -99,6 +99,7 @@ export struct CommentTabComponent { | ||
| 99 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 99 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 100 | }) | 100 | }) |
| 101 | .id("Image") | 101 | .id("Image") |
| 102 | + .visibility(this.contentDetail.appstyle !== 9 ? Visibility.Visible : Visibility.Hidden) | ||
| 102 | } | 103 | } |
| 103 | Text(this.placeHolder) | 104 | Text(this.placeHolder) |
| 104 | .fontSize(12) | 105 | .fontSize(12) |
| @@ -110,11 +111,13 @@ export struct CommentTabComponent { | @@ -110,11 +111,13 @@ export struct CommentTabComponent { | ||
| 110 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 111 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 111 | }) | 112 | }) |
| 112 | .id("Text") | 113 | .id("Text") |
| 114 | + .visibility(this.contentDetail.appstyle !== 9 ? Visibility.Visible : Visibility.Hidden) | ||
| 113 | } | 115 | } |
| 114 | } | 116 | } |
| 115 | } | 117 | } |
| 116 | .height(30) | 118 | .height(30) |
| 117 | .onClick(() => { | 119 | .onClick(() => { |
| 120 | + if(this.contentDetail.appstyle === 9) return | ||
| 118 | this.onCommentFocus && this.onCommentFocus() | 121 | this.onCommentFocus && this.onCommentFocus() |
| 119 | 122 | ||
| 120 | this.publishCommentModel.rootCommentId = '-1'; | 123 | this.publishCommentModel.rootCommentId = '-1'; |
| @@ -134,6 +137,7 @@ export struct CommentIconComponent { | @@ -134,6 +137,7 @@ export struct CommentIconComponent { | ||
| 134 | @ObjectLink publishCommentModel: publishCommentModel | 137 | @ObjectLink publishCommentModel: publishCommentModel |
| 135 | /*展示类型*/ | 138 | /*展示类型*/ |
| 136 | @State type: number = 1 | 139 | @State type: number = 1 |
| 140 | + @Prop contentDetail: ContentDetailDTO | ||
| 137 | styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) | 141 | styleType: number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏) |
| 138 | // aboutToAppear(): void { | 142 | // aboutToAppear(): void { |
| 139 | // setTimeout(() => { | 143 | // setTimeout(() => { |
| @@ -206,7 +210,10 @@ export struct CommentIconComponent { | @@ -206,7 +210,10 @@ export struct CommentIconComponent { | ||
| 206 | 210 | ||
| 207 | } | 211 | } |
| 208 | } | 212 | } |
| 209 | - }.width(24).height(24) | 213 | + } |
| 214 | + .width(24) | ||
| 215 | + .height(24) | ||
| 216 | + .visibility(this.contentDetail.appstyle !== 9 ? Visibility.Visible : Visibility.Hidden) | ||
| 210 | 217 | ||
| 211 | // .backgroundColor(Color.Blue) | 218 | // .backgroundColor(Color.Blue) |
| 212 | } | 219 | } |
| @@ -2,6 +2,7 @@ import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel | @@ -2,6 +2,7 @@ import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel | ||
| 2 | import { WDRouterRule, WDRouterPage, ProcessUtils } from 'wdRouter' | 2 | import { WDRouterRule, WDRouterPage, ProcessUtils } from 'wdRouter' |
| 3 | import { Params } from 'wdBean'; | 3 | import { Params } from 'wdBean'; |
| 4 | import { ToastUtils } from 'wdKit/Index'; | 4 | import { ToastUtils } from 'wdKit/Index'; |
| 5 | +import { TrackingButton, TrackConstants } from 'wdTracking/Index'; | ||
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| 7 | export default struct MinePageMoreFunctionUI { | 8 | export default struct MinePageMoreFunctionUI { |
| @@ -70,13 +71,16 @@ export default struct MinePageMoreFunctionUI { | @@ -70,13 +71,16 @@ export default struct MinePageMoreFunctionUI { | ||
| 70 | .onClick(() => { | 71 | .onClick(() => { |
| 71 | console.log(index + "") | 72 | console.log(index + "") |
| 72 | if (item.msg == "设置") { //设置 | 73 | if (item.msg == "设置") { //设置 |
| 74 | + trackButtonClick("myPageUserSetting") | ||
| 73 | let params: Params = { | 75 | let params: Params = { |
| 74 | pageID: 'mainSetting' | 76 | pageID: 'mainSetting' |
| 75 | } | 77 | } |
| 76 | WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) | 78 | WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) |
| 77 | }else if (item.msg == "关于") { // 关于 | 79 | }else if (item.msg == "关于") { // 关于 |
| 80 | + trackButtonClick("myPageUserAbout") | ||
| 78 | WDRouterRule.jumpWithPage(WDRouterPage.aboutPage) | 81 | WDRouterRule.jumpWithPage(WDRouterPage.aboutPage) |
| 79 | }else if (item.msg == "意见反馈") { // 关于 | 82 | }else if (item.msg == "意见反馈") { // 关于 |
| 83 | + trackButtonClick("myPageUserFeedBack") | ||
| 80 | ProcessUtils.gotoFeedBackActivity() | 84 | ProcessUtils.gotoFeedBackActivity() |
| 81 | } | 85 | } |
| 82 | }) | 86 | }) |
| @@ -90,4 +94,8 @@ export default struct MinePageMoreFunctionUI { | @@ -90,4 +94,8 @@ export default struct MinePageMoreFunctionUI { | ||
| 90 | .borderRadius(8) | 94 | .borderRadius(8) |
| 91 | .margin({ left: '23lpx', right: '23lpx', top: "19lpx" }) | 95 | .margin({ left: '23lpx', right: '23lpx', top: "19lpx" }) |
| 92 | } | 96 | } |
| 97 | +} | ||
| 98 | + | ||
| 99 | +function trackButtonClick(buttonName: string){ | ||
| 100 | + TrackingButton.click(buttonName, TrackConstants.PageName.My, TrackConstants.PageName.My) | ||
| 93 | } | 101 | } |
| 1 | import { WDRouterRule, WDRouterPage } from 'wdRouter' | 1 | import { WDRouterRule, WDRouterPage } from 'wdRouter' |
| 2 | +import { TrackConstants } from 'wdTracking/src/main/ets/common/TrackConstants' | ||
| 3 | +import { TrackingButton } from 'wdTracking/src/main/ets/tracking/TrackingButton' | ||
| 2 | import MinePageDatasModel from '../../model/MinePageDatasModel' | 4 | import MinePageDatasModel from '../../model/MinePageDatasModel' |
| 3 | import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' | 5 | import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem' |
| 4 | import { PagePersonFunction } from './PagePersonFunction' | 6 | import { PagePersonFunction } from './PagePersonFunction' |
| @@ -25,6 +27,7 @@ export default struct MinePagePersonFunctionUI { | @@ -25,6 +27,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 25 | }else { | 27 | }else { |
| 26 | let params: Record<string, string> = {'comment': "1"}; | 28 | let params: Record<string, string> = {'comment': "1"}; |
| 27 | WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage,params) | 29 | WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage,params) |
| 30 | + trackButtonClick("myPageUserComment") | ||
| 28 | } | 31 | } |
| 29 | break; | 32 | break; |
| 30 | } | 33 | } |
| @@ -33,6 +36,7 @@ export default struct MinePagePersonFunctionUI { | @@ -33,6 +36,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 33 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 36 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 34 | return | 37 | return |
| 35 | } | 38 | } |
| 39 | + trackButtonClick("myPageUserSubscribe") | ||
| 36 | WDRouterRule.jumpWithPage(WDRouterPage.appointmentListPage) | 40 | WDRouterRule.jumpWithPage(WDRouterPage.appointmentListPage) |
| 37 | break; | 41 | break; |
| 38 | } | 42 | } |
| @@ -42,6 +46,7 @@ export default struct MinePagePersonFunctionUI { | @@ -42,6 +46,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 42 | return | 46 | return |
| 43 | } | 47 | } |
| 44 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage) | 48 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage) |
| 49 | + trackButtonClick("myPageUserFollow") | ||
| 45 | break; | 50 | break; |
| 46 | } | 51 | } |
| 47 | case "收藏":{ | 52 | case "收藏":{ |
| @@ -50,6 +55,7 @@ export default struct MinePagePersonFunctionUI { | @@ -50,6 +55,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 50 | return | 55 | return |
| 51 | } | 56 | } |
| 52 | WDRouterRule.jumpWithPage(WDRouterPage.myCollectionListPagePage) | 57 | WDRouterRule.jumpWithPage(WDRouterPage.myCollectionListPagePage) |
| 58 | + trackButtonClick("myPageUserCollection") | ||
| 53 | break; | 59 | break; |
| 54 | } | 60 | } |
| 55 | case "历史":{ | 61 | case "历史":{ |
| @@ -66,6 +72,7 @@ export default struct MinePagePersonFunctionUI { | @@ -66,6 +72,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 66 | return | 72 | return |
| 67 | } | 73 | } |
| 68 | this.messageClick() | 74 | this.messageClick() |
| 75 | + trackButtonClick("myPageUserNotice") | ||
| 69 | WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) | 76 | WDRouterRule.jumpWithPage(WDRouterPage.mineMessagePage) |
| 70 | break; | 77 | break; |
| 71 | } | 78 | } |
| @@ -89,3 +96,7 @@ export default struct MinePagePersonFunctionUI { | @@ -89,3 +96,7 @@ export default struct MinePagePersonFunctionUI { | ||
| 89 | } | 96 | } |
| 90 | } | 97 | } |
| 91 | 98 | ||
| 99 | +function trackButtonClick(buttonName: string){ | ||
| 100 | + TrackingButton.click(buttonName, TrackConstants.PageName.My, TrackConstants.PageName.My) | ||
| 101 | +} | ||
| 102 | + |
| 1 | import { StringUtils, UserDataLocal } from 'wdKit' | 1 | import { StringUtils, UserDataLocal } from 'wdKit' |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter' | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter' |
| 3 | +import { TrackingButton, TrackConstants } from 'wdTracking/Index' | ||
| 3 | import MinePageDatasModel from '../../model/MinePageDatasModel' | 4 | import MinePageDatasModel from '../../model/MinePageDatasModel' |
| 4 | const TAG = "MinePageUserSimpleInfoUI" | 5 | const TAG = "MinePageUserSimpleInfoUI" |
| 5 | 6 | ||
| @@ -45,6 +46,7 @@ export default struct MinePageUserSimpleInfoUI { | @@ -45,6 +46,7 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 45 | .alignContent(Alignment.Center) | 46 | .alignContent(Alignment.Center) |
| 46 | .onClick(()=>{ | 47 | .onClick(()=>{ |
| 47 | this.jumpLogin() | 48 | this.jumpLogin() |
| 49 | + trackButtonClick("myPageUserHead") | ||
| 48 | }) | 50 | }) |
| 49 | 51 | ||
| 50 | if(this.isLogin){ | 52 | if(this.isLogin){ |
| @@ -68,6 +70,7 @@ export default struct MinePageUserSimpleInfoUI { | @@ -68,6 +70,7 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 68 | }.width('100%') | 70 | }.width('100%') |
| 69 | .onClick(()=>{ | 71 | .onClick(()=>{ |
| 70 | this.jumpLogin() | 72 | this.jumpLogin() |
| 73 | + trackButtonClick("myPageUserName") | ||
| 71 | }) | 74 | }) |
| 72 | 75 | ||
| 73 | Stack(){ | 76 | Stack(){ |
| @@ -101,6 +104,7 @@ export default struct MinePageUserSimpleInfoUI { | @@ -101,6 +104,7 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 101 | Blank() | 104 | Blank() |
| 102 | }.onClick(()=>{ | 105 | }.onClick(()=>{ |
| 103 | this.jumpLogin() | 106 | this.jumpLogin() |
| 107 | + trackButtonClick("myPageUserLogin") | ||
| 104 | }) | 108 | }) |
| 105 | .margin({top:'11lpx',left:'23lpx'}) | 109 | .margin({top:'11lpx',left:'23lpx'}) |
| 106 | .width('352lpx') | 110 | .width('352lpx') |
| @@ -198,3 +202,7 @@ export default struct MinePageUserSimpleInfoUI { | @@ -198,3 +202,7 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 198 | } | 202 | } |
| 199 | } | 203 | } |
| 200 | } | 204 | } |
| 205 | + | ||
| 206 | +function trackButtonClick(buttonName: string){ | ||
| 207 | + TrackingButton.click(buttonName, TrackConstants.PageName.My, TrackConstants.PageName.My) | ||
| 208 | +} |
| 1 | import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index' | 1 | import { DateTimeUtils, StringUtils, ToastUtils } from 'wdKit/Index' |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 3 | -import { WDMessageCenterMessageType } from '../../../model/InteractMessageModel' | 3 | +import { Remark, WDMessageCenterMessageType } from '../../../model/InteractMessageModel' |
| 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 5 | import { MessageItem } from '../../../viewmodel/MessageItem' | 5 | import { MessageItem } from '../../../viewmodel/MessageItem' |
| 6 | import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' | 6 | import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh' |
| @@ -66,6 +66,24 @@ export struct MessageListUI { | @@ -66,6 +66,24 @@ export struct MessageListUI { | ||
| 66 | if (value.activeInfo.title) { | 66 | if (value.activeInfo.title) { |
| 67 | item.desc = value.activeInfo.title.replace("null","") | 67 | item.desc = value.activeInfo.title.replace("null","") |
| 68 | } | 68 | } |
| 69 | + let remark = JSON.parse(value.activeInfo.remark) as Remark | ||
| 70 | + switch (value.activeInfo.contentType){ | ||
| 71 | + case "204": | ||
| 72 | + item.desc = remark.userName + "关注了你" | ||
| 73 | + break; | ||
| 74 | + case "206": | ||
| 75 | + item.desc = remark.userName +"赞了你的作品" | ||
| 76 | + break; | ||
| 77 | + case "207": | ||
| 78 | + item.desc = remark.userName + "赞了你的评论" | ||
| 79 | + break; | ||
| 80 | + case "208": | ||
| 81 | + item.desc = remark.userName + "评论了你的作品" | ||
| 82 | + break; | ||
| 83 | + case "209": | ||
| 84 | + item.desc = remark.userName + "回复了你的评论" | ||
| 85 | + break; | ||
| 86 | + } | ||
| 69 | if (value.activeInfo.time) { | 87 | if (value.activeInfo.time) { |
| 70 | item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.activeInfo.time) + "") | 88 | item.time = this.getPublishTime(value.subscribeInfo.time,DateTimeUtils.getDateTimestamp(value.activeInfo.time) + "") |
| 71 | } | 89 | } |
| 1 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 2 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 1 | import { AppointmentListUI } from '../mine/appointment/AppointmentListUI' | 3 | import { AppointmentListUI } from '../mine/appointment/AppointmentListUI' |
| 2 | 4 | ||
| 3 | const TAG = "AppointmentListPage" | 5 | const TAG = "AppointmentListPage" |
| @@ -5,6 +7,19 @@ const TAG = "AppointmentListPage" | @@ -5,6 +7,19 @@ const TAG = "AppointmentListPage" | ||
| 5 | @Entry | 7 | @Entry |
| 6 | @Component | 8 | @Component |
| 7 | struct AppointmentListPage { | 9 | struct AppointmentListPage { |
| 10 | + pageShowTime:number = 0; | ||
| 11 | + pageHideTime:number = 0; | ||
| 12 | + | ||
| 13 | + onPageShow() { | ||
| 14 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 15 | + } | ||
| 16 | + | ||
| 17 | + onPageHide(): void { | ||
| 18 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 19 | + let duration = 0 | ||
| 20 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 21 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.My_Saved_Live,TrackConstants.PageName.My_Saved_Live,duration) | ||
| 22 | + } | ||
| 8 | 23 | ||
| 9 | build() { | 24 | build() { |
| 10 | Column(){ | 25 | Column(){ |
| @@ -73,7 +73,7 @@ export struct BottomNavigationComponent { | @@ -73,7 +73,7 @@ export struct BottomNavigationComponent { | ||
| 73 | TabContent() { | 73 | TabContent() { |
| 74 | if (CompUtils.isMine(navItem)) { | 74 | if (CompUtils.isMine(navItem)) { |
| 75 | // 我的页面组件数据列表 | 75 | // 我的页面组件数据列表 |
| 76 | - MinePageComponent() | 76 | + MinePageComponent({isMinePage: this.currentNavIndex === this.bottomNavList.length-1}) |
| 77 | } else if (navItem.name === '视频') { | 77 | } else if (navItem.name === '视频') { |
| 78 | // 视频频道,包含视频和直播 | 78 | // 视频频道,包含视频和直播 |
| 79 | VideoChannelPage({ | 79 | VideoChannelPage({ |
| @@ -424,7 +424,7 @@ export struct PaperSingleColumn999CardView { | @@ -424,7 +424,7 @@ export struct PaperSingleColumn999CardView { | ||
| 424 | Text(this.item?.newsTitle) | 424 | Text(this.item?.newsTitle) |
| 425 | .fontColor('#222222') | 425 | .fontColor('#222222') |
| 426 | .fontSize(16) | 426 | .fontSize(16) |
| 427 | - .fontWeight(FontWeight.Bold) | 427 | + .fontWeight(FontWeight.Medium) |
| 428 | .alignSelf(ItemAlign.Start) | 428 | .alignSelf(ItemAlign.Start) |
| 429 | .maxLines(3) | 429 | .maxLines(3) |
| 430 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 430 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| @@ -478,17 +478,21 @@ export struct PaperSingleColumn999CardView { | @@ -478,17 +478,21 @@ export struct PaperSingleColumn999CardView { | ||
| 478 | if (this.item) { | 478 | if (this.item) { |
| 479 | Row() { | 479 | Row() { |
| 480 | Row() { | 480 | Row() { |
| 481 | - Text(this.item?.source) | ||
| 482 | - .fontSize(12) | ||
| 483 | - .fontColor('#B0B0B0') | ||
| 484 | - .margin({ left: 16 }) | ||
| 485 | - Image($r('app.media.point')) | ||
| 486 | - .width(16) | ||
| 487 | - .height(16) | ||
| 488 | - .margin({ top: 10, bottom: 10 }) | 481 | + if (this.item?.source.length > 0) { |
| 482 | + Text(this.item?.source) | ||
| 483 | + .fontSize(12) | ||
| 484 | + .fontColor('#B0B0B0') | ||
| 485 | + .margin({ left: 16 }) | ||
| 486 | + Image($r('app.media.point')) | ||
| 487 | + .width(16) | ||
| 488 | + .height(16) | ||
| 489 | + .margin({ top: 10, bottom: 10 }) | ||
| 490 | + } | ||
| 491 | + | ||
| 489 | Text(this.getPublishTime()) | 492 | Text(this.getPublishTime()) |
| 490 | .fontSize(12) | 493 | .fontSize(12) |
| 491 | .fontColor('#B0B0B0') | 494 | .fontColor('#B0B0B0') |
| 495 | + .margin({ left: this.item?.source.length > 0?0:16 }) | ||
| 492 | if (this.item.objectType != '2' && this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) { | 496 | if (this.item.objectType != '2' && this.interactData && this.interactData.commentNum && Number(this.interactData.collectNum) > 0) { |
| 493 | Text(this.interactData.commentNum + "评") | 497 | Text(this.interactData.commentNum + "评") |
| 494 | .fontSize(12) | 498 | .fontSize(12) |
| 1 | import { Params } from 'wdBean'; | 1 | import { Params } from 'wdBean'; |
| 2 | import { FollowFirstTabsComponent } from '../mine/follow/FollowFirstTabsComponent' | 2 | import { FollowFirstTabsComponent } from '../mine/follow/FollowFirstTabsComponent' |
| 3 | import router from '@ohos.router'; | 3 | import router from '@ohos.router'; |
| 4 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 5 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 4 | 6 | ||
| 5 | @Entry | 7 | @Entry |
| 6 | @Component | 8 | @Component |
| 7 | struct FollowListPage { | 9 | struct FollowListPage { |
| 8 | @State params:Record<string, string> = router.getParams() as Record<string, string>; | 10 | @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 9 | @State curIndex: string = '0'; | 11 | @State curIndex: string = '0'; |
| 12 | + pageShowTime:number = 0; | ||
| 13 | + pageHideTime:number = 0; | ||
| 10 | 14 | ||
| 11 | onPageShow() { | 15 | onPageShow() { |
| 12 | this.curIndex = this.params?.['index']; | 16 | this.curIndex = this.params?.['index']; |
| 17 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + onPageHide(): void { | ||
| 21 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 22 | + let duration = 0 | ||
| 23 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 24 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.My_Follow,TrackConstants.PageName.My_Follow,duration) | ||
| 13 | } | 25 | } |
| 14 | 26 | ||
| 15 | build() { | 27 | build() { |
| @@ -5,10 +5,12 @@ import MinePageDatasModel from '../../model/MinePageDatasModel' | @@ -5,10 +5,12 @@ import MinePageDatasModel from '../../model/MinePageDatasModel' | ||
| 5 | import MinePageUserSimpleInfoUI from '../mine/MinePageUserSimpleInfoUI' | 5 | import MinePageUserSimpleInfoUI from '../mine/MinePageUserSimpleInfoUI' |
| 6 | import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI' | 6 | import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI' |
| 7 | import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI' | 7 | import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI' |
| 8 | -import { SPHelper, StringUtils } from 'wdKit' | 8 | +import { DateTimeUtils, SPHelper, StringUtils } from 'wdKit' |
| 9 | import { SpConstants } from 'wdConstant' | 9 | import { SpConstants } from 'wdConstant' |
| 10 | import dataPreferences from '@ohos.data.preferences'; | 10 | import dataPreferences from '@ohos.data.preferences'; |
| 11 | import { MergeRecordDialog } from '../../dialog/MergeRecordDialog' | 11 | import { MergeRecordDialog } from '../../dialog/MergeRecordDialog' |
| 12 | +import { TrackingPageBrowse } from 'wdTracking/src/main/ets/tracking/TrackingPageBrowse' | ||
| 13 | +import { TrackConstants } from 'wdTracking/src/main/ets/common/TrackConstants' | ||
| 12 | 14 | ||
| 13 | const TAG = 'MinePageComponent'; | 15 | const TAG = 'MinePageComponent'; |
| 14 | 16 | ||
| @@ -51,13 +53,36 @@ export struct MinePageComponent { | @@ -51,13 +53,36 @@ export struct MinePageComponent { | ||
| 51 | alignment: DialogAlignment.Center, | 53 | alignment: DialogAlignment.Center, |
| 52 | autoCancel: false | 54 | autoCancel: false |
| 53 | }) | 55 | }) |
| 54 | - @Consume @Watch('pageShowForUpdateData') pageShow :number | ||
| 55 | - | 56 | + @Consume @Watch('pageShowForUpdateData') pageShow :number |
| 57 | + @Consume @Watch('pageHideForUpdateData') pageHide :number | ||
| 58 | + pageShowTime:number = 0; | ||
| 59 | + pageHideTime:number = 0; | ||
| 60 | + pageFirstCreateTime:number = 0; | ||
| 61 | + @Prop isMinePage:boolean = false; | ||
| 62 | + | ||
| 63 | + //第一次还没创建时候 pageShow 接收不到监听 | ||
| 56 | pageShowForUpdateData(): void { | 64 | pageShowForUpdateData(): void { |
| 57 | - this.getMessageData() | 65 | + if(this.isMinePage){ |
| 66 | + this.getMessageData() | ||
| 67 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + pageHideForUpdateData(): void { | ||
| 71 | + if(this.isMinePage){ | ||
| 72 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 73 | + let duration = 0 | ||
| 74 | + if(this.pageShowTime != 0){ | ||
| 75 | + duration = (this.pageHideTime - this.pageShowTime)/1000 | ||
| 76 | + }else{ | ||
| 77 | + duration = (this.pageHideTime - this.pageFirstCreateTime)/1000 | ||
| 78 | + } | ||
| 79 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.My,TrackConstants.PageName.My,Math.floor(duration)) | ||
| 80 | + } | ||
| 58 | } | 81 | } |
| 59 | 82 | ||
| 60 | aboutToAppear(){ | 83 | aboutToAppear(){ |
| 84 | + this.pageFirstCreateTime = DateTimeUtils.getTimeStamp() | ||
| 85 | + | ||
| 61 | this.getUserLogin() | 86 | this.getUserLogin() |
| 62 | this.getFunctionData() | 87 | this.getFunctionData() |
| 63 | this.addLoginStatusObserver() | 88 | this.addLoginStatusObserver() |
| 1 | -import { PermissionUtil } from 'wdKit' | 1 | +import { DateTimeUtils, PermissionUtil } from 'wdKit' |
| 2 | import { PrivacySettingModel } from '../../model/PrivacySettingModel' | 2 | import { PrivacySettingModel } from '../../model/PrivacySettingModel' |
| 3 | import { Params } from 'wdBean'; | 3 | import { Params } from 'wdBean'; |
| 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 5 | import { HttpUtils } from 'wdNetwork/Index'; | 5 | import { HttpUtils } from 'wdNetwork/Index'; |
| 6 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 6 | 7 | ||
| 7 | const TAG = 'PrivacySettingPage'; | 8 | const TAG = 'PrivacySettingPage'; |
| 8 | const DiyString = '开启个性化推荐' | 9 | const DiyString = '开启个性化推荐' |
| @@ -15,9 +16,19 @@ export struct PrivacySettingPage { | @@ -15,9 +16,19 @@ export struct PrivacySettingPage { | ||
| 15 | tips: string = '设置前可查阅' | 16 | tips: string = '设置前可查阅' |
| 16 | privacyTips: string = '《隐私政策》' | 17 | privacyTips: string = '《隐私政策》' |
| 17 | tipsEnd = '中相应权限使用规则' | 18 | tipsEnd = '中相应权限使用规则' |
| 19 | + pageShowTime:number = 0; | ||
| 20 | + pageHideTime:number = 0; | ||
| 18 | 21 | ||
| 19 | onPageShow(): void { | 22 | onPageShow(): void { |
| 20 | this.getPermissionStatus(); | 23 | this.getPermissionStatus(); |
| 24 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + onPageHide(): void { | ||
| 28 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 29 | + let duration = 0 | ||
| 30 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 31 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Privacy_Setting,TrackConstants.PageName.Privacy_Setting,duration) | ||
| 21 | } | 32 | } |
| 22 | 33 | ||
| 23 | aboutToAppear() { | 34 | aboutToAppear() { |
| 1 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 2 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 1 | import { AboutPageUI } from '../setting/AboutPageUI'; | 3 | import { AboutPageUI } from '../setting/AboutPageUI'; |
| 2 | 4 | ||
| 3 | @Entry | 5 | @Entry |
| 4 | @Component | 6 | @Component |
| 5 | struct SettingAboutPage { | 7 | struct SettingAboutPage { |
| 8 | + pageShowTime:number = 0; | ||
| 9 | + pageHideTime:number = 0; | ||
| 10 | + | ||
| 11 | + onPageShow() { | ||
| 12 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + onPageHide(): void { | ||
| 16 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 17 | + let duration = 0 | ||
| 18 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 19 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.About,TrackConstants.PageName.About,duration) | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + | ||
| 6 | build() { | 23 | build() { |
| 7 | Column(){ | 24 | Column(){ |
| 8 | AboutPageUI() | 25 | AboutPageUI() |
| @@ -4,6 +4,7 @@ import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout'; | @@ -4,6 +4,7 @@ import { AccountAndSecurityLayout } from '../setting/AccountAndSecurityLayout'; | ||
| 4 | import router from '@ohos.router'; | 4 | import router from '@ohos.router'; |
| 5 | import { Action, Params } from 'wdBean'; | 5 | import { Action, Params } from 'wdBean'; |
| 6 | import { DateTimeUtils } from 'wdKit/Index'; | 6 | import { DateTimeUtils } from 'wdKit/Index'; |
| 7 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 7 | 8 | ||
| 8 | @Entry | 9 | @Entry |
| 9 | @Component | 10 | @Component |
| @@ -13,10 +14,39 @@ struct SettingPage { | @@ -13,10 +14,39 @@ struct SettingPage { | ||
| 13 | @State params:Params = router.getParams() as Params; | 14 | @State params:Params = router.getParams() as Params; |
| 14 | @State enterActivityTime:number = 0; | 15 | @State enterActivityTime:number = 0; |
| 15 | 16 | ||
| 17 | + pageShowSettingTime:number = 0; | ||
| 18 | + pageHideSettingTime:number = 0; | ||
| 19 | + pageShowAccountTime:number = 0; | ||
| 20 | + pageHideAccountTime:number = 0; | ||
| 21 | + | ||
| 16 | onPageShow() { | 22 | onPageShow() { |
| 23 | + this.pageType = this.params.pageID; | ||
| 24 | + this.enterActivityTime = DateTimeUtils.getTimeStamp() | ||
| 25 | + if (this.pageType == 'mainSetting'){ | ||
| 26 | + this.pageShowSettingTime = DateTimeUtils.getTimeStamp() | ||
| 27 | + }else{ | ||
| 28 | + this.pageShowAccountTime = DateTimeUtils.getTimeStamp() | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + onPageHide(): void { | ||
| 33 | + if (this.pageType == 'mainSetting'){ | ||
| 34 | + this.pageHideSettingTime = DateTimeUtils.getTimeStamp() | ||
| 35 | + }else{ | ||
| 36 | + this.pageHideAccountTime = DateTimeUtils.getTimeStamp() | ||
| 37 | + } | ||
| 17 | 38 | ||
| 18 | - this.pageType = this.params.pageID; | ||
| 19 | - this.enterActivityTime = DateTimeUtils.getTimeStamp() | 39 | + let duration = 0 |
| 40 | + if(this.pageType == 'mainSetting'){ | ||
| 41 | + duration = Math.floor((this.pageHideSettingTime - this.pageShowSettingTime)/1000) | ||
| 42 | + }else{ | ||
| 43 | + duration = Math.floor((this.pageHideAccountTime - this.pageShowAccountTime)/1000) | ||
| 44 | + } | ||
| 45 | + if(this.pageType == 'mainSetting'){ | ||
| 46 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Setting,TrackConstants.PageName.Setting,duration) | ||
| 47 | + }else{ | ||
| 48 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Account_Management,TrackConstants.PageName.Account_Management,duration) | ||
| 49 | + } | ||
| 20 | } | 50 | } |
| 21 | 51 | ||
| 22 | build() { | 52 | build() { |
| @@ -24,11 +24,7 @@ export struct AboutPageUI { | @@ -24,11 +24,7 @@ export struct AboutPageUI { | ||
| 24 | }) | 24 | }) |
| 25 | 25 | ||
| 26 | build() { | 26 | build() { |
| 27 | - // Navigation() { | ||
| 28 | - //滑动区域 | ||
| 29 | this.aboutUi() | 27 | this.aboutUi() |
| 30 | - // }.titleMode(NavigationTitleMode.Mini) | ||
| 31 | - // .title('关于') | ||
| 32 | } | 28 | } |
| 33 | 29 | ||
| 34 | aboutToAppear() { | 30 | aboutToAppear() { |
| @@ -55,18 +51,6 @@ export struct AboutPageUI { | @@ -55,18 +51,6 @@ export struct AboutPageUI { | ||
| 55 | this.dialogController.open() | 51 | this.dialogController.open() |
| 56 | }) | 52 | }) |
| 57 | ) | 53 | ) |
| 58 | - // Row(){ | ||
| 59 | - // | ||
| 60 | - // }.backgroundColor(Color.Yellow) | ||
| 61 | - // .width('100%') | ||
| 62 | - // .height('97lpx') | ||
| 63 | - | ||
| 64 | - // Row(){ | ||
| 65 | - // | ||
| 66 | - // }.backgroundColor(Color.Yellow) | ||
| 67 | - // .width('100%') | ||
| 68 | - // .height('97lpx') | ||
| 69 | - | ||
| 70 | 54 | ||
| 71 | List() { | 55 | List() { |
| 72 | ForEach(this.listData, (item: string, index: number) => { | 56 | ForEach(this.listData, (item: string, index: number) => { |
| @@ -85,69 +85,6 @@ export struct MineSettingComponent { | @@ -85,69 +85,6 @@ export struct MineSettingComponent { | ||
| 85 | } | 85 | } |
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | - // // 页面布局 | ||
| 89 | - // @Builder settingList() { | ||
| 90 | - // Column() { | ||
| 91 | - // List() { | ||
| 92 | - // // 循环渲染ListItemGroup,contactsGroups为多个分组联系人contacts和标题title的数据集合 | ||
| 93 | - // ForEach(this.listData, (item: Array<string>, index: number) => { | ||
| 94 | - // ListItemGroup({ header: index === 0 ? this.itemHead("") : this.itemHead("1") }) { | ||
| 95 | - // // 循环渲染ListItem | ||
| 96 | - // ForEach(item, (subItem: string, subIndex: number) => { | ||
| 97 | - // ListItem() { | ||
| 98 | - // if (subIndex == 6) { | ||
| 99 | - // this.getArrowCell(subItem, subIndex, index) | ||
| 100 | - // } else if (subIndex == 1 || subIndex == 3 || subIndex == 4 || subIndex == 5) { | ||
| 101 | - // if (subIndex == 1 && index == 1) { | ||
| 102 | - // this.getArrowCell(subItem, subIndex, index) | ||
| 103 | - // } else { | ||
| 104 | - // this.getSwitchCell(subItem, subIndex) | ||
| 105 | - // } | ||
| 106 | - // | ||
| 107 | - // } else { | ||
| 108 | - // this.getArrowCell(subItem, subIndex, index) | ||
| 109 | - // } | ||
| 110 | - // | ||
| 111 | - // }.padding({ left: '27lpx' }) | ||
| 112 | - // .onClick(() => { | ||
| 113 | - // | ||
| 114 | - // // // 在Home页面中 | ||
| 115 | - // // let paramsInfo: object = { | ||
| 116 | - // // pageId: 123, | ||
| 117 | - // // pageType:'AccountAndSecurityLayout' | ||
| 118 | - // // }; | ||
| 119 | - // console.log(subIndex + "") | ||
| 120 | - // if (subIndex == 0 && index == 0) { | ||
| 121 | - // | ||
| 122 | - // let params: Params = { | ||
| 123 | - // pageID: 'AccountAndSecurityLayout' | ||
| 124 | - // } | ||
| 125 | - // WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) | ||
| 126 | - // }else if (subIndex == 2 && index == 0) { | ||
| 127 | - // WDRouterRule.jumpWithPage(WDRouterPage.privacySettingPage) | ||
| 128 | - // }else if (subIndex == 0 && index == 1) { | ||
| 129 | - // this.dialogController.open() | ||
| 130 | - // } | ||
| 131 | - // | ||
| 132 | - // }) | ||
| 133 | - // .height('117lpx') | ||
| 134 | - // }) | ||
| 135 | - // } | ||
| 136 | - // .divider({ | ||
| 137 | - // strokeWidth: 1, | ||
| 138 | - // startMargin: 15, | ||
| 139 | - // endMargin: 10, | ||
| 140 | - // color: '#f0f0f0' | ||
| 141 | - // }) | ||
| 142 | - // }) | ||
| 143 | - // }.onScrollFrameBegin((offset, state) => { | ||
| 144 | - // return { offsetRemain: 0 } | ||
| 145 | - // }) | ||
| 146 | - // } | ||
| 147 | - // .backgroundColor(Color.White) | ||
| 148 | - // .borderRadius(8) | ||
| 149 | - // } | ||
| 150 | - | ||
| 151 | // 页面布局 | 88 | // 页面布局 |
| 152 | @Builder settingList() { | 89 | @Builder settingList() { |
| 153 | Column() { | 90 | Column() { |
| @@ -247,12 +184,6 @@ export struct MineSettingComponent { | @@ -247,12 +184,6 @@ export struct MineSettingComponent { | ||
| 247 | Row() { | 184 | Row() { |
| 248 | // 左侧logo和标题 | 185 | // 左侧logo和标题 |
| 249 | Row() { | 186 | Row() { |
| 250 | - // 判断有没有图片 | ||
| 251 | - // if (this.privacySwitch) { | ||
| 252 | - // Image('https://pic.rmb.bdstatic.com/e182cf67c341d1128d2a6cc05886bf62.jpeg@s_0,h_2000') | ||
| 253 | - // .height('38lpx') | ||
| 254 | - // .margin({ right: '5lpx' }) | ||
| 255 | - // } | ||
| 256 | Text(`${item.title}`) | 187 | Text(`${item.title}`) |
| 257 | .margin({ top: '8lpx' }) | 188 | .margin({ top: '8lpx' }) |
| 258 | .height('38lpx') | 189 | .height('38lpx') |
| @@ -234,7 +234,11 @@ export struct OperRowListView { | @@ -234,7 +234,11 @@ export struct OperRowListView { | ||
| 234 | if (this.showCommentIcon) { | 234 | if (this.showCommentIcon) { |
| 235 | Column() { | 235 | Column() { |
| 236 | if (this.publishCommentModel?.targetId) { | 236 | if (this.publishCommentModel?.targetId) { |
| 237 | - CommentIconComponent({ publishCommentModel: this.publishCommentModel, styleType: this.styleType }) | 237 | + CommentIconComponent({ |
| 238 | + publishCommentModel: this.publishCommentModel, | ||
| 239 | + styleType: this.styleType, | ||
| 240 | + contentDetail: this.contentDetailData | ||
| 241 | + }) | ||
| 238 | .onClick(() => { | 242 | .onClick(() => { |
| 239 | this.onCommentIconClick() | 243 | this.onCommentIconClick() |
| 240 | 244 |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | -import { NetworkUtil, StringUtils } from 'wdKit'; | 2 | +import { DateTimeUtils, NetworkUtil, StringUtils } from 'wdKit'; |
| 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import { editModelParams } from '../model/EditInfoModel'; | 4 | import { editModelParams } from '../model/EditInfoModel'; |
| 5 | import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; | 5 | import { HomePageBottomCommentComponent } from '../components/mine/home/HomePageBottomCommentComponent'; |
| @@ -7,6 +7,7 @@ import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageB | @@ -7,6 +7,7 @@ import { HomePageBottomFollowComponent } from '../components/mine/home/HomePageB | ||
| 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; | 7 | import MinePageDatasModel from '../model/MinePageDatasModel'; |
| 8 | import { EmptyComponent } from '../components/view/EmptyComponent'; | 8 | import { EmptyComponent } from '../components/view/EmptyComponent'; |
| 9 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | 9 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; |
| 10 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 10 | 11 | ||
| 11 | const TAG = "MineHomePage" | 12 | const TAG = "MineHomePage" |
| 12 | 13 | ||
| @@ -37,8 +38,11 @@ struct MineHomePage { | @@ -37,8 +38,11 @@ struct MineHomePage { | ||
| 37 | @State isCommentEnter:string = ""; | 38 | @State isCommentEnter:string = ""; |
| 38 | @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | 39 | @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() |
| 39 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 40 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 41 | + pageShowTime:number = 0; | ||
| 42 | + pageHideTime:number = 0; | ||
| 40 | 43 | ||
| 41 | onPageShow(): void { | 44 | onPageShow(): void { |
| 45 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 42 | this.getUserInfo() | 46 | this.getUserInfo() |
| 43 | 47 | ||
| 44 | let intervalID = setInterval(() => { | 48 | let intervalID = setInterval(() => { |
| @@ -50,6 +54,13 @@ struct MineHomePage { | @@ -50,6 +54,13 @@ struct MineHomePage { | ||
| 50 | }, 200); | 54 | }, 200); |
| 51 | } | 55 | } |
| 52 | 56 | ||
| 57 | + onPageHide(): void { | ||
| 58 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 59 | + let duration = 0 | ||
| 60 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 61 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Main_Personal,TrackConstants.PageName.Main_Personal,duration) | ||
| 62 | + } | ||
| 63 | + | ||
| 53 | build() { | 64 | build() { |
| 54 | if(this.isConnectNetwork){ | 65 | if(this.isConnectNetwork){ |
| 55 | Stack({ alignContent: Alignment.Top }){ | 66 | Stack({ alignContent: Alignment.Top }){ |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | import { Params } from 'wdBean'; | 2 | import { Params } from 'wdBean'; |
| 3 | -import { NetworkUtil, StringUtils } from 'wdKit'; | 3 | +import { DateTimeUtils, NetworkUtil, StringUtils } from 'wdKit'; |
| 4 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 4 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; | 5 | import { OtherHomePageBottomCommentComponent } from '../components/mine/home/OtherHomePageBottomCommentComponent'; |
| 5 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; | 6 | import { OtherHomePageBottomFollowComponent } from '../components/mine/home/OtherHomePageBottomFollowComponent'; |
| 6 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | 7 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; |
| @@ -16,9 +17,20 @@ struct OtherNormalUserHomePage { | @@ -16,9 +17,20 @@ struct OtherNormalUserHomePage { | ||
| 16 | @State params:Record<string, string> = router.getParams() as Record<string, string>; | 17 | @State params:Record<string, string> = router.getParams() as Record<string, string>; |
| 17 | @Watch('change') @State curUserId: string = '-1'; | 18 | @Watch('change') @State curUserId: string = '-1'; |
| 18 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 19 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 20 | + pageShowTime:number = 0; | ||
| 21 | + pageHideTime:number = 0; | ||
| 22 | + | ||
| 19 | 23 | ||
| 20 | onPageShow() { | 24 | onPageShow() { |
| 21 | this.curUserId = this.params?.['userId']; | 25 | this.curUserId = this.params?.['userId']; |
| 26 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + onPageHide(): void { | ||
| 30 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 31 | + let duration = 0 | ||
| 32 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 33 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Customer_Personal,TrackConstants.PageName.Customer_Personal,duration) | ||
| 22 | } | 34 | } |
| 23 | 35 | ||
| 24 | change(){ | 36 | change(){ |
| 1 | +import { DateTimeUtils } from 'wdKit/Index'; | ||
| 2 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 1 | import { SearchComponent } from '../components/search/SearchComponent' | 3 | import { SearchComponent } from '../components/search/SearchComponent' |
| 2 | 4 | ||
| 3 | @Entry | 5 | @Entry |
| 4 | @Component | 6 | @Component |
| 5 | struct SearchPage { | 7 | struct SearchPage { |
| 8 | + pageShowTime:number = 0; | ||
| 9 | + pageHideTime:number = 0; | ||
| 10 | + | ||
| 11 | + onPageShow() { | ||
| 12 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + onPageHide(): void { | ||
| 16 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 17 | + let duration = 0 | ||
| 18 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 19 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Search,TrackConstants.PageName.Search,duration) | ||
| 20 | + } | ||
| 21 | + | ||
| 6 | build() { | 22 | build() { |
| 7 | Column(){ | 23 | Column(){ |
| 8 | SearchComponent() | 24 | SearchComponent() |
| 1 | -import { DateFormatUtil, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | 1 | +import { DateFormatUtil, WDAliPlayerController, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; |
| 2 | import router from '@ohos.router'; | 2 | import router from '@ohos.router'; |
| 3 | import { StringUtils } from 'wdKit/Index'; | 3 | import { StringUtils } from 'wdKit/Index'; |
| 4 | import { Action } from 'wdBean'; | 4 | import { Action } from 'wdBean'; |
| @@ -10,7 +10,7 @@ const TAG = 'VideoPlayPage'; | @@ -10,7 +10,7 @@ const TAG = 'VideoPlayPage'; | ||
| 10 | export struct VideoPlayPage { | 10 | export struct VideoPlayPage { |
| 11 | //是否处于播放状态中 | 11 | //是否处于播放状态中 |
| 12 | @State isPlayStatus: boolean = true | 12 | @State isPlayStatus: boolean = true |
| 13 | - playerController: WDPlayerController = new WDPlayerController(); | 13 | + playerController: WDAliPlayerController = new WDAliPlayerController(); |
| 14 | //视频地址 | 14 | //视频地址 |
| 15 | @State videoUrl: string = '' | 15 | @State videoUrl: string = '' |
| 16 | //封面图 | 16 | //封面图 |
| @@ -41,11 +41,23 @@ class SystemInfo{ | @@ -41,11 +41,23 @@ class SystemInfo{ | ||
| 41 | time: string = "" | 41 | time: string = "" |
| 42 | title: string = "" | 42 | title: string = "" |
| 43 | userId: number = -1 | 43 | userId: number = -1 |
| 44 | + remark: string = "" | ||
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | class ActiveInfo{ | 47 | class ActiveInfo{ |
| 47 | - id:string = "" | 48 | + classify: string = "" |
| 49 | + contentId: string = "" | ||
| 50 | + contentType: string = "" | ||
| 51 | + id: number = -1 | ||
| 48 | message: string = "" | 52 | message: string = "" |
| 53 | + platform: string = "" | ||
| 54 | + privateMailId: number = -1 | ||
| 55 | + privateMailIds: string = "" | ||
| 56 | + privateMailNum: number = -1 | ||
| 57 | + read: boolean = false | ||
| 58 | + source: string = "" | ||
| 49 | time: string = "" | 59 | time: string = "" |
| 50 | title: string = "" | 60 | title: string = "" |
| 61 | + userId: number = -1 | ||
| 62 | + remark: string = "" | ||
| 51 | } | 63 | } |
| @@ -80,7 +80,7 @@ export class PageHelper { | @@ -80,7 +80,7 @@ export class PageHelper { | ||
| 80 | return; | 80 | return; |
| 81 | } | 81 | } |
| 82 | pageModel.pageInfo = pageInfo; | 82 | pageModel.pageInfo = pageInfo; |
| 83 | - pageModel.cachePageInfoMd5 = pageInfo.md5 | 83 | + pageModel.displayPageInfoMd5 = pageInfo.md5 |
| 84 | //解析页面挂角广告资源 | 84 | //解析页面挂角广告资源 |
| 85 | pageAdvModel.analysisAdvSource(pageInfo); | 85 | pageAdvModel.analysisAdvSource(pageInfo); |
| 86 | this.parseGroup(pageModel, true) | 86 | this.parseGroup(pageModel, true) |
| @@ -129,7 +129,7 @@ export class PageHelper { | @@ -129,7 +129,7 @@ export class PageHelper { | ||
| 129 | return; | 129 | return; |
| 130 | } | 130 | } |
| 131 | pageModel.pageInfo = pageInfo; | 131 | pageModel.pageInfo = pageInfo; |
| 132 | - if (pageInfo.md5 == pageModel.cachePageInfoMd5) { | 132 | + if (pageInfo.md5 == pageModel.displayPageInfoMd5) { |
| 133 | // 缓存一致,不解析 | 133 | // 缓存一致,不解析 |
| 134 | Logger.debug(TAG, 'getPageInfo 与缓存一致,不解析广告。。。') | 134 | Logger.debug(TAG, 'getPageInfo 与缓存一致,不解析广告。。。') |
| 135 | } else { | 135 | } else { |
| @@ -138,6 +138,7 @@ export class PageHelper { | @@ -138,6 +138,7 @@ export class PageHelper { | ||
| 138 | // 保存缓存 | 138 | // 保存缓存 |
| 139 | CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) | 139 | CacheData.saveCacheData(CacheData.comPageInfoCacheKey + pageModel.pageId, pageInfo, pageInfo.md5) |
| 140 | } | 140 | } |
| 141 | + pageModel.displayPageInfoMd5 = pageInfo.md5 | ||
| 141 | //解析页面挂角广告资源 | 142 | //解析页面挂角广告资源 |
| 142 | pageAdvModel.analysisAdvSource(pageInfo); | 143 | pageAdvModel.analysisAdvSource(pageInfo); |
| 143 | } | 144 | } |
| @@ -185,15 +186,25 @@ export class PageHelper { | @@ -185,15 +186,25 @@ export class PageHelper { | ||
| 185 | Logger.debug(TAG, 'parseGroup isCache: ' + isCache) | 186 | Logger.debug(TAG, 'parseGroup isCache: ' + isCache) |
| 186 | if (isCache) { | 187 | if (isCache) { |
| 187 | pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO | 188 | pageDto = await PageViewModel.getPageGroupCacheData(pageModel.bizCopy()) as PageDTO |
| 188 | - pageModel.cacheGroupInfoMd5 = pageDto.md5 | 189 | + pageModel.displayGroupInfoMd5 = pageDto.md5 |
| 189 | } else { | 190 | } else { |
| 190 | pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO | 191 | pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO |
| 191 | - if (pageDto.md5 == pageModel.cacheGroupInfoMd5) { | 192 | + if (pageDto.md5 == pageModel.displayGroupInfoMd5) { |
| 192 | Logger.debug(TAG, 'parseGroup cache load, return: ' + pageDto.md5) | 193 | Logger.debug(TAG, 'parseGroup cache load, return: ' + pageDto.md5) |
| 193 | - // 缓存数据一致,不再刷新 | 194 | + // 下拉刷新场景,数据没变,拦截刷新UI,重置相关参数 |
| 195 | + if (pageModel.loadStrategy === 2) { | ||
| 196 | + // 缓存数据一致,不再刷新 | ||
| 197 | + this.refreshUIEnd(pageModel, true) | ||
| 198 | + // 第一页不刷新,分页数据清除 | ||
| 199 | + pageModel.hasMore = true | ||
| 200 | + this.deleteMorePage(pageModel) | ||
| 201 | + pageModel.pageTotalCompSize = pageModel.compList.size() | ||
| 202 | + } | ||
| 203 | + pageModel.currentPage++ | ||
| 194 | return | 204 | return |
| 195 | } | 205 | } |
| 196 | - Logger.debug(TAG, 'parseGroup cache load, save: ') | 206 | + pageModel.displayGroupInfoMd5 = pageDto.md5 |
| 207 | + Logger.debug(TAG, 'parseGroup cache load, save: ' + pageDto.md5) | ||
| 197 | // 保存缓存 | 208 | // 保存缓存 |
| 198 | CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, | 209 | CacheData.saveCacheData(CacheData.compGroupInfoDataCacheKey + pageModel.pageId + pageModel.groupId, pageDto, |
| 199 | pageDto.md5) | 210 | pageDto.md5) |
| @@ -238,9 +249,11 @@ export class PageHelper { | @@ -238,9 +249,11 @@ export class PageHelper { | ||
| 238 | 249 | ||
| 239 | // 批查互动数据 | 250 | // 批查互动数据 |
| 240 | this.allCompBatchRequest(pageInfo.oneRequestPageGroupCompList.convertToArray(), pageModel) | 251 | this.allCompBatchRequest(pageInfo.oneRequestPageGroupCompList.convertToArray(), pageModel) |
| 241 | - | ||
| 242 | - // | ||
| 243 | - pageModel.currentPage++ | 252 | + // 记录第一页数量 |
| 253 | + this.saveFirstPageEndIndex(pageModel) | ||
| 254 | + if (!isCache) { | ||
| 255 | + pageModel.currentPage++ | ||
| 256 | + } | ||
| 244 | pageModel.viewType = ViewType.LOADED | 257 | pageModel.viewType = ViewType.LOADED |
| 245 | this.refreshUIEnd(pageModel, true) | 258 | this.refreshUIEnd(pageModel, true) |
| 246 | 259 | ||
| @@ -754,6 +767,40 @@ export class PageHelper { | @@ -754,6 +767,40 @@ export class PageHelper { | ||
| 754 | } | 767 | } |
| 755 | 768 | ||
| 756 | } | 769 | } |
| 770 | + | ||
| 771 | + saveFirstPageEndIndex(pageModel: PageModel) { | ||
| 772 | + pageModel.firstPageEndIndex = pageModel.compList.size() - 1 | ||
| 773 | + } | ||
| 774 | + | ||
| 775 | + static updateFirstPageEndIndex(pageModel: PageModel, isDel: boolean, index: number) { | ||
| 776 | + if (index > pageModel.firstPageEndIndex) { | ||
| 777 | + return | ||
| 778 | + } | ||
| 779 | + // 这里默认删除、添加都是一条一条处理 | ||
| 780 | + let count = 1 | ||
| 781 | + let endIndex = pageModel.firstPageEndIndex | ||
| 782 | + if (isDel) { | ||
| 783 | + // 第一页里删除 | ||
| 784 | + let offset = Math.min(endIndex - index, count) | ||
| 785 | + endIndex = endIndex - offset | ||
| 786 | + } else { | ||
| 787 | + // 第一页里添加 | ||
| 788 | + endIndex = endIndex + count | ||
| 789 | + } | ||
| 790 | + pageModel.firstPageEndIndex = endIndex | ||
| 791 | + } | ||
| 792 | + | ||
| 793 | + /** | ||
| 794 | + * 删除分页数据,保留第一页的数据。(下拉刷新场景用到) | ||
| 795 | + */ | ||
| 796 | + deleteMorePage(pageModel: PageModel) { | ||
| 797 | + Logger.debug(TAG, 'deleteMorePage endindex: ' + pageModel.firstPageEndIndex) | ||
| 798 | + if (pageModel.firstPageEndIndex < 0) { | ||
| 799 | + return | ||
| 800 | + } | ||
| 801 | + // 从第二页开始删 | ||
| 802 | + pageModel.compList.deleteItems(pageModel.firstPageEndIndex + 1) | ||
| 803 | + } | ||
| 757 | } | 804 | } |
| 758 | 805 | ||
| 759 | 806 |
| @@ -63,9 +63,11 @@ export default class PageModel { | @@ -63,9 +63,11 @@ export default class PageModel { | ||
| 63 | pageType: number = 0; | 63 | pageType: number = 0; |
| 64 | 64 | ||
| 65 | extra: string = '' | 65 | extra: string = '' |
| 66 | - // 缓存数据相关 | ||
| 67 | - cachePageInfoMd5: string = '' | ||
| 68 | - cacheGroupInfoMd5: string = '' | 66 | + // 页面加载,md5数据相关(初始缓存、下拉刷新用到) |
| 67 | + displayPageInfoMd5: string = '' | ||
| 68 | + displayGroupInfoMd5: string = '' | ||
| 69 | + // 第一页,最后一个comp下标,用于区分分页加载(下拉刷新,清除分页数据) | ||
| 70 | + firstPageEndIndex = -1 | ||
| 69 | 71 | ||
| 70 | /** | 72 | /** |
| 71 | * 简单复制业务数据 | 73 | * 简单复制业务数据 |
479 Bytes
| @@ -8,7 +8,7 @@ import { Logger, WindowModel } from 'wdKit/Index'; | @@ -8,7 +8,7 @@ import { Logger, WindowModel } from 'wdKit/Index'; | ||
| 8 | import { router, window } from '@kit.ArkUI'; | 8 | import { router, window } from '@kit.ArkUI'; |
| 9 | import { devicePLSensorManager } from 'wdDetailPlayApi/Index'; | 9 | import { devicePLSensorManager } from 'wdDetailPlayApi/Index'; |
| 10 | import { LiveCommentComponent } from 'wdComponent/Index'; | 10 | import { LiveCommentComponent } from 'wdComponent/Index'; |
| 11 | -import { WDPlayerController } from 'wdPlayer/Index'; | 11 | +import { WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index'; |
| 12 | import { OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView'; | 12 | import { OperRowListView } from 'wdComponent/src/main/ets/components/view/OperRowListView'; |
| 13 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; | 13 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; |
| 14 | import { ResponseDTO } from 'wdNetwork/Index'; | 14 | import { ResponseDTO } from 'wdNetwork/Index'; |
| @@ -19,7 +19,7 @@ let TAG: string = 'DetailPlayLivePage'; | @@ -19,7 +19,7 @@ let TAG: string = 'DetailPlayLivePage'; | ||
| 19 | export struct DetailPlayLivePage { | 19 | export struct DetailPlayLivePage { |
| 20 | //横竖屏,默认竖屏 | 20 | //横竖屏,默认竖屏 |
| 21 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL | 21 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL |
| 22 | - playerController: WDPlayerController = new WDPlayerController(); | 22 | + playerController: WDAliPlayerController = new WDAliPlayerController(); |
| 23 | liveViewModel: LiveViewModel = new LiveViewModel() | 23 | liveViewModel: LiveViewModel = new LiveViewModel() |
| 24 | @State relId: string = '' | 24 | @State relId: string = '' |
| 25 | @State contentId: string = '' | 25 | @State contentId: string = '' |
| @@ -4,7 +4,7 @@ import router from '@ohos.router'; | @@ -4,7 +4,7 @@ import router from '@ohos.router'; | ||
| 4 | import { WindowModel } from 'wdKit/Index'; | 4 | import { WindowModel } from 'wdKit/Index'; |
| 5 | import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; | 5 | import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; |
| 6 | import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; | 6 | import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; |
| 7 | -import { WDPlayerController } from 'wdPlayer/Index'; | 7 | +import { WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index'; |
| 8 | import { DisplayDirection } from 'wdConstant/Index'; | 8 | import { DisplayDirection } from 'wdConstant/Index'; |
| 9 | import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; | 9 | import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; |
| 10 | import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; | 10 | import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; |
| @@ -16,7 +16,7 @@ const TAG = 'DetailPlayVLivePage' | @@ -16,7 +16,7 @@ const TAG = 'DetailPlayVLivePage' | ||
| 16 | @Component | 16 | @Component |
| 17 | export struct DetailPlayVLivePage { | 17 | export struct DetailPlayVLivePage { |
| 18 | private liveViewModel: LiveViewModel = new LiveViewModel() | 18 | private liveViewModel: LiveViewModel = new LiveViewModel() |
| 19 | - private playerController: WDPlayerController = new WDPlayerController(); | 19 | + private playerController: WDAliPlayerController = new WDAliPlayerController(); |
| 20 | private swiperController: SwiperController = new SwiperController() | 20 | private swiperController: SwiperController = new SwiperController() |
| 21 | @Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 21 | @Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 22 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 22 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| @@ -2,14 +2,14 @@ import { window } from '@kit.ArkUI' | @@ -2,14 +2,14 @@ import { window } from '@kit.ArkUI' | ||
| 2 | import lottie from '@ohos/lottie'; | 2 | import lottie from '@ohos/lottie'; |
| 3 | 3 | ||
| 4 | import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index' | 4 | import { NumberFormatterUtils, StringUtils, WindowModel } from 'wdKit/Index' |
| 5 | -import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' | 5 | +import { DateFormatUtil, WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index' |
| 6 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | 6 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' |
| 7 | import { DisplayDirection } from 'wdConstant/Index' | 7 | import { DisplayDirection } from 'wdConstant/Index' |
| 8 | import { LiveFollowComponent, LottieView } from 'wdComponent/Index' | 8 | import { LiveFollowComponent, LottieView } from 'wdComponent/Index' |
| 9 | 9 | ||
| 10 | @Component | 10 | @Component |
| 11 | export struct PlayUIComponent { | 11 | export struct PlayUIComponent { |
| 12 | - playerController: WDPlayerController = new WDPlayerController(); | 12 | + playerController?: WDAliPlayerController; |
| 13 | //菜单键是否可见 | 13 | //菜单键是否可见 |
| 14 | @State @Watch('onChangeMenuVisible') isMenuVisible: boolean = true | 14 | @State @Watch('onChangeMenuVisible') isMenuVisible: boolean = true |
| 15 | @Consume liveDetailsBean: LiveDetailsBean | 15 | @Consume liveDetailsBean: LiveDetailsBean |
| @@ -39,10 +39,12 @@ export struct PlayUIComponent { | @@ -39,10 +39,12 @@ export struct PlayUIComponent { | ||
| 39 | aboutToAppear(): void { | 39 | aboutToAppear(): void { |
| 40 | this.onChangeMenuVisible() | 40 | this.onChangeMenuVisible() |
| 41 | //播放进度监听 | 41 | //播放进度监听 |
| 42 | - this.playerController.onTimeUpdate = (position: number, duration: number) => { | ||
| 43 | - this.currentTime = DateFormatUtil.secondToTime(Math.floor(position / 1000)); | ||
| 44 | - this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000)); | ||
| 45 | - this.progressVal = Math.floor(position * 100 / duration); | 42 | + if (this.playerController) { |
| 43 | + this.playerController.onTimeUpdate = (position: number, duration: number) => { | ||
| 44 | + this.currentTime = DateFormatUtil.secondToTime(Math.floor(position / 1000)); | ||
| 45 | + this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000)); | ||
| 46 | + this.progressVal = Math.floor(position * 100 / duration); | ||
| 47 | + } | ||
| 46 | } | 48 | } |
| 47 | } | 49 | } |
| 48 | 50 | ||
| @@ -312,10 +314,10 @@ export struct PlayUIComponent { | @@ -312,10 +314,10 @@ export struct PlayUIComponent { | ||
| 312 | .onClick(() => { | 314 | .onClick(() => { |
| 313 | if (this.isPlayStatus) { | 315 | if (this.isPlayStatus) { |
| 314 | this.isPlayStatus = false | 316 | this.isPlayStatus = false |
| 315 | - this.playerController.pause() | 317 | + this.playerController?.pause() |
| 316 | } else { | 318 | } else { |
| 317 | this.isPlayStatus = true | 319 | this.isPlayStatus = true |
| 318 | - this.playerController.play() | 320 | + this.playerController?.play() |
| 319 | } | 321 | } |
| 320 | }) | 322 | }) |
| 321 | } | 323 | } |
| 1 | import { LiveDetailsBean } from 'wdBean/Index'; | 1 | import { LiveDetailsBean } from 'wdBean/Index'; |
| 2 | import { StringUtils } from 'wdKit/Index'; | 2 | import { StringUtils } from 'wdKit/Index'; |
| 3 | -import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; | 3 | +import { WDAliPlayerController, WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index'; |
| 4 | import { PlayUIComponent } from './PlayUIComponent'; | 4 | import { PlayUIComponent } from './PlayUIComponent'; |
| 5 | import { Logger } from 'wdKit/Index'; | 5 | import { Logger } from 'wdKit/Index'; |
| 6 | 6 | ||
| @@ -10,12 +10,14 @@ const TAG: string = 'TopPlayComponent' | @@ -10,12 +10,14 @@ const TAG: string = 'TopPlayComponent' | ||
| 10 | @Component | 10 | @Component |
| 11 | export struct TopPlayComponent { | 11 | export struct TopPlayComponent { |
| 12 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean | 12 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean |
| 13 | - playerController?: WDPlayerController | 13 | + playerController?: WDAliPlayerController |
| 14 | @State imgUrl: string = '' | 14 | @State imgUrl: string = '' |
| 15 | //未开始 | 15 | //未开始 |
| 16 | @State isWait: boolean = false | 16 | @State isWait: boolean = false |
| 17 | //已结束直播 | 17 | //已结束直播 |
| 18 | @State isEnd: boolean = false | 18 | @State isEnd: boolean = false |
| 19 | + private playUrl: string = "" | ||
| 20 | + private xComponentIsLoaded: boolean = false | ||
| 19 | 21 | ||
| 20 | aboutToAppear(): void { | 22 | aboutToAppear(): void { |
| 21 | if (this.playerController) { | 23 | if (this.playerController) { |
| @@ -49,16 +51,31 @@ export struct TopPlayComponent { | @@ -49,16 +51,31 @@ export struct TopPlayComponent { | ||
| 49 | // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4'); | 51 | // this.playerController?.firstPlay('https://rmrbcmsonline.peopleapp.com/upload/rmh/video/mp4/202404/1713752415708fb81d0b8f137b.mp4'); |
| 50 | if (StringUtils.isNotEmpty(playUrl)) { | 52 | if (StringUtils.isNotEmpty(playUrl)) { |
| 51 | Logger.debug(TAG, `${playUrl}`) | 53 | Logger.debug(TAG, `${playUrl}`) |
| 52 | - this.playerController?.firstPlay(playUrl); | 54 | + this.playUrl = playUrl |
| 55 | + this.tryToPlay() | ||
| 53 | } | 56 | } |
| 54 | } | 57 | } |
| 55 | } | 58 | } |
| 56 | 59 | ||
| 60 | + tryToPlay() { | ||
| 61 | + if (!this.xComponentIsLoaded) { | ||
| 62 | + Logger.debug(TAG, "需要xComponent加载完成") | ||
| 63 | + return | ||
| 64 | + } | ||
| 65 | + if (this.playUrl.length == 0) { | ||
| 66 | + Logger.debug(TAG, "播放地址为空") | ||
| 67 | + return | ||
| 68 | + } | ||
| 69 | + this.playerController?.firstPlay(this.playUrl); | ||
| 70 | + } | ||
| 71 | + | ||
| 57 | build() { | 72 | build() { |
| 58 | Stack() { | 73 | Stack() { |
| 59 | WDPlayerRenderLiveView({ | 74 | WDPlayerRenderLiveView({ |
| 60 | playerController: this.playerController, | 75 | playerController: this.playerController, |
| 61 | onLoad: async () => { | 76 | onLoad: async () => { |
| 77 | + this.xComponentIsLoaded = true | ||
| 78 | + this.tryToPlay() | ||
| 62 | } | 79 | } |
| 63 | }) | 80 | }) |
| 64 | .height('100%') | 81 | .height('100%') |
| 1 | import { LiveDetailsBean } from 'wdBean/Index'; | 1 | import { LiveDetailsBean } from 'wdBean/Index'; |
| 2 | -import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index'; | 2 | +import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView, WDAliPlayerController, |
| 3 | + AliPlayerRenderView } from 'wdPlayer/Index'; | ||
| 3 | import { PictureLoading } from './PictureLoading'; | 4 | import { PictureLoading } from './PictureLoading'; |
| 4 | 5 | ||
| 5 | const TAG = 'PlayerComponent' | 6 | const TAG = 'PlayerComponent' |
| 6 | 7 | ||
| 7 | @Component | 8 | @Component |
| 8 | export struct PlayerComponent { | 9 | export struct PlayerComponent { |
| 9 | - @Prop playerController: WDPlayerController; | 10 | + @Prop playerController: WDAliPlayerController; |
| 10 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean | 11 | @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean |
| 11 | @Consume @Watch('pageShowChange') pageShow: number | 12 | @Consume @Watch('pageShowChange') pageShow: number |
| 12 | @Consume @Watch('pageHideChange') pageHide: number | 13 | @Consume @Watch('pageHideChange') pageHide: number |
| @@ -78,7 +79,7 @@ export struct PlayerComponent { | @@ -78,7 +79,7 @@ export struct PlayerComponent { | ||
| 78 | } | 79 | } |
| 79 | }) | 80 | }) |
| 80 | } else if (this.liveStreamType == 0) { | 81 | } else if (this.liveStreamType == 0) { |
| 81 | - WDPlayerRenderView({ | 82 | + AliPlayerRenderView({ |
| 82 | playerController: this.playerController, | 83 | playerController: this.playerController, |
| 83 | onLoad: () => { | 84 | onLoad: () => { |
| 84 | this.playerController?.firstPlay(this.playUrl); | 85 | this.playerController?.firstPlay(this.playUrl); |
| 1 | -import { WDPlayerController } from 'wdPlayer/Index' | 1 | +import { WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index' |
| 2 | import { PlayerUIComponent } from './PlayerUIComponent' | 2 | import { PlayerUIComponent } from './PlayerUIComponent' |
| 3 | 3 | ||
| 4 | @Component | 4 | @Component |
| 5 | export struct PlayerInfoComponent { | 5 | export struct PlayerInfoComponent { |
| 6 | swiperController?: SwiperController | 6 | swiperController?: SwiperController |
| 7 | - private playerController?: WDPlayerController | 7 | + private playerController?: WDAliPlayerController |
| 8 | @Consume bottomSafeHeight: number | 8 | @Consume bottomSafeHeight: number |
| 9 | @Consume topSafeHeight: number | 9 | @Consume topSafeHeight: number |
| 10 | @Consume liveState: string | 10 | @Consume liveState: string |
| 1 | import { ContentDetailDTO } from 'wdBean/Index'; | 1 | import { ContentDetailDTO } from 'wdBean/Index'; |
| 2 | -import { WDPlayerController } from 'wdPlayer/Index'; | 2 | +import { WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index'; |
| 3 | import { PlayerCommentComponent } from './PlayerCommentComponent'; | 3 | import { PlayerCommentComponent } from './PlayerCommentComponent'; |
| 4 | import { PlayerTitleComponent } from './PlayerTitleComponent'; | 4 | import { PlayerTitleComponent } from './PlayerTitleComponent'; |
| 5 | import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; | 5 | import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; |
| 6 | 6 | ||
| 7 | @Component | 7 | @Component |
| 8 | export struct PlayerUIComponent { | 8 | export struct PlayerUIComponent { |
| 9 | - private playerController?: WDPlayerController | 9 | + private playerController?: WDAliPlayerController |
| 10 | @Consume isShowControl: boolean | 10 | @Consume isShowControl: boolean |
| 11 | 11 | ||
| 12 | build() { | 12 | build() { |
| @@ -2,13 +2,13 @@ import { window } from '@kit.ArkUI' | @@ -2,13 +2,13 @@ import { window } from '@kit.ArkUI' | ||
| 2 | import { NumberFormatterUtils, WindowModel } from 'wdKit/Index' | 2 | import { NumberFormatterUtils, WindowModel } from 'wdKit/Index' |
| 3 | 3 | ||
| 4 | import { devicePLSensorManager } from 'wdDetailPlayApi/Index' | 4 | import { devicePLSensorManager } from 'wdDetailPlayApi/Index' |
| 5 | -import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' | 5 | +import { DateFormatUtil, WDAliPlayerController, WDPlayerController } from 'wdPlayer/Index' |
| 6 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | 6 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' |
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | @Component | 9 | @Component |
| 10 | export struct PlayerVideoControlComponent { | 10 | export struct PlayerVideoControlComponent { |
| 11 | - private playerController?: WDPlayerController | 11 | + private playerController?: WDAliPlayerController |
| 12 | @Consume liveDetailsBean: LiveDetailsBean | 12 | @Consume liveDetailsBean: LiveDetailsBean |
| 13 | @Consume liveRoomDataBean: LiveRoomDataBean | 13 | @Consume liveRoomDataBean: LiveRoomDataBean |
| 14 | @State currentTime: string = '' | 14 | @State currentTime: string = '' |
| @@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
| 12 | "wdWebComponent": "file:../../commons/wdWebComponent", | 12 | "wdWebComponent": "file:../../commons/wdWebComponent", |
| 13 | "wdBean": "file:../../features/wdBean", | 13 | "wdBean": "file:../../features/wdBean", |
| 14 | "wdRouter": "file:../../commons/wdRouter", | 14 | "wdRouter": "file:../../commons/wdRouter", |
| 15 | - "wdNetwork": "file:../../commons/wdNetwork" | 15 | + "wdNetwork": "file:../../commons/wdNetwork", |
| 16 | + "wdTracking": "file:../../features/wdTracking" | ||
| 16 | } | 17 | } |
| 17 | } | 18 | } |
| @@ -10,6 +10,7 @@ import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/mai | @@ -10,6 +10,7 @@ import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/mai | ||
| 10 | import HuaweiAuth from '../../utils/HuaweiAuth' | 10 | import HuaweiAuth from '../../utils/HuaweiAuth' |
| 11 | import { loginComponentManager, LoginWithHuaweiIDButton } from '@hms.core.account.LoginComponent' | 11 | import { loginComponentManager, LoginWithHuaweiIDButton } from '@hms.core.account.LoginComponent' |
| 12 | import { BusinessError } from '@ohos.base' | 12 | import { BusinessError } from '@ohos.base' |
| 13 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index' | ||
| 13 | 14 | ||
| 14 | @Extend(Row) | 15 | @Extend(Row) |
| 15 | function otherStyle() { | 16 | function otherStyle() { |
| @@ -55,6 +56,8 @@ struct LoginPage { | @@ -55,6 +56,8 @@ struct LoginPage { | ||
| 55 | customStyle: true, | 56 | customStyle: true, |
| 56 | maskColor:"#00000000" | 57 | maskColor:"#00000000" |
| 57 | }) | 58 | }) |
| 59 | + pageShowTime:number = 0; | ||
| 60 | + pageHideTime:number = 0; | ||
| 58 | 61 | ||
| 59 | loginViewModel = new LoginViewModel() | 62 | loginViewModel = new LoginViewModel() |
| 60 | @State isProtocol:boolean=false | 63 | @State isProtocol:boolean=false |
| @@ -70,7 +73,15 @@ struct LoginPage { | @@ -70,7 +73,15 @@ struct LoginPage { | ||
| 70 | } | 73 | } |
| 71 | 74 | ||
| 72 | onPageShow() { | 75 | onPageShow() { |
| 73 | - Logger.debug(TAG, "onPageShow:" + this.isCodeSend + "") | 76 | + Logger.debug(TAG, "onPageShow:" + this.isCodeSend + " ") |
| 77 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + onPageHide(): void { | ||
| 81 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 82 | + let duration = 0 | ||
| 83 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 84 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Login_Page,TrackConstants.PageName.Login_Page,duration) | ||
| 74 | } | 85 | } |
| 75 | 86 | ||
| 76 | build() { | 87 | build() { |
| 1 | -import { CustomToast} from 'wdKit/Index'; | 1 | +import { CustomToast, DateTimeUtils} from 'wdKit/Index'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | import { LoginModel } from './LoginModel'; | 3 | import { LoginModel } from './LoginModel'; |
| 4 | import { ModifyPasswordRequestItem } from './ModifyPasswordRequestItem'; | 4 | import { ModifyPasswordRequestItem } from './ModifyPasswordRequestItem'; |
| 5 | import { router } from '@kit.ArkUI'; | 5 | import { router } from '@kit.ArkUI'; |
| 6 | import { encryptMessage } from '../../utils/cryptoUtil'; | 6 | import { encryptMessage } from '../../utils/cryptoUtil'; |
| 7 | +import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; | ||
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| 9 | * 修改密码页面 | 10 | * 修改密码页面 |
| @@ -26,7 +27,19 @@ struct ModifyPasswordPage { | @@ -26,7 +27,19 @@ struct ModifyPasswordPage { | ||
| 26 | customStyle: true, | 27 | customStyle: true, |
| 27 | maskColor:"#00000000" | 28 | maskColor:"#00000000" |
| 28 | }) | 29 | }) |
| 30 | + pageShowTime:number = 0; | ||
| 31 | + pageHideTime:number = 0; | ||
| 29 | 32 | ||
| 33 | + onPageShow() { | ||
| 34 | + this.pageShowTime = DateTimeUtils.getTimeStamp() | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + onPageHide(): void { | ||
| 38 | + this.pageHideTime = DateTimeUtils.getTimeStamp() | ||
| 39 | + let duration = 0 | ||
| 40 | + duration = Math.floor((this.pageHideTime - this.pageShowTime)/1000) | ||
| 41 | + TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.Change_Passwd,TrackConstants.PageName.Change_Passwd,duration) | ||
| 42 | + } | ||
| 30 | 43 | ||
| 31 | build() { | 44 | build() { |
| 32 | Row() { | 45 | Row() { |
| @@ -14,4 +14,6 @@ export { DateFormatUtil } from "./src/main/ets/utils/DateFormatUtil" | @@ -14,4 +14,6 @@ export { DateFormatUtil } from "./src/main/ets/utils/DateFormatUtil" | ||
| 14 | 14 | ||
| 15 | export { WDAliPlayerController } from "./src/main/ets/controller/WDAliPlayerController" | 15 | export { WDAliPlayerController } from "./src/main/ets/controller/WDAliPlayerController" |
| 16 | 16 | ||
| 17 | -export { WDListPlayerData, WDAliListPlayerController } from "./src/main/ets/controller/WDAliListPlayerController" | ||
| 17 | +export { WDListPlayerData, WDAliListPlayerController } from "./src/main/ets/controller/WDAliListPlayerController" | ||
| 18 | + | ||
| 19 | +export { AliPlayerRenderView } from "./src/main/ets/pages/AliPlayerRenderView" |
| @@ -11,8 +11,10 @@ import { | @@ -11,8 +11,10 @@ import { | ||
| 11 | 11 | ||
| 12 | import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting'; | 12 | import { initGlobalPlayerSettings, setupPlayerConfig } from '../utils/GlobalSetting'; |
| 13 | import prompt from '@ohos.promptAction'; | 13 | import prompt from '@ohos.promptAction'; |
| 14 | -import { Logger } from '../utils/Logger'; | ||
| 15 | import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants'; | 14 | import { PlayerConstants, AVPlayerStatus, Events } from '../constants/PlayerConstants'; |
| 15 | +import { Logger } from 'wdKit/Index'; | ||
| 16 | + | ||
| 17 | +const TAG = "WDAliPlayerController" | ||
| 16 | 18 | ||
| 17 | /* | 19 | /* |
| 18 | * 此播放器为阿里播放器鸿蒙版本封装,可播放单个视频、或直播 | 20 | * 此播放器为阿里播放器鸿蒙版本封装,可播放单个视频、或直播 |
| @@ -54,7 +56,7 @@ export class WDAliPlayerController { | @@ -54,7 +56,7 @@ export class WDAliPlayerController { | ||
| 54 | public onFirstFrameDisplay?: () => void | 56 | public onFirstFrameDisplay?: () => void |
| 55 | 57 | ||
| 56 | constructor() { | 58 | constructor() { |
| 57 | - Logger.info("初始化") | 59 | + Logger.info(TAG, "初始化") |
| 58 | initGlobalPlayerSettings() | 60 | initGlobalPlayerSettings() |
| 59 | this.initPromise = this.createAVPlayer(); | 61 | this.initPromise = this.createAVPlayer(); |
| 60 | } | 62 | } |
| @@ -64,24 +66,24 @@ export class WDAliPlayerController { | @@ -64,24 +66,24 @@ export class WDAliPlayerController { | ||
| 64 | */ | 66 | */ |
| 65 | private createAVPlayer(): Promise<void> { | 67 | private createAVPlayer(): Promise<void> { |
| 66 | return new Promise((resolve, reject) => { | 68 | return new Promise((resolve, reject) => { |
| 67 | - Logger.debug("开始创建") | 69 | + Logger.debug(TAG, "开始创建") |
| 68 | let traceId = '' | 70 | let traceId = '' |
| 69 | this.avPlayer = AliPlayerFactory.createAliPlayer(getContext(), traceId) | 71 | this.avPlayer = AliPlayerFactory.createAliPlayer(getContext(), traceId) |
| 70 | if (this.avPlayer) { | 72 | if (this.avPlayer) { |
| 71 | - Logger.debug("创建完成1") | 73 | + Logger.debug(TAG, "创建完成1") |
| 72 | setupPlayerConfig(this.avPlayer!) | 74 | setupPlayerConfig(this.avPlayer!) |
| 73 | this.bindState(); | 75 | this.bindState(); |
| 74 | resolve(); | 76 | resolve(); |
| 75 | } else { | 77 | } else { |
| 76 | - Logger.error("创建完成0") | ||
| 77 | - Logger.error('[WDPlayerController] createAvPlayer fail!'); | 78 | + Logger.error(TAG, "创建完成0") |
| 79 | + Logger.error(TAG, '[WDPlayerController] createAvPlayer fail!'); | ||
| 78 | reject(); | 80 | reject(); |
| 79 | } | 81 | } |
| 80 | }); | 82 | }); |
| 81 | } | 83 | } |
| 82 | 84 | ||
| 83 | public destory() { | 85 | public destory() { |
| 84 | - Logger.debug("播放器销毁") | 86 | + Logger.debug(TAG, "播放器销毁") |
| 85 | this.avPlayer?.stop() | 87 | this.avPlayer?.stop() |
| 86 | this.avPlayer?.release() | 88 | this.avPlayer?.release() |
| 87 | } | 89 | } |
| @@ -94,13 +96,13 @@ export class WDAliPlayerController { | @@ -94,13 +96,13 @@ export class WDAliPlayerController { | ||
| 94 | // 当调用play()方法后,会调用 | 96 | // 当调用play()方法后,会调用 |
| 95 | onPrepared: () => { | 97 | onPrepared: () => { |
| 96 | this.duration = this.avPlayer?.getDuration(); | 98 | this.duration = this.avPlayer?.getDuration(); |
| 97 | - Logger.debug("已准备好", `${this.duration}`) | 99 | + Logger.debug(TAG, "已准备好", `${this.duration}`) |
| 98 | } | 100 | } |
| 99 | } | 101 | } |
| 100 | ); | 102 | ); |
| 101 | this.avPlayer?.setOnRenderingStartListener({ | 103 | this.avPlayer?.setOnRenderingStartListener({ |
| 102 | onRenderingStart: () => { | 104 | onRenderingStart: () => { |
| 103 | - Logger.debug("首帧开始显示") | 105 | + Logger.debug(TAG, "首帧开始显示") |
| 104 | if (this.onFirstFrameDisplay) { | 106 | if (this.onFirstFrameDisplay) { |
| 105 | this.onFirstFrameDisplay() | 107 | this.onFirstFrameDisplay() |
| 106 | } | 108 | } |
| @@ -108,7 +110,7 @@ export class WDAliPlayerController { | @@ -108,7 +110,7 @@ export class WDAliPlayerController { | ||
| 108 | }); | 110 | }); |
| 109 | this.avPlayer?.setOnCompletionListener({ | 111 | this.avPlayer?.setOnCompletionListener({ |
| 110 | onCompletion: () => { | 112 | onCompletion: () => { |
| 111 | - Logger.debug("播放完成") | 113 | + Logger.debug(TAG, "播放完成") |
| 112 | } | 114 | } |
| 113 | }); | 115 | }); |
| 114 | this.avPlayer?.setOnInfoListener({ | 116 | this.avPlayer?.setOnInfoListener({ |
| @@ -116,7 +118,7 @@ export class WDAliPlayerController { | @@ -116,7 +118,7 @@ export class WDAliPlayerController { | ||
| 116 | 118 | ||
| 117 | if (bean.getCode() === InfoCode.CurrentPosition) { | 119 | if (bean.getCode() === InfoCode.CurrentPosition) { |
| 118 | let position : number = bean.getExtraValue() | 120 | let position : number = bean.getExtraValue() |
| 119 | - Logger.debug(`播放进度条:${position}/ ${this.duration}`) | 121 | + Logger.debug(TAG, `播放进度条:${position}/ ${this.duration}`) |
| 120 | this.initProgress(position); | 122 | this.initProgress(position); |
| 121 | 123 | ||
| 122 | } else if (bean.getCode() === InfoCode.BufferedPosition) { | 124 | } else if (bean.getCode() === InfoCode.BufferedPosition) { |
| @@ -126,7 +128,7 @@ export class WDAliPlayerController { | @@ -126,7 +128,7 @@ export class WDAliPlayerController { | ||
| 126 | } | 128 | } |
| 127 | 129 | ||
| 128 | } else if (bean.getCode() === InfoCode.SwitchToSoftwareVideoDecoder) { | 130 | } else if (bean.getCode() === InfoCode.SwitchToSoftwareVideoDecoder) { |
| 129 | - Logger.debug(`DOWNGRADE TO SOFTWARE DECODE`) | 131 | + Logger.debug(TAG, `DOWNGRADE TO SOFTWARE DECODE`) |
| 130 | // this.mSwitchedToSoftListener?.onSwitched(); | 132 | // this.mSwitchedToSoftListener?.onSwitched(); |
| 131 | } | 133 | } |
| 132 | } | 134 | } |
| @@ -134,7 +136,7 @@ export class WDAliPlayerController { | @@ -134,7 +136,7 @@ export class WDAliPlayerController { | ||
| 134 | this.avPlayer?.setOnStateChangedListener({ | 136 | this.avPlayer?.setOnStateChangedListener({ |
| 135 | onStateChanged: (status: number) => { | 137 | onStateChanged: (status: number) => { |
| 136 | this.avPlayerStatus = status | 138 | this.avPlayerStatus = status |
| 137 | - Logger.debug("status update:" + `${this.getStatusStringWith(status)}`) | 139 | + Logger.debug(TAG, "status update:" + `${this.getStatusStringWith(status)}`) |
| 138 | 140 | ||
| 139 | switch (status) { | 141 | switch (status) { |
| 140 | case initalized: { | 142 | case initalized: { |
| @@ -189,7 +191,7 @@ export class WDAliPlayerController { | @@ -189,7 +191,7 @@ export class WDAliPlayerController { | ||
| 189 | }); | 191 | }); |
| 190 | this.avPlayer?.setOnErrorListener({ | 192 | this.avPlayer?.setOnErrorListener({ |
| 191 | onError:(errorInfo) => { | 193 | onError:(errorInfo) => { |
| 192 | - Logger.error("播放错误", JSON.stringify(errorInfo)) | 194 | + Logger.error(TAG, "播放错误", JSON.stringify(errorInfo)) |
| 193 | this.errorCode = errorInfo.getCode() | 195 | this.errorCode = errorInfo.getCode() |
| 194 | this.errorMesage = errorInfo.getMsg() | 196 | this.errorMesage = errorInfo.getMsg() |
| 195 | this.status = PlayerConstants.STATUS_ERROR; | 197 | this.status = PlayerConstants.STATUS_ERROR; |
| @@ -240,16 +242,24 @@ export class WDAliPlayerController { | @@ -240,16 +242,24 @@ export class WDAliPlayerController { | ||
| 240 | 242 | ||
| 241 | setXComponentController(controller: XComponentController) { | 243 | setXComponentController(controller: XComponentController) { |
| 242 | this.setSurfaceId(controller.getXComponentSurfaceId()) | 244 | this.setSurfaceId(controller.getXComponentSurfaceId()) |
| 245 | + if (this.avPlayerStatus > PlayerConstants.STATUS_IDLE) { | ||
| 246 | + Logger.info(TAG, "设置SurfaceId: " + this.surfaceId) | ||
| 247 | + this.avPlayer?.setSurfaceId(this.surfaceId) | ||
| 248 | + } | ||
| 243 | } | 249 | } |
| 244 | 250 | ||
| 245 | setSurfaceId(surfaceId: string) { | 251 | setSurfaceId(surfaceId: string) { |
| 246 | this.surfaceId = surfaceId | 252 | this.surfaceId = surfaceId |
| 253 | + if (this.avPlayerStatus > PlayerConstants.STATUS_IDLE) { | ||
| 254 | + Logger.info(TAG, "设置SurfaceId: " + this.surfaceId) | ||
| 255 | + this.avPlayer?.setSurfaceId(this.surfaceId) | ||
| 256 | + } | ||
| 247 | } | 257 | } |
| 248 | 258 | ||
| 249 | async firstPlay(url: string) { | 259 | async firstPlay(url: string) { |
| 250 | this.url = url; | 260 | this.url = url; |
| 251 | if (this.avPlayer == null) { | 261 | if (this.avPlayer == null) { |
| 252 | - Logger.info("等待播放器初始化") | 262 | + Logger.info(TAG, "等待播放器初始化") |
| 253 | await this.initPromise; | 263 | await this.initPromise; |
| 254 | } else { | 264 | } else { |
| 255 | if (this.avPlayerStatus != idle) { | 265 | if (this.avPlayerStatus != idle) { |
| @@ -269,10 +279,10 @@ export class WDAliPlayerController { | @@ -269,10 +279,10 @@ export class WDAliPlayerController { | ||
| 269 | 279 | ||
| 270 | this.avPlayer?.setAutoPlay(false) | 280 | this.avPlayer?.setAutoPlay(false) |
| 271 | 281 | ||
| 272 | - Logger.debug("开始播放", this.url) | 282 | + Logger.debug(TAG, "开始播放", this.url) |
| 273 | this.setAliPlayerURL(this.url); | 283 | this.setAliPlayerURL(this.url); |
| 274 | 284 | ||
| 275 | - Logger.info("设置SurfaceId" + this.surfaceId) | 285 | + Logger.info(TAG, "设置SurfaceId: " + this.surfaceId) |
| 276 | this.avPlayer?.setSurfaceId(this.surfaceId) | 286 | this.avPlayer?.setSurfaceId(this.surfaceId) |
| 277 | 287 | ||
| 278 | this.avPlayer?.prepare() | 288 | this.avPlayer?.prepare() |
| @@ -287,17 +297,17 @@ export class WDAliPlayerController { | @@ -287,17 +297,17 @@ export class WDAliPlayerController { | ||
| 287 | } | 297 | } |
| 288 | 298 | ||
| 289 | pause() { | 299 | pause() { |
| 290 | - Logger.debug("暂停", this.url) | 300 | + Logger.debug(TAG, "暂停", this.url) |
| 291 | this.avPlayer?.pause(); | 301 | this.avPlayer?.pause(); |
| 292 | } | 302 | } |
| 293 | 303 | ||
| 294 | play() { | 304 | play() { |
| 295 | - Logger.debug("播放", this.url) | 305 | + Logger.debug(TAG, "播放", this.url) |
| 296 | this.avPlayer?.start(); | 306 | this.avPlayer?.start(); |
| 297 | } | 307 | } |
| 298 | 308 | ||
| 299 | stop() { | 309 | stop() { |
| 300 | - Logger.debug("停止", this.url) | 310 | + Logger.debug(TAG, "停止", this.url) |
| 301 | this.avPlayer?.stop(); | 311 | this.avPlayer?.stop(); |
| 302 | } | 312 | } |
| 303 | 313 | ||
| @@ -405,7 +415,7 @@ export class WDAliPlayerController { | @@ -405,7 +415,7 @@ export class WDAliPlayerController { | ||
| 405 | if (this.onVolumeUpdate) { | 415 | if (this.onVolumeUpdate) { |
| 406 | this.onVolumeUpdate(this.volume); | 416 | this.onVolumeUpdate(this.volume); |
| 407 | } | 417 | } |
| 408 | - console.log("volume : " + this.volume) | 418 | + Logger.debug(TAG, "volume : " + this.volume) |
| 409 | } | 419 | } |
| 410 | 420 | ||
| 411 | onBrightActionUpdate(event: GestureEvent) { | 421 | onBrightActionUpdate(event: GestureEvent) { |
| @@ -429,7 +439,7 @@ export class WDAliPlayerController { | @@ -429,7 +439,7 @@ export class WDAliPlayerController { | ||
| 429 | } | 439 | } |
| 430 | 440 | ||
| 431 | watchStatus() { | 441 | watchStatus() { |
| 432 | - console.log('watchStatus', this.status) | 442 | + Logger.debug(TAG, 'watchStatus: ' + this.status) |
| 433 | if (this.onStatusChange) { | 443 | if (this.onStatusChange) { |
| 434 | this.onStatusChange(this.status) | 444 | this.onStatusChange(this.status) |
| 435 | } | 445 | } |
| 1 | +import componentUtils from '@ohos.arkui.componentUtils'; | ||
| 2 | +import { WDPlayerController } from '../controller/WDPlayerController' | ||
| 3 | +import { WindowModel } from 'wdKit'; | ||
| 4 | +import { Logger } from '../utils/Logger'; | ||
| 5 | +import { enableAliPlayer } from '../utils/GlobalSetting'; | ||
| 6 | +import { WDAliPlayerController } from '../controller/WDAliPlayerController'; | ||
| 7 | + | ||
| 8 | +class Size { | ||
| 9 | + width: Length = "100%"; | ||
| 10 | + height: Length = "100%"; | ||
| 11 | + | ||
| 12 | + constructor(width: Length, height: Length) { | ||
| 13 | + this.width = width; | ||
| 14 | + this.height = height; | ||
| 15 | + } | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +let insIndex: number = 0; | ||
| 19 | +const TAG = 'AliPlayerRenderView' | ||
| 20 | + | ||
| 21 | +class MGPlayRenderViewIns { | ||
| 22 | + static intCount: number = 0; | ||
| 23 | + | ||
| 24 | + static add() { | ||
| 25 | + MGPlayRenderViewIns.intCount++; | ||
| 26 | + WindowModel.shared.setWindowKeepScreenOn(true); | ||
| 27 | + console.log("add-- +1") | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + static del() { | ||
| 31 | + console.log("del-- -1") | ||
| 32 | + MGPlayRenderViewIns.intCount--; | ||
| 33 | + if (MGPlayRenderViewIns.intCount <= 0) { | ||
| 34 | + WindowModel.shared.setWindowKeepScreenOn(false); | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +/** | ||
| 40 | + * 播放窗口组件,对接阿里播放器的RenderView | ||
| 41 | + */ | ||
| 42 | +@Component | ||
| 43 | +export struct AliPlayerRenderView { | ||
| 44 | + private playerController?: WDAliPlayerController; | ||
| 45 | + private xComponentController: XComponentController = new XComponentController(); | ||
| 46 | + private insId: string = "AliPlayerRenderView" + insIndex; | ||
| 47 | + onLoad?: ((event?: object) => void); | ||
| 48 | + @State videoWidth: number = 16 | ||
| 49 | + @State videoHeight: number = 9 | ||
| 50 | + @State videoRatio: number = 16 / 9 | ||
| 51 | + @State selfSize: Size = new Size('100%', '100%'); | ||
| 52 | + private enableAliPlayer = true | ||
| 53 | + | ||
| 54 | + aboutToAppear() { | ||
| 55 | + MGPlayRenderViewIns.add(); | ||
| 56 | + | ||
| 57 | + insIndex++; | ||
| 58 | + if (!this.playerController) { | ||
| 59 | + return | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + this.playerController.onVideoSizeChange = (width: number, height: number) => { | ||
| 63 | + // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) | ||
| 64 | + Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`) | ||
| 65 | + this.videoWidth = width; | ||
| 66 | + this.videoHeight = height; | ||
| 67 | + this.videoRatio = width / height | ||
| 68 | + this.updateLayout() | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + aboutToDisappear() { | ||
| 73 | + Logger.info(TAG, `aboutToDisappear`) | ||
| 74 | + MGPlayRenderViewIns.del(); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + build() { | ||
| 78 | + Row() { | ||
| 79 | + // 设置为“surface“类型时XComponent组件可以和其他组件一起进行布局和渲染。 | ||
| 80 | + XComponent({ | ||
| 81 | + id: this.insId, | ||
| 82 | + type: XComponentType.SURFACE, | ||
| 83 | + libraryname: enableAliPlayer && this.enableAliPlayer ? "premierlibrary" : undefined, | ||
| 84 | + controller: this.xComponentController | ||
| 85 | + }) | ||
| 86 | + .onLoad(async (event) => { | ||
| 87 | + Logger.info(TAG, 'onLoad') | ||
| 88 | + this.xComponentController.setXComponentSurfaceSize({ | ||
| 89 | + surfaceWidth: 1920, | ||
| 90 | + surfaceHeight: 1080 | ||
| 91 | + }); | ||
| 92 | + if (enableAliPlayer && this.enableAliPlayer) { | ||
| 93 | + this.playerController?.setSurfaceId(this.insId) | ||
| 94 | + } else { | ||
| 95 | + this.playerController?.setXComponentController(this.xComponentController) | ||
| 96 | + } | ||
| 97 | + if (this.onLoad) { | ||
| 98 | + this.onLoad(event) | ||
| 99 | + } | ||
| 100 | + }) | ||
| 101 | + .zIndex(1000) | ||
| 102 | + .width(this.selfSize.width) | ||
| 103 | + .height(this.selfSize.height) | ||
| 104 | + } | ||
| 105 | + .onAreaChange(() => { | ||
| 106 | + this.updateLayout() | ||
| 107 | + }) | ||
| 108 | + .backgroundColor("#000000") | ||
| 109 | + .justifyContent(FlexAlign.Center) | ||
| 110 | + .height('100%') | ||
| 111 | + .width('100%') | ||
| 112 | + .align(this.videoWidth > this.videoHeight ? Alignment.Top : Alignment.Center) | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + updateLayout() { | ||
| 116 | + let info = componentUtils.getRectangleById(this.insId); | ||
| 117 | + if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) { | ||
| 118 | + if (info.size.width / info.size.height > this.videoWidth / this.videoHeight) { | ||
| 119 | + let scale = info.size.height / this.videoHeight; | ||
| 120 | + this.selfSize = new Size((this.videoWidth * scale / info.size.width) * 100 + "%", '100%'); | ||
| 121 | + } else { | ||
| 122 | + let scale = info.size.width / this.videoWidth; | ||
| 123 | + this.selfSize = new Size('100%', (this.videoHeight * scale / info.size.height) * 100 + "%"); | ||
| 124 | + } | ||
| 125 | + } | ||
| 126 | + } | ||
| 127 | +} |
| @@ -3,6 +3,7 @@ import { WDPlayerController } from '../controller/WDPlayerController' | @@ -3,6 +3,7 @@ import { WDPlayerController } from '../controller/WDPlayerController' | ||
| 3 | import { WindowModel } from 'wdKit'; | 3 | import { WindowModel } from 'wdKit'; |
| 4 | import { Logger } from '../utils/Logger'; | 4 | import { Logger } from '../utils/Logger'; |
| 5 | import { enableAliPlayer } from '../utils/GlobalSetting'; | 5 | import { enableAliPlayer } from '../utils/GlobalSetting'; |
| 6 | +import { WDAliPlayerController } from '../controller/WDAliPlayerController'; | ||
| 6 | 7 | ||
| 7 | class Size { | 8 | class Size { |
| 8 | width: Length = "100%"; | 9 | width: Length = "100%"; |
| @@ -40,7 +41,7 @@ class MGPlayRenderViewIns { | @@ -40,7 +41,7 @@ class MGPlayRenderViewIns { | ||
| 40 | */ | 41 | */ |
| 41 | @Component | 42 | @Component |
| 42 | export struct WDPlayerRenderLiveView { | 43 | export struct WDPlayerRenderLiveView { |
| 43 | - private playerController?: WDPlayerController; | 44 | + private playerController?: WDAliPlayerController; |
| 44 | private xComponentController: XComponentController = new XComponentController(); | 45 | private xComponentController: XComponentController = new XComponentController(); |
| 45 | onLoad?: ((event?: object) => void); | 46 | onLoad?: ((event?: object) => void); |
| 46 | videoWidth: number = 0 | 47 | videoWidth: number = 0 |
| @@ -3,6 +3,7 @@ import { WDPlayerController } from '../controller/WDPlayerController' | @@ -3,6 +3,7 @@ import { WDPlayerController } from '../controller/WDPlayerController' | ||
| 3 | import { WindowModel } from 'wdKit'; | 3 | import { WindowModel } from 'wdKit'; |
| 4 | import { Logger } from '../utils/Logger'; | 4 | import { Logger } from '../utils/Logger'; |
| 5 | import { enableAliPlayer } from '../utils/GlobalSetting'; | 5 | import { enableAliPlayer } from '../utils/GlobalSetting'; |
| 6 | +import { WDAliPlayerController } from '../controller/WDAliPlayerController'; | ||
| 6 | 7 | ||
| 7 | class Size { | 8 | class Size { |
| 8 | width: Length = "100%"; | 9 | width: Length = "100%"; |
| @@ -40,7 +41,7 @@ class MGPlayRenderViewIns { | @@ -40,7 +41,7 @@ class MGPlayRenderViewIns { | ||
| 40 | */ | 41 | */ |
| 41 | @Component | 42 | @Component |
| 42 | export struct WDPlayerRenderVLiveView { | 43 | export struct WDPlayerRenderVLiveView { |
| 43 | - private playerController?: WDPlayerController; | 44 | + private playerController?: WDAliPlayerController; |
| 44 | private xComponentController: XComponentController = new XComponentController(); | 45 | private xComponentController: XComponentController = new XComponentController(); |
| 45 | private insId: string = "WDPlayRenderView" + insIndex; | 46 | private insId: string = "WDPlayRenderView" + insIndex; |
| 46 | onLoad?: ((event?: object) => void); | 47 | onLoad?: ((event?: object) => void); |
| @@ -48,6 +48,7 @@ export struct WDPlayerRenderView { | @@ -48,6 +48,7 @@ export struct WDPlayerRenderView { | ||
| 48 | @State videoHeight: number = 9 | 48 | @State videoHeight: number = 9 |
| 49 | @State videoRatio: number = 16 / 9 | 49 | @State videoRatio: number = 16 / 9 |
| 50 | @State selfSize: Size = new Size('100%', '100%'); | 50 | @State selfSize: Size = new Size('100%', '100%'); |
| 51 | + private enableAliPlayer = false | ||
| 51 | 52 | ||
| 52 | aboutToAppear() { | 53 | aboutToAppear() { |
| 53 | MGPlayRenderViewIns.add(); | 54 | MGPlayRenderViewIns.add(); |
| @@ -78,7 +79,7 @@ export struct WDPlayerRenderView { | @@ -78,7 +79,7 @@ export struct WDPlayerRenderView { | ||
| 78 | XComponent({ | 79 | XComponent({ |
| 79 | id: this.insId, | 80 | id: this.insId, |
| 80 | type: XComponentType.SURFACE, | 81 | type: XComponentType.SURFACE, |
| 81 | - libraryname: enableAliPlayer ? "premierlibrary" : undefined, | 82 | + libraryname: enableAliPlayer && this.enableAliPlayer ? "premierlibrary" : undefined, |
| 82 | controller: this.xComponentController | 83 | controller: this.xComponentController |
| 83 | }) | 84 | }) |
| 84 | .onLoad(async (event) => { | 85 | .onLoad(async (event) => { |
| @@ -87,7 +88,7 @@ export struct WDPlayerRenderView { | @@ -87,7 +88,7 @@ export struct WDPlayerRenderView { | ||
| 87 | surfaceWidth: 1920, | 88 | surfaceWidth: 1920, |
| 88 | surfaceHeight: 1080 | 89 | surfaceHeight: 1080 |
| 89 | }); | 90 | }); |
| 90 | - if (enableAliPlayer) { | 91 | + if (enableAliPlayer && this.enableAliPlayer) { |
| 91 | this.playerController?.setSurfaceId(this.insId) | 92 | this.playerController?.setSurfaceId(this.insId) |
| 92 | } else { | 93 | } else { |
| 93 | this.playerController?.setXComponentController(this.xComponentController) | 94 | this.playerController?.setXComponentController(this.xComponentController) |
| @@ -43,4 +43,4 @@ export function setupPlayerConfig(player: AliPlayer) { | @@ -43,4 +43,4 @@ export function setupPlayerConfig(player: AliPlayer) { | ||
| 43 | * 3、WDAliListPlayerController 暂时由于SDK问题,不能使用 | 43 | * 3、WDAliListPlayerController 暂时由于SDK问题,不能使用 |
| 44 | * 4、 | 44 | * 4、 |
| 45 | * */ | 45 | * */ |
| 46 | -export const enableAliPlayer = false | ||
| 46 | +export const enableAliPlayer = true |
| @@ -97,7 +97,7 @@ export namespace TrackConstants { | @@ -97,7 +97,7 @@ export namespace TrackConstants { | ||
| 97 | 97 | ||
| 98 | /// 设置页 | 98 | /// 设置页 |
| 99 | Setting = "settingPage", | 99 | Setting = "settingPage", |
| 100 | - /// 账号管理 | 100 | + /// 账号管理//账户与安全 |
| 101 | Account_Management = "accountManagementPage", | 101 | Account_Management = "accountManagementPage", |
| 102 | /// 注销账户 | 102 | /// 注销账户 |
| 103 | Cancel_Account = "cancelAccountPage", | 103 | Cancel_Account = "cancelAccountPage", |
-
Please register or login to post a comment