From 61a28b9150da82298ad0c64d95be5e76c3ba1866 Mon Sep 17 00:00:00 2001 From: XiuYun CHEN Date: Tue, 17 Jun 2025 13:18:34 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/src/main/ets/pages/VideoSelected.ets | 2 +- .../ets/polyv/PLVMockMediaResourceData.ts | 22 ++++++++++--------- .../Home/src/main/ets/polyv/VideoUtil.ets | 11 +++++++--- .../src/main/ets/pages/Tabbar/TabBarComp.ets | 11 +++++++++- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/features/Home/src/main/ets/pages/VideoSelected.ets b/features/Home/src/main/ets/pages/VideoSelected.ets index 63c69ba..682b5c5 100644 --- a/features/Home/src/main/ets/pages/VideoSelected.ets +++ b/features/Home/src/main/ets/pages/VideoSelected.ets @@ -9,7 +9,7 @@ export struct VideoSelected{ Column() { HdNav({ title: this.params.title, showRightIcon: false, showLeftIcon: true }) - ListCompVideoSelect({type_uuid:this.params.uuid}).backgroundColor(Color.White).height('100%') + ListCompVideoSelect({type_uuid:this.params.uuid}).backgroundColor(Color.White).layoutWeight(1) }.width('100%') .height('100%').backgroundColor($r('app.color.top_bg')) } diff --git a/features/Home/src/main/ets/polyv/PLVMockMediaResourceData.ts b/features/Home/src/main/ets/polyv/PLVMockMediaResourceData.ts index f1dc779..d6b3b07 100644 --- a/features/Home/src/main/ets/polyv/PLVMockMediaResourceData.ts +++ b/features/Home/src/main/ets/polyv/PLVMockMediaResourceData.ts @@ -10,6 +10,7 @@ import { } from '@polyvharmony/media-player-sdk'; import {PLVMediaDownloadSetting} from '@polyvharmony/media-player-sdk-addon-cache-down'; + const mockAuthentication: PLVVodMainAccountAuthentication = { userId: "cfb7a69a75", secretKey: "4KtJhl9EqU" @@ -20,8 +21,8 @@ const mockAuthentication: PLVVodMainAccountAuthentication = { // } const mockViewerParam: PLVViewerParam = { - viewerId: "123", - viewerName: "123" + viewerId:'', + viewerName: "" } export class PLVMockMediaResourceData { @@ -54,9 +55,9 @@ export class PLVMockMediaResourceData { return this.mediaResources } - public setupMediaResourcesFromLocal(vid:string):Promise { + public setupMediaResourcesFromLocal(vid:string,param:PLVViewerParam):Promise { return this.mediaResources = Promise.resolve([ - vod(vid) + vod(vid,param) // vod("e97dbe3e648aefc2eb6f68b96db9db6c_e"), // vod("e97dbe3e6401ea8f76617bafe32f57e9_e"), // vod("e97dbe3e64ed6e0aac558e43787df1b4_e"), @@ -87,21 +88,22 @@ export class PLVMockMediaResourceData { } private setupMediaResourcesFromServer() { - this.mediaResources = PLVGeneralApiManager.getVodVideoList(mockAuthentication, 1, 20) - .then(result => { - return result.data!.map(video => vod(video!.vid!)) - }) + // this.mediaResources = PLVGeneralApiManager.getVodVideoList(mockAuthentication, 1, 20) + // .then(result => { + // return result.data!.map(video => vod(video!.vid!)) + // }) } } - function vod(videoId: string): PLVVodMediaResource { + function vod(videoId: string,param:PLVViewerParam): PLVVodMediaResource { // 默认下载路径 const defaultDownloadRoot = PLVMediaDownloadSetting.defaultSetting(PLVMediaPlayerAppContext.getInstance().appContext!).downloadRootDirectory return { videoId: videoId, authentication: mockAuthentication, - viewerParam: mockViewerParam, + viewerParam:param, + // viewerParam: mockViewerParam, scene: "vod", localVideoSearchPaths: [defaultDownloadRoot] } diff --git a/features/Home/src/main/ets/polyv/VideoUtil.ets b/features/Home/src/main/ets/polyv/VideoUtil.ets index 25cc7e6..67ce6dc 100644 --- a/features/Home/src/main/ets/polyv/VideoUtil.ets +++ b/features/Home/src/main/ets/polyv/VideoUtil.ets @@ -1,5 +1,5 @@ -import { runCatching, seconds } from '@polyvharmony/media-player-sdk'; -import { BasicConstant } from '@itcast/basic' +import { runCatching, seconds ,PLVViewerParam} from '@polyvharmony/media-player-sdk'; +import { BasicConstant,authStore,preferenceStore } from '@itcast/basic' import { promptAction, router } from '@kit.ArkUI'; import { PLVMockMediaResourceData } from '../polyv/PLVMockMediaResourceData' import { @@ -9,10 +9,15 @@ import HashMap from '@ohos.util.HashMap'; import { hdHttp, HdResponse ,logger} from '@itcast/basic/Index' import { BusinessError } from '@kit.BasicServicesKit'; import { VideoDetailModel } from '../model/VideoDetailModel' +const mockViewerParam: PLVViewerParam = { + viewerId:preferenceStore.getItemString(BasicConstant.POLVID), + viewerName: authStore.getUser().realName +} class VideoTools { hashMap: HashMap = new HashMap(); getVideoDetail(video_uuid:string) { + this.hashMap.clear(); this.hashMap.set('video_uuid', video_uuid) hdHttp.httpReq(BasicConstant.videoDetail,this.hashMap).then(async (res: HdResponse) => { @@ -61,7 +66,7 @@ class VideoTools { async goPLVMediaPlayerSingleVideoPage(vid:string,video_uuid:string) { - const mediaResourcesResult = await runCatching(PLVMockMediaResourceData.getInstance().setupMediaResourcesFromLocal(vid)) + const mediaResourcesResult = await runCatching(PLVMockMediaResourceData.getInstance().setupMediaResourcesFromLocal(vid,mockViewerParam)) if (mediaResourcesResult.success === false) { promptAction.showToast({ message: `'视频数据初始化失败': ${mediaResourcesResult.error}`, diff --git a/products/expert/src/main/ets/pages/Tabbar/TabBarComp.ets b/products/expert/src/main/ets/pages/Tabbar/TabBarComp.ets index 64aa920..804d6c2 100644 --- a/products/expert/src/main/ets/pages/Tabbar/TabBarComp.ets +++ b/products/expert/src/main/ets/pages/Tabbar/TabBarComp.ets @@ -2,7 +2,7 @@ import { VideoPage,VideoGandan } from 'home' import { MyHomePage } from 'mypage' import { TabBarCompModel } from '../../models/TabBarCompModel' import { TabBarItems } from '../../contants/TabBarItems' -import { BasicConstant } from '@itcast/basic' +import { BasicConstant,AESEncryptionDecryption,authStore,preferenceStore } from '@itcast/basic' import mediaquery from '@ohos.mediaquery'; @Component @@ -17,11 +17,20 @@ export struct TabBarComp { @Provide toTop:boolean=false; aboutToAppear() { + this.getPolyid() this.listenerScreen.on('change', (mediaQueryResult) => { this.isLandscape = mediaQueryResult.matches }) } + async getPolyid() + { + let mobile =authStore.getUser().mobile + let mobile_encryption = mobile +BasicConstant.polvId; + let signs =await AESEncryptionDecryption.aesEncrypt(mobile_encryption,"deoep09_klodLdAo") + preferenceStore.setItemString(BasicConstant.POLVID,signs) + } + @Builder TabBarBuilder(item: TabBarCompModel, index: number) { Column({ space: BasicConstant.SPACE_SM }) {