Showing
9 changed files
with
37 additions
and
176 deletions
| @@ -15,5 +15,6 @@ export interface ExtraDTO extends ItemDTO { | @@ -15,5 +15,6 @@ export interface ExtraDTO extends ItemDTO { | ||
| 15 | relType: string; | 15 | relType: string; |
| 16 | liveStreamType?: number; | 16 | liveStreamType?: number; |
| 17 | photoList: PhotoListBean[]; | 17 | photoList: PhotoListBean[]; |
| 18 | + swiperIndex?: number | ||
| 18 | commentId?: string; | 19 | commentId?: string; |
| 19 | } | 20 | } |
| @@ -71,8 +71,6 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi | @@ -71,8 +71,6 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi | ||
| 71 | 71 | ||
| 72 | export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" | 72 | export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" |
| 73 | 73 | ||
| 74 | -export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent" | ||
| 75 | - | ||
| 76 | export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" | 74 | export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" |
| 77 | 75 | ||
| 78 | export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" | 76 | export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" |
| @@ -20,7 +20,7 @@ export struct ImageDownloadComponent { | @@ -20,7 +20,7 @@ export struct ImageDownloadComponent { | ||
| 20 | @State image: PixelMap | undefined = undefined; | 20 | @State image: PixelMap | undefined = undefined; |
| 21 | @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 | 21 | @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 |
| 22 | @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer | 22 | @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer |
| 23 | - url: string = '' | 23 | + @Prop @Watch('onChangeUrl') url: string = '' |
| 24 | 24 | ||
| 25 | build() { | 25 | build() { |
| 26 | Column() { | 26 | Column() { |
| @@ -40,7 +40,11 @@ export struct ImageDownloadComponent { | @@ -40,7 +40,11 @@ export struct ImageDownloadComponent { | ||
| 40 | 40 | ||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | - async aboutToAppear(): Promise<void> { | 43 | + aboutToAppear(): void { |
| 44 | + this.onChangeUrl() | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + async onChangeUrl(): Promise<void> { | ||
| 44 | console.info(`cj2024 图片下载 ${this.url}`) | 48 | console.info(`cj2024 图片下载 ${this.url}`) |
| 45 | const context = getContext(this) as common.UIAbilityContext; | 49 | const context = getContext(this) as common.UIAbilityContext; |
| 46 | const atManager = abilityAccessCtrl.createAtManager(); | 50 | const atManager = abilityAccessCtrl.createAtManager(); |
sight_harmony/features/wdComponent/src/main/ets/components/ImageSwiperComponent.ets
deleted
100644 → 0
| 1 | -import { PhotoListBean } from 'wdBean/Index'; | ||
| 2 | -import { Logger } from 'wdKit/Index'; | ||
| 3 | -import { display, router } from '@kit.ArkUI'; | ||
| 4 | -import { ImageDownloadComponent } from './ImageDownloadComponent'; | ||
| 5 | -import { ImageItemView } from './view/ImageItemView'; | ||
| 6 | - | ||
| 7 | -const TAG = 'ImageSwiperComponent'; | ||
| 8 | - | ||
| 9 | -@Component | ||
| 10 | -export struct ImageSwiperComponent { | ||
| 11 | - @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | ||
| 12 | - private scroller: Scroller = new Scroller() | ||
| 13 | - @State swiperIndex: number = 0; | ||
| 14 | - photoList: PhotoListBean[] = []; | ||
| 15 | - private swiperController: SwiperController = new SwiperController() | ||
| 16 | - private displayTool = display.getDefaultDisplaySync() | ||
| 17 | - private screenWidth: number = 0 | ||
| 18 | - private picWidth: number = 0 | ||
| 19 | - @State picHeight: number = 0 | ||
| 20 | - @State isEnableSwipe: boolean = true; | ||
| 21 | - | ||
| 22 | - // @Provide bgc: Color = Color.White; | ||
| 23 | - | ||
| 24 | - //watch监听页码回调 | ||
| 25 | - onCurrentPageNumUpdated(): void { | ||
| 26 | - Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,) | ||
| 27 | - let _swiperIndex = Number.parseInt(this.currentPageNum) | ||
| 28 | - Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) | ||
| 29 | - this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - aboutToAppear(): void { | ||
| 33 | - //获取宽高尺寸 | ||
| 34 | - this.screenWidth = this.displayTool.width | ||
| 35 | - // this.picWidth = this.screenWidth - vp2px(52) | ||
| 36 | - this.picWidth = this.screenWidth | ||
| 37 | - this.picHeight = this.picWidth * 578 / 375 | ||
| 38 | - } | ||
| 39 | - | ||
| 40 | - build() { | ||
| 41 | - RelativeContainer() { | ||
| 42 | - Image($r('app.media.icon_arrow_left_white')) | ||
| 43 | - .width(24) | ||
| 44 | - .height(24) | ||
| 45 | - .aspectRatio(1) | ||
| 46 | - .interpolation(ImageInterpolation.High) | ||
| 47 | - .alignRules({ | ||
| 48 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 49 | - left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 50 | - }) | ||
| 51 | - .onClick(() => { | ||
| 52 | - router.back(); | ||
| 53 | - }) | ||
| 54 | - .id("backImg") | ||
| 55 | - | ||
| 56 | - if (this.photoList && this.photoList?.length > 0) { | ||
| 57 | - Swiper(this.swiperController) { | ||
| 58 | - ForEach(this.photoList, (item: PhotoListBean) => { | ||
| 59 | - // MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | ||
| 60 | - ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe }) | ||
| 61 | - }) | ||
| 62 | - } | ||
| 63 | - .index(this.swiperIndex) | ||
| 64 | - .width('100%') | ||
| 65 | - .height(px2vp(this.picHeight) + 32) | ||
| 66 | - .vertical(false) | ||
| 67 | - .autoPlay(false) | ||
| 68 | - .cachedCount(3) | ||
| 69 | - .indicator(false) | ||
| 70 | - .displayCount(1) | ||
| 71 | - .id('e_swiper_content') | ||
| 72 | - .alignRules({ | ||
| 73 | - center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 74 | - middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 75 | - }) | ||
| 76 | - .onChange((index: number) => { | ||
| 77 | - this.swiperIndex = index | ||
| 78 | - }) | ||
| 79 | - | ||
| 80 | - Row() { | ||
| 81 | - Scroll(this.scroller) { | ||
| 82 | - Row() { | ||
| 83 | - Flex({ | ||
| 84 | - direction: FlexDirection.Column, | ||
| 85 | - justifyContent: FlexAlign.Start | ||
| 86 | - }) { | ||
| 87 | - Text() { | ||
| 88 | - Span(`${this.swiperIndex + 1}`) | ||
| 89 | - .fontSize(24) | ||
| 90 | - .fontFamily('PingFang SC-Medium') | ||
| 91 | - .fontWeight(500) | ||
| 92 | - .lineHeight(28) | ||
| 93 | - Span(`/${this.photoList.length}`) | ||
| 94 | - .fontSize(14) | ||
| 95 | - .fontFamily('PingFang SC-Medium') | ||
| 96 | - .fontWeight(500) | ||
| 97 | - .lineHeight(19) | ||
| 98 | - }.fontColor(Color.White).margin(4) | ||
| 99 | - } | ||
| 100 | - } | ||
| 101 | - .width('100%') | ||
| 102 | - .margin({ | ||
| 103 | - top: 8, | ||
| 104 | - left: 18, | ||
| 105 | - bottom: 24, | ||
| 106 | - right: 18 | ||
| 107 | - }) | ||
| 108 | - } | ||
| 109 | - .scrollable(ScrollDirection.Vertical) | ||
| 110 | - .scrollBarWidth(0) | ||
| 111 | - } | ||
| 112 | - .id('e_swiper_titles') | ||
| 113 | - .alignRules({ | ||
| 114 | - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 115 | - middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 116 | - }) | ||
| 117 | - } | ||
| 118 | - | ||
| 119 | - ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath }) | ||
| 120 | - .alignRules({ | ||
| 121 | - bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 122 | - right: { anchor: "__container__", align: HorizontalAlign.End } | ||
| 123 | - }) | ||
| 124 | - .margin({ | ||
| 125 | - top: 8, | ||
| 126 | - left: 18, | ||
| 127 | - bottom: 24, | ||
| 128 | - right: 18 | ||
| 129 | - }) | ||
| 130 | - .id("downloadImg") | ||
| 131 | - } | ||
| 132 | - .width('100%') | ||
| 133 | - .height('100%') | ||
| 134 | - .backgroundColor(Color.Black) | ||
| 135 | - .id('e_picture_container') | ||
| 136 | - // 设置顶部绘制延伸到状态栏 | ||
| 137 | - // 设置底部绘制延伸到导航条 | ||
| 138 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 139 | - } | ||
| 140 | -} |
| 1 | import { PhotoListBean } from 'wdBean/Index'; | 1 | import { PhotoListBean } from 'wdBean/Index'; |
| 2 | import { display, router } from '@kit.ArkUI'; | 2 | import { display, router } from '@kit.ArkUI'; |
| 3 | -import { Logger } from 'wdKit/Index'; | ||
| 4 | import { ImageItemView } from '../components/view/ImageItemView'; | 3 | import { ImageItemView } from '../components/view/ImageItemView'; |
| 5 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; | 4 | import { ImageDownloadComponent } from '../components/ImageDownloadComponent'; |
| 6 | import { Action } from 'wdBean'; | 5 | import { Action } from 'wdBean'; |
| @@ -10,7 +9,6 @@ const TAG = 'MultiPictureListPage'; | @@ -10,7 +9,6 @@ const TAG = 'MultiPictureListPage'; | ||
| 10 | @Entry | 9 | @Entry |
| 11 | @Component | 10 | @Component |
| 12 | export struct MultiPictureListPage { | 11 | export struct MultiPictureListPage { |
| 13 | - @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | ||
| 14 | private scroller: Scroller = new Scroller() | 12 | private scroller: Scroller = new Scroller() |
| 15 | @State swiperIndex: number = 0; | 13 | @State swiperIndex: number = 0; |
| 16 | photoList: PhotoListBean[] = []; | 14 | photoList: PhotoListBean[] = []; |
| @@ -20,17 +18,10 @@ export struct MultiPictureListPage { | @@ -20,17 +18,10 @@ export struct MultiPictureListPage { | ||
| 20 | private picWidth: number = 0 | 18 | private picWidth: number = 0 |
| 21 | @State picHeight: number = 0 | 19 | @State picHeight: number = 0 |
| 22 | @State isEnableSwipe: boolean = true; | 20 | @State isEnableSwipe: boolean = true; |
| 21 | + @State currentUrl: string = '' | ||
| 23 | 22 | ||
| 24 | // @Provide bgc: Color = Color.White; | 23 | // @Provide bgc: Color = Color.White; |
| 25 | 24 | ||
| 26 | - //watch监听页码回调 | ||
| 27 | - onCurrentPageNumUpdated(): void { | ||
| 28 | - Logger.info(TAG, `currentPageNum:${this.currentPageNum}`,) | ||
| 29 | - let _swiperIndex = Number.parseInt(this.currentPageNum) | ||
| 30 | - Logger.info(TAG, `_swiperIndex:${_swiperIndex}`) | ||
| 31 | - this.swiperIndex = _swiperIndex > 0 ? _swiperIndex - 1 : _swiperIndex | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | aboutToAppear(): void { | 25 | aboutToAppear(): void { |
| 35 | //获取宽高尺寸 | 26 | //获取宽高尺寸 |
| 36 | this.screenWidth = this.displayTool.width | 27 | this.screenWidth = this.displayTool.width |
| @@ -40,6 +31,8 @@ export struct MultiPictureListPage { | @@ -40,6 +31,8 @@ export struct MultiPictureListPage { | ||
| 40 | let par: Action = router.getParams() as Action; | 31 | let par: Action = router.getParams() as Action; |
| 41 | let params = par?.params; | 32 | let params = par?.params; |
| 42 | this.photoList = params?.extra?.photoList || []; | 33 | this.photoList = params?.extra?.photoList || []; |
| 34 | + this.swiperIndex = params?.extra?.swiperIndex || 0; | ||
| 35 | + this.currentUrl = this.photoList[this.swiperIndex]?.picPath | ||
| 43 | } | 36 | } |
| 44 | 37 | ||
| 45 | build() { | 38 | build() { |
| @@ -80,6 +73,7 @@ export struct MultiPictureListPage { | @@ -80,6 +73,7 @@ export struct MultiPictureListPage { | ||
| 80 | }) | 73 | }) |
| 81 | .onChange((index: number) => { | 74 | .onChange((index: number) => { |
| 82 | this.swiperIndex = index | 75 | this.swiperIndex = index |
| 76 | + this.currentUrl = this.photoList[index]?.picPath | ||
| 83 | }) | 77 | }) |
| 84 | 78 | ||
| 85 | Row() { | 79 | Row() { |
| @@ -121,7 +115,7 @@ export struct MultiPictureListPage { | @@ -121,7 +115,7 @@ export struct MultiPictureListPage { | ||
| 121 | }) | 115 | }) |
| 122 | } | 116 | } |
| 123 | 117 | ||
| 124 | - ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath }) | 118 | + ImageDownloadComponent({ url: this.currentUrl }) |
| 125 | .alignRules({ | 119 | .alignRules({ |
| 126 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 120 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 127 | right: { anchor: "__container__", align: HorizontalAlign.End } | 121 | right: { anchor: "__container__", align: HorizontalAlign.End } |
| @@ -32,15 +32,15 @@ export struct DetailPlayLivePage { | @@ -32,15 +32,15 @@ export struct DetailPlayLivePage { | ||
| 32 | 32 | ||
| 33 | aboutToAppear(): void { | 33 | aboutToAppear(): void { |
| 34 | Logger.info(TAG, `wyj-aboutToAppear`) | 34 | Logger.info(TAG, `wyj-aboutToAppear`) |
| 35 | - this.listener?.on("change", (mediaQueryResult) => { | ||
| 36 | - Logger.info(TAG, `change;${mediaQueryResult.matches}`) | ||
| 37 | - if (mediaQueryResult?.matches) { | ||
| 38 | - this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL | ||
| 39 | - } else { | ||
| 40 | - this.displayDirection = DisplayDirection.VERTICAL | ||
| 41 | - } | ||
| 42 | - WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL) | ||
| 43 | - }) | 35 | + // this.listener?.on("change", (mediaQueryResult) => { |
| 36 | + // Logger.info(TAG, `change;${mediaQueryResult.matches}`) | ||
| 37 | + // if (mediaQueryResult?.matches) { | ||
| 38 | + // this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL | ||
| 39 | + // } else { | ||
| 40 | + // this.displayDirection = DisplayDirection.VERTICAL | ||
| 41 | + // } | ||
| 42 | + // WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL) | ||
| 43 | + // }) | ||
| 44 | this.getLiveDetails() | 44 | this.getLiveDetails() |
| 45 | this.getLiveRoomData() | 45 | this.getLiveRoomData() |
| 46 | } | 46 | } |
| @@ -67,7 +67,7 @@ export struct DetailPlayLivePage { | @@ -67,7 +67,7 @@ export struct DetailPlayLivePage { | ||
| 67 | 67 | ||
| 68 | onPageShowCus(): void { | 68 | onPageShowCus(): void { |
| 69 | Logger.info(TAG, `wyj-onPageShowCus`) | 69 | Logger.info(TAG, `wyj-onPageShowCus`) |
| 70 | - // WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); | 70 | + // WindowModel.shared.setPreferredOrientation(window.Orientation.LOCKED); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | onPageHideCus(): void { | 73 | onPageHideCus(): void { |
| @@ -100,7 +100,7 @@ export struct TabLiveItemComponent { | @@ -100,7 +100,7 @@ export struct TabLiveItemComponent { | ||
| 100 | picDesc: '' | 100 | picDesc: '' |
| 101 | }) | 101 | }) |
| 102 | } | 102 | } |
| 103 | - this.gotoMultipleListImagePage() | 103 | + this.gotoMultipleListImagePage(index) |
| 104 | }) | 104 | }) |
| 105 | }) | 105 | }) |
| 106 | } | 106 | } |
| @@ -187,13 +187,14 @@ export struct TabLiveItemComponent { | @@ -187,13 +187,14 @@ export struct TabLiveItemComponent { | ||
| 187 | * 大图列表页 | 187 | * 大图列表页 |
| 188 | * @param content | 188 | * @param content |
| 189 | * */ | 189 | * */ |
| 190 | - gotoMultipleListImagePage() { | 190 | + gotoMultipleListImagePage(index: number) { |
| 191 | let taskAction: Action = { | 191 | let taskAction: Action = { |
| 192 | type: 'JUMP_DETAIL_PAGE', | 192 | type: 'JUMP_DETAIL_PAGE', |
| 193 | params: { | 193 | params: { |
| 194 | detailPageType: 18, | 194 | detailPageType: 18, |
| 195 | extra: { | 195 | extra: { |
| 196 | - photoList: this.photoList | 196 | + photoList: this.photoList, |
| 197 | + swiperIndex: index, | ||
| 197 | } as ExtraDTO | 198 | } as ExtraDTO |
| 198 | } as Params, | 199 | } as Params, |
| 199 | }; | 200 | }; |
| @@ -191,12 +191,15 @@ export struct PlayUIComponent { | @@ -191,12 +191,15 @@ export struct PlayUIComponent { | ||
| 191 | 191 | ||
| 192 | @Builder | 192 | @Builder |
| 193 | getMiddleUIComponent() { | 193 | getMiddleUIComponent() { |
| 194 | - Stack() | ||
| 195 | - .layoutWeight(1) | ||
| 196 | - .width('100%') | ||
| 197 | - .onClick(() => { | ||
| 198 | - this.isMenuVisible = !this.isMenuVisible | ||
| 199 | - }) | 194 | + Stack() { |
| 195 | + Text('播放功能暂时关闭') | ||
| 196 | + .fontColor(Color.White) | ||
| 197 | + }.alignContent(Alignment.Center) | ||
| 198 | + .layoutWeight(1) | ||
| 199 | + .width('100%') | ||
| 200 | + .onClick(() => { | ||
| 201 | + this.isMenuVisible = !this.isMenuVisible | ||
| 202 | + }) | ||
| 200 | } | 203 | } |
| 201 | 204 | ||
| 202 | @Builder | 205 | @Builder |
| @@ -13,7 +13,7 @@ export struct TopPlayComponent { | @@ -13,7 +13,7 @@ export struct TopPlayComponent { | ||
| 13 | aboutToAppear(): void { | 13 | aboutToAppear(): void { |
| 14 | if (this.playerController) { | 14 | if (this.playerController) { |
| 15 | this.playerController.onCanplay = () => { | 15 | this.playerController.onCanplay = () => { |
| 16 | - this.playerController?.play() | 16 | + // this.playerController?.play() |
| 17 | } | 17 | } |
| 18 | } | 18 | } |
| 19 | } | 19 | } |
| @@ -31,7 +31,7 @@ export struct TopPlayComponent { | @@ -31,7 +31,7 @@ export struct TopPlayComponent { | ||
| 31 | } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { | 31 | } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { |
| 32 | playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri | 32 | playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri |
| 33 | } | 33 | } |
| 34 | - this.playerController?.firstPlay(playUrl); | 34 | + // this.playerController?.firstPlay(playUrl); |
| 35 | } | 35 | } |
| 36 | } | 36 | } |
| 37 | 37 |
-
Please register or login to post a comment