Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
14 changed files
with
203 additions
and
66 deletions
| @@ -11,6 +11,7 @@ export struct CustomToast { | @@ -11,6 +11,7 @@ export struct CustomToast { | ||
| 11 | fontSizeValue :number | string | Resource = "27lpx" | 11 | fontSizeValue :number | string | Resource = "27lpx" |
| 12 | lineHeightValue :number | string | Resource = "38lpx" | 12 | lineHeightValue :number | string | Resource = "38lpx" |
| 13 | controller: CustomDialogController | 13 | controller: CustomDialogController |
| 14 | + marginTop :number | string | Resource = 0 | ||
| 14 | 15 | ||
| 15 | dismiss: () => void = () => { | 16 | dismiss: () => void = () => { |
| 16 | } | 17 | } |
| @@ -38,5 +39,6 @@ export struct CustomToast { | @@ -38,5 +39,6 @@ export struct CustomToast { | ||
| 38 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) | 39 | .padding({top:"23lpx",bottom:'23lpx',left:"35lpx",right:"35lpx"}) |
| 39 | .backgroundColor(this.bgColor) | 40 | .backgroundColor(this.bgColor) |
| 40 | .opacity(this.opacityValue) | 41 | .opacity(this.opacityValue) |
| 42 | + .margin({top:this.marginTop}) | ||
| 41 | } | 43 | } |
| 42 | } | 44 | } |
| @@ -12,7 +12,8 @@ import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed | @@ -12,7 +12,8 @@ import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed | ||
| 12 | const TAG = 'Card16Component'; | 12 | const TAG = 'Card16Component'; |
| 13 | 13 | ||
| 14 | interface fullColumnImgUrlItem { | 14 | interface fullColumnImgUrlItem { |
| 15 | - url: string | 15 | + url: string, |
| 16 | + fullUrl: string | ||
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | 19 | ||
| @@ -81,16 +82,46 @@ export struct Card16Component { | @@ -81,16 +82,46 @@ export struct Card16Component { | ||
| 81 | .lineHeight(25) | 82 | .lineHeight(25) |
| 82 | } | 83 | } |
| 83 | if (this.contentDTO.fullColumnImgUrls?.length > 0) { | 84 | if (this.contentDTO.fullColumnImgUrls?.length > 0) { |
| 84 | - Flex() { | 85 | + //三图 |
| 86 | + Stack(){ | ||
| 87 | + Row() { | ||
| 88 | + GridRow({ gutter: 2 }) { | ||
| 85 | ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => { | 89 | ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => { |
| 86 | - Image(this.loadImg ? item.url : '') | 90 | + if (index < 3) { |
| 91 | + GridCol({ span: { xs: 4 } }) { | ||
| 92 | + Image(this.loadImg ? item.url || item.fullUrl : '') | ||
| 87 | .backgroundColor(0xf5f5f5) | 93 | .backgroundColor(0xf5f5f5) |
| 88 | - .flexBasis(113) | ||
| 89 | - .height(75) | ||
| 90 | - .margin({ right: index > 1 ? 0 : 2 }) | 94 | + .width('100%') |
| 95 | + .aspectRatio(113 / 75) | ||
| 96 | + .borderRadius({ | ||
| 97 | + topLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 98 | + topRight: index === 2 ? $r('app.float.image_border_radius') : 0, | ||
| 99 | + bottomLeft: index === 0 ? $r('app.float.image_border_radius') : 0, | ||
| 100 | + bottomRight: index === 2 ? $r('app.float.image_border_radius') : 0, | ||
| 91 | }) | 101 | }) |
| 92 | } | 102 | } |
| 93 | } | 103 | } |
| 104 | + }) | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + .width(CommonConstants.FULL_PARENT) | ||
| 108 | + .margin({ top: 8 }) | ||
| 109 | + CardMediaInfo({ | ||
| 110 | + contentDTO: this.contentDTO | ||
| 111 | + }) | ||
| 112 | + } | ||
| 113 | + .width(CommonConstants.FULL_PARENT) | ||
| 114 | + .alignContent(Alignment.BottomEnd) | ||
| 115 | + // Flex() { | ||
| 116 | + // ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => { | ||
| 117 | + // Image(this.loadImg ? item.url : '') | ||
| 118 | + // .backgroundColor(0xf5f5f5) | ||
| 119 | + // .flexBasis(113) | ||
| 120 | + // .height(75) | ||
| 121 | + // .margin({ right: index > 1 ? 0 : 2 }) | ||
| 122 | + // }) | ||
| 123 | + // } | ||
| 124 | + } | ||
| 94 | CarderInteraction({contentDTO: this.contentDTO}) | 125 | CarderInteraction({contentDTO: this.contentDTO}) |
| 95 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 126 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 96 | } | 127 | } |
| @@ -11,6 +11,7 @@ import { channelSkeleton } from '../skeleton/channelSkeleton'; | @@ -11,6 +11,7 @@ import { channelSkeleton } from '../skeleton/channelSkeleton'; | ||
| 11 | import { TrackConstants, TrackingButton } from 'wdTracking/Index'; | 11 | import { TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 12 | import DailyPaperTopicModel from '../../model/DailyPaperTopicModel' | 12 | import DailyPaperTopicModel from '../../model/DailyPaperTopicModel' |
| 13 | import { ParamType, Tracking } from 'wdTracking/Index'; | 13 | import { ParamType, Tracking } from 'wdTracking/Index'; |
| 14 | +import { CompUtils } from '../../utils/CompUtils'; | ||
| 14 | 15 | ||
| 15 | const TAG = 'TopNavigationComponent'; | 16 | const TAG = 'TopNavigationComponent'; |
| 16 | 17 | ||
| @@ -23,27 +24,16 @@ const storage = LocalStorage.getShared(); | @@ -23,27 +24,16 @@ const storage = LocalStorage.getShared(); | ||
| 23 | @Component | 24 | @Component |
| 24 | export struct TopNavigationComponentNew { | 25 | export struct TopNavigationComponentNew { |
| 25 | private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px'; | 26 | private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px'; |
| 26 | - /** | ||
| 27 | - * @deprecated | ||
| 28 | - */ | ||
| 29 | - private groupId: number = 0 | ||
| 30 | - /** | ||
| 31 | - * @deprecated TODO type判断 | ||
| 32 | - */ | ||
| 33 | - private currentBottomNavName: string = '' | ||
| 34 | private pageName: string = '' | 27 | private pageName: string = '' |
| 35 | private pageId: number = 0 | 28 | private pageId: number = 0 |
| 36 | private swiperController: SwiperController = new SwiperController() | 29 | private swiperController: SwiperController = new SwiperController() |
| 37 | private listScroller: Scroller = new Scroller() | 30 | private listScroller: Scroller = new Scroller() |
| 38 | - @Consume barBackgroundColor: Color | ||
| 39 | /** | 31 | /** |
| 40 | - * @deprecated | 32 | + * 首页 底导 某个tab 对象 |
| 41 | */ | 33 | */ |
| 42 | - @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 43 | - /** | ||
| 44 | - * @deprecated | ||
| 45 | - */ | ||
| 46 | - @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 34 | + navItem: BottomNavDTO = {} as BottomNavDTO |
| 35 | + @Consume barBackgroundColor: Color | ||
| 36 | + | ||
| 47 | @Link _currentNavIndex?: number; | 37 | @Link _currentNavIndex?: number; |
| 48 | // 顶导当前选中/焦点下标 | 38 | // 顶导当前选中/焦点下标 |
| 49 | @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0; | 39 | @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0; |
| @@ -70,7 +60,6 @@ export struct TopNavigationComponentNew { | @@ -70,7 +60,6 @@ export struct TopNavigationComponentNew { | ||
| 70 | @State animationDuration: number = 0 | 60 | @State animationDuration: number = 0 |
| 71 | @State indicatorLeftMargin: number = 0 | 61 | @State indicatorLeftMargin: number = 0 |
| 72 | @State indicatorWidth: number = 0 | 62 | @State indicatorWidth: number = 0 |
| 73 | - private tabsWidth: number = 0 | ||
| 74 | 63 | ||
| 75 | build() { | 64 | build() { |
| 76 | Column() { | 65 | Column() { |
| @@ -78,9 +67,10 @@ export struct TopNavigationComponentNew { | @@ -78,9 +67,10 @@ export struct TopNavigationComponentNew { | ||
| 78 | RelativeContainer() { | 67 | RelativeContainer() { |
| 79 | this.tabBar() | 68 | this.tabBar() |
| 80 | Swiper(this.swiperController) { | 69 | Swiper(this.swiperController) { |
| 81 | - ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, | 70 | + ForEach(CompUtils.isNews(this.navItem) ? this.myChannelList : this.topNavList, |
| 82 | (navItem: TopNavDTO, index: number) => { | 71 | (navItem: TopNavDTO, index: number) => { |
| 83 | - if (this.currentBottomNavName === '人民号' && navItem.name === '关注') { | 72 | + if (CompUtils.isRMH(this.navItem) && navItem.channelType === 3) { |
| 73 | + // 人民号 -- 关注tab | ||
| 84 | PeopleShipMainComponent({ | 74 | PeopleShipMainComponent({ |
| 85 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | 75 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, |
| 86 | navIndex: index, | 76 | navIndex: index, |
| @@ -203,8 +193,7 @@ export struct TopNavigationComponentNew { | @@ -203,8 +193,7 @@ export struct TopNavigationComponentNew { | ||
| 203 | 193 | ||
| 204 | @Builder | 194 | @Builder |
| 205 | tabBar() { | 195 | tabBar() { |
| 206 | - // TODO 判断是否新闻tab,修改方法(,_currentNavIndex==0 都不对,需要用type)(用topStyle) | ||
| 207 | - if (this.currentBottomNavName === '新闻') { | 196 | + if (CompUtils.isNews(this.navItem)) { |
| 208 | // 顶部搜索、日报logo、早晚报 | 197 | // 顶部搜索、日报logo、早晚报 |
| 209 | this.topBar() | 198 | this.topBar() |
| 210 | ChannelSubscriptionLayout({ | 199 | ChannelSubscriptionLayout({ |
| @@ -233,13 +222,9 @@ export struct TopNavigationComponentNew { | @@ -233,13 +222,9 @@ export struct TopNavigationComponentNew { | ||
| 233 | .listDirection(Axis.Horizontal) | 222 | .listDirection(Axis.Horizontal) |
| 234 | .scrollBar(BarState.Off) | 223 | .scrollBar(BarState.Off) |
| 235 | .edgeEffect(EdgeEffect.None) | 224 | .edgeEffect(EdgeEffect.None) |
| 236 | - .padding({ left: 8, top:0, right: 0 }) | 225 | + .padding({ left: 8, top: 0, right: 0 }) |
| 237 | .height($r('app.float.top_tab_bar_height')) | 226 | .height($r('app.float.top_tab_bar_height')) |
| 238 | .backgroundColor(this.barBackgroundColor) | 227 | .backgroundColor(this.barBackgroundColor) |
| 239 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 240 | - let width = Number.parseFloat(newValue.width.toString()) | ||
| 241 | - this.tabsWidth = Number.isNaN(width) ? 0 : width | ||
| 242 | - }) | ||
| 243 | .id('tabList') | 228 | .id('tabList') |
| 244 | .alignRules({ | 229 | .alignRules({ |
| 245 | 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom }, | 230 | 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom }, |
| @@ -278,10 +263,6 @@ export struct TopNavigationComponentNew { | @@ -278,10 +263,6 @@ export struct TopNavigationComponentNew { | ||
| 278 | .listDirection(Axis.Horizontal) | 263 | .listDirection(Axis.Horizontal) |
| 279 | .scrollBar(BarState.Off) | 264 | .scrollBar(BarState.Off) |
| 280 | .edgeEffect(EdgeEffect.None) | 265 | .edgeEffect(EdgeEffect.None) |
| 281 | - .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 282 | - let width = Number.parseFloat(newValue.width.toString()) | ||
| 283 | - this.tabsWidth = Number.isNaN(width) ? 0 : width | ||
| 284 | - }) | ||
| 285 | .height($r('app.float.top_tab_bar_height_common')) | 266 | .height($r('app.float.top_tab_bar_height_common')) |
| 286 | .backgroundColor(this.barBackgroundColor) | 267 | .backgroundColor(this.barBackgroundColor) |
| 287 | .id('tabList') | 268 | .id('tabList') |
| @@ -347,14 +328,18 @@ export struct TopNavigationComponentNew { | @@ -347,14 +328,18 @@ export struct TopNavigationComponentNew { | ||
| 347 | } else if (this.isLayoutByIndex(index)) { | 328 | } else if (this.isLayoutByIndex(index)) { |
| 348 | ProcessUtils.gotoENewsPaper() | 329 | ProcessUtils.gotoENewsPaper() |
| 349 | } else { | 330 | } else { |
| 350 | - this.currentTopNavSelectedIndex = index | ||
| 351 | this.changePage(index) | 331 | this.changePage(index) |
| 352 | } | 332 | } |
| 353 | } | 333 | } |
| 354 | }) | 334 | }) |
| 355 | } | 335 | } |
| 356 | 336 | ||
| 337 | + /** | ||
| 338 | + * 改变频道页 | ||
| 339 | + * @param index 频道所在的序列号 | ||
| 340 | + */ | ||
| 357 | private changePage(index: number) { | 341 | private changePage(index: number) { |
| 342 | + this.currentTopNavSelectedIndex = index | ||
| 358 | this.swiperController.changeIndex(index) | 343 | this.swiperController.changeIndex(index) |
| 359 | this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER) | 344 | this.listScroller.scrollToIndex(index, true, ScrollAlign.CENTER) |
| 360 | } | 345 | } |
| @@ -494,10 +479,9 @@ export struct TopNavigationComponentNew { | @@ -494,10 +479,9 @@ export struct TopNavigationComponentNew { | ||
| 494 | } | 479 | } |
| 495 | 480 | ||
| 496 | updateCurrentTopNavSelectedIndex() { | 481 | updateCurrentTopNavSelectedIndex() { |
| 497 | - Logger.info(TAG, `currentTopNavSelectedIndex : ${this.currentTopNavSelectedIndex}、${this.currentBottomNavName}`); | ||
| 498 | 482 | ||
| 499 | // 顶部tab埋点 | 483 | // 顶部tab埋点 |
| 500 | - if (this.currentBottomNavName === '新闻') { | 484 | + if (CompUtils.isVideo(this.navItem)) { |
| 501 | const tab = this.myChannelList[this.currentTopNavSelectedIndex] | 485 | const tab = this.myChannelList[this.currentTopNavSelectedIndex] |
| 502 | Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`); | 486 | Logger.info(TAG, `新闻tab埋点: ${JSON.stringify(tab)}`); |
| 503 | 487 | ||
| @@ -507,7 +491,7 @@ export struct TopNavigationComponentNew { | @@ -507,7 +491,7 @@ export struct TopNavigationComponentNew { | ||
| 507 | "pageId": tab.pageId, | 491 | "pageId": tab.pageId, |
| 508 | } | 492 | } |
| 509 | Tracking.event("home_page_tab_click ", params) | 493 | Tracking.event("home_page_tab_click ", params) |
| 510 | - } else if (this.currentBottomNavName === '人民号') { | 494 | + } else if (CompUtils.isRMH(this.navItem)) { |
| 511 | const tab = this.topNavList[this.currentTopNavSelectedIndex] | 495 | const tab = this.topNavList[this.currentTopNavSelectedIndex] |
| 512 | Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`); | 496 | Logger.info(TAG, `人民号tab埋点: ${JSON.stringify(tab)}`); |
| 513 | 497 |
| @@ -26,7 +26,9 @@ import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentio | @@ -26,7 +26,9 @@ import { PeopleShipAttentionContentListTopComponent } from './PeopleShipAttentio | ||
| 26 | import { CardParser } from '../CardParser' | 26 | import { CardParser } from '../CardParser' |
| 27 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; | 27 | import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData'; |
| 28 | const TAG = 'PeopleShipMainComponent'; | 28 | const TAG = 'PeopleShipMainComponent'; |
| 29 | -@Preview | 29 | +/** |
| 30 | + * 人民号 --- 关注 | ||
| 31 | + */ | ||
| 30 | @Component | 32 | @Component |
| 31 | export struct PeopleShipMainComponent { | 33 | export struct PeopleShipMainComponent { |
| 32 | @State private pageModel: PageModel = new PageModel(); | 34 | @State private pageModel: PageModel = new PageModel(); |
| @@ -422,6 +424,7 @@ export struct PeopleShipMainComponent { | @@ -422,6 +424,7 @@ export struct PeopleShipMainComponent { | ||
| 422 | } | 424 | } |
| 423 | // 当前页面,自动刷新数据 | 425 | // 当前页面,自动刷新数据 |
| 424 | Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh) | 426 | Logger.debug(TAG, 'page onAutoRefresh ' + this.autoRefresh) |
| 427 | + this.listScroller.scrollToIndex(0) | ||
| 425 | this.currentPage = 1 | 428 | this.currentPage = 1 |
| 426 | this.getData() | 429 | this.getData() |
| 427 | } | 430 | } |
| @@ -2,6 +2,7 @@ import { CommonConstants } from 'wdConstant' | @@ -2,6 +2,7 @@ import { CommonConstants } from 'wdConstant' | ||
| 2 | import { ContentDTO, CompDTO, Action, Params } from 'wdBean' | 2 | import { ContentDTO, CompDTO, Action, Params } from 'wdBean' |
| 3 | import { ProcessUtils, WDRouterRule, WDRouterPage } from 'wdRouter'; | 3 | import { ProcessUtils, WDRouterRule, WDRouterPage } from 'wdRouter'; |
| 4 | import { InfomationCardClick } from '../../utils/infomationCardClick'; | 4 | import { InfomationCardClick } from '../../utils/infomationCardClick'; |
| 5 | +import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | ||
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| 7 | export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | 8 | export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { |
| @@ -128,11 +129,18 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -128,11 +129,18 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 128 | Row() { | 129 | Row() { |
| 129 | ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { | 130 | ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => { |
| 130 | Column() { | 131 | Column() { |
| 132 | + Stack() { | ||
| 131 | Image(item.coverUrl) | 133 | Image(item.coverUrl) |
| 132 | .aspectRatio(1.5) | 134 | .aspectRatio(1.5) |
| 133 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | 135 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) |
| 134 | .borderRadius(4) | 136 | .borderRadius(4) |
| 135 | .objectFit(ImageFit.Cover) | 137 | .objectFit(ImageFit.Cover) |
| 138 | + CardMediaInfo({ | ||
| 139 | + livePeopleNum:false, | ||
| 140 | + contentDTO: item | ||
| 141 | + }) | ||
| 142 | + } | ||
| 143 | + .align(Alignment.BottomEnd) | ||
| 136 | 144 | ||
| 137 | Text(item.newsTitle) | 145 | Text(item.newsTitle) |
| 138 | .fontSize($r("app.float.font_size_14")) | 146 | .fontSize($r("app.float.font_size_14")) |
| @@ -143,10 +151,9 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -143,10 +151,9 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 143 | .textAlign(TextAlign.Start) | 151 | .textAlign(TextAlign.Start) |
| 144 | .margin({ top: 8 }) | 152 | .margin({ top: 8 }) |
| 145 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | 153 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) |
| 146 | - .lineHeight(19) | ||
| 147 | .lineHeight(21) | 154 | .lineHeight(21) |
| 148 | } | 155 | } |
| 149 | - .height(134) | 156 | + .height(this.compDTO.operDataList.length == 2 ? 190 : 150) |
| 150 | .padding({ right: 16 }) | 157 | .padding({ right: 16 }) |
| 151 | // .offset({x:16}) | 158 | // .offset({x:16}) |
| 152 | .onClick(() => { | 159 | .onClick(() => { |
| @@ -218,7 +225,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -218,7 +225,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 218 | left: $r('app.float.card_comp_pagePadding_lf'), | 225 | left: $r('app.float.card_comp_pagePadding_lf'), |
| 219 | right: $r('app.float.card_comp_pagePadding_lf'), | 226 | right: $r('app.float.card_comp_pagePadding_lf'), |
| 220 | top: $r('app.float.card_comp_pagePadding_tb'), | 227 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 221 | - bottom: $r('app.float.card_comp_pagePadding_tb') | 228 | + bottom: 6 |
| 222 | }) | 229 | }) |
| 223 | .backgroundColor($r("app.color.white")) | 230 | .backgroundColor($r("app.color.white")) |
| 224 | // .backgroundColor($r("app.color.color_FE4B05")) | 231 | // .backgroundColor($r("app.color.color_FE4B05")) |
| @@ -170,7 +170,7 @@ export struct LiveHorizontalCardComponent { | @@ -170,7 +170,7 @@ export struct LiveHorizontalCardComponent { | ||
| 170 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) | 170 | .width(this.compDTO.operDataList.length == 2 ? 210 : 150) |
| 171 | .lineHeight(21) | 171 | .lineHeight(21) |
| 172 | } | 172 | } |
| 173 | - .height(134) | 173 | + .height(this.compDTO.operDataList.length == 2 ? 190 : 150) |
| 174 | .padding({ right: 16 }) | 174 | .padding({ right: 16 }) |
| 175 | .onClick(() => { | 175 | .onClick(() => { |
| 176 | InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) | 176 | InfomationCardClick.track(this.compDTO, item, this.pageId, this.pageName) |
| @@ -243,7 +243,7 @@ export struct LiveHorizontalCardComponent { | @@ -243,7 +243,7 @@ export struct LiveHorizontalCardComponent { | ||
| 243 | left: $r('app.float.card_comp_pagePadding_lf'), | 243 | left: $r('app.float.card_comp_pagePadding_lf'), |
| 244 | right: $r('app.float.card_comp_pagePadding_lf'), | 244 | right: $r('app.float.card_comp_pagePadding_lf'), |
| 245 | top: $r('app.float.card_comp_pagePadding_tb'), | 245 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 246 | - bottom: $r('app.float.card_comp_pagePadding_tb') | 246 | + bottom: 6 |
| 247 | }) | 247 | }) |
| 248 | .backgroundColor($r("app.color.white")) | 248 | .backgroundColor($r("app.color.white")) |
| 249 | } | 249 | } |
| @@ -32,6 +32,45 @@ export class CompUtils { | @@ -32,6 +32,45 @@ export class CompUtils { | ||
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | + * 是视频tab | ||
| 36 | + * @param navItem | ||
| 37 | + * @returns | ||
| 38 | + */ | ||
| 39 | + static isVideo(navItem: BottomNavDTO) : boolean{ | ||
| 40 | + if (navItem == null) { | ||
| 41 | + return false; | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + return navItem.topStyle === '13'; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 是新闻tab | ||
| 49 | + * @param navItem | ||
| 50 | + * @returns | ||
| 51 | + */ | ||
| 52 | + static isNews(navItem: BottomNavDTO) : boolean{ | ||
| 53 | + if (navItem == null) { | ||
| 54 | + return false; | ||
| 55 | + | ||
| 56 | + } | ||
| 57 | + return navItem.topStyle === '11'; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 是人民号tab | ||
| 62 | + * @param navItem | ||
| 63 | + * @returns | ||
| 64 | + */ | ||
| 65 | + static isRMH(navItem: BottomNavDTO) : boolean{ | ||
| 66 | + if (navItem == null) { | ||
| 67 | + return false; | ||
| 68 | + | ||
| 69 | + } | ||
| 70 | + return navItem.topStyle === '12'; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + /** | ||
| 35 | * 获取Label标题 | 74 | * 获取Label标题 |
| 36 | * | 75 | * |
| 37 | * @param component 组件bean | 76 | * @param component 组件bean |
| @@ -15,4 +15,18 @@ async function onlyWifiLoadImg(): Promise<boolean> { | @@ -15,4 +15,18 @@ async function onlyWifiLoadImg(): Promise<boolean> { | ||
| 15 | return false | 15 | return false |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | -export { onlyWifiLoadImg } | ||
| 18 | +async function onlyWifiLoadVideo(): Promise<boolean> { | ||
| 19 | + let loadImageOnlyWifiSwitch = await SPHelper.default.get(SpConstants.SETTING_WIFI_VIDEO_SWITCH, '') || false; | ||
| 20 | + if (!loadImageOnlyWifiSwitch) { | ||
| 21 | + // 开关没开,直接让加载视频 | ||
| 22 | + return true | ||
| 23 | + } | ||
| 24 | + let netWorkStatus = NetworkUtil.getNetworkType(); | ||
| 25 | + // 开关打开,wifi下才加载视频 | ||
| 26 | + if (netWorkStatus === NetworkUtil.TYPE_WIFI) { | ||
| 27 | + return true | ||
| 28 | + } | ||
| 29 | + return false | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +export { onlyWifiLoadImg,onlyWifiLoadVideo } |
| @@ -4,12 +4,13 @@ import { TabComponent } from '../widgets/details/TabComponent'; | @@ -4,12 +4,13 @@ import { TabComponent } from '../widgets/details/TabComponent'; | ||
| 4 | import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; | 4 | import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; |
| 5 | import { DisplayDirection } from 'wdConstant/Index'; | 5 | import { DisplayDirection } from 'wdConstant/Index'; |
| 6 | import mediaquery from '@ohos.mediaquery'; | 6 | import mediaquery from '@ohos.mediaquery'; |
| 7 | -import { Logger, WindowModel } from 'wdKit/Index'; | 7 | +import { CustomToast, Logger, WindowModel } from 'wdKit/Index'; |
| 8 | import { router, window } from '@kit.ArkUI'; | 8 | import { router, window } from '@kit.ArkUI'; |
| 9 | import { WDAliPlayerController } from 'wdPlayer/Index'; | 9 | import { WDAliPlayerController } from 'wdPlayer/Index'; |
| 10 | import { LiveOperRowListView } from 'wdComponent'; | 10 | import { LiveOperRowListView } from 'wdComponent'; |
| 11 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; | 11 | import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; |
| 12 | import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'; | 12 | import { TrackConstants, TrackingContent, TrackParamConvert } from 'wdTracking/Index'; |
| 13 | +import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg'; | ||
| 13 | 14 | ||
| 14 | let TAG: string = 'DetailPlayLivePage'; | 15 | let TAG: string = 'DetailPlayLivePage'; |
| 15 | 16 | ||
| @@ -41,7 +42,28 @@ export struct DetailPlayLivePage { | @@ -41,7 +42,28 @@ export struct DetailPlayLivePage { | ||
| 41 | // 顶部状态栏高度 | 42 | // 顶部状态栏高度 |
| 42 | @Consume topSafeHeight: number | 43 | @Consume topSafeHeight: number |
| 43 | 44 | ||
| 44 | - aboutToAppear(): void { | 45 | + @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗" |
| 46 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 47 | + builder: CustomToast({ | ||
| 48 | + bgColor: 0xB3000000, | ||
| 49 | + opacityValue: 1, | ||
| 50 | + fontSizeValue: "25lpx", | ||
| 51 | + lineHeightValue: "36lpx", | ||
| 52 | + msg: this.toastText, | ||
| 53 | + marginTop:211/2+px2vp(this.topSafeHeight)-px2vp(84/2) | ||
| 54 | + }), | ||
| 55 | + autoCancel: false, | ||
| 56 | + alignment: DialogAlignment.Top, | ||
| 57 | + customStyle: true, | ||
| 58 | + maskColor: "#00000000" | ||
| 59 | + }) | ||
| 60 | + | ||
| 61 | + showToastTip(msg: ResourceStr) { | ||
| 62 | + this.toastText = msg | ||
| 63 | + this.dialogToast.open() | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + async aboutToAppear(): Promise<void> { | ||
| 45 | Logger.info(TAG, `wyj-aboutToAppear`) | 67 | Logger.info(TAG, `wyj-aboutToAppear`) |
| 46 | 68 | ||
| 47 | this.listener?.on("change", (mediaQueryResult) => { | 69 | this.listener?.on("change", (mediaQueryResult) => { |
| @@ -56,6 +78,9 @@ export struct DetailPlayLivePage { | @@ -56,6 +78,9 @@ export struct DetailPlayLivePage { | ||
| 56 | this.getLiveDetails() | 78 | this.getLiveDetails() |
| 57 | this.getLiveRoomData() | 79 | this.getLiveRoomData() |
| 58 | 80 | ||
| 81 | + if(!await onlyWifiLoadVideo()){ | ||
| 82 | + this.showToastTip(this.toastText) | ||
| 83 | + } | ||
| 59 | } | 84 | } |
| 60 | 85 | ||
| 61 | async aboutToDisappear() { | 86 | async aboutToDisappear() { |
| @@ -115,7 +140,6 @@ export struct DetailPlayLivePage { | @@ -115,7 +140,6 @@ export struct DetailPlayLivePage { | ||
| 115 | } | 140 | } |
| 116 | .height('100%') | 141 | .height('100%') |
| 117 | .width('100%') | 142 | .width('100%') |
| 118 | - | ||
| 119 | } | 143 | } |
| 120 | 144 | ||
| 121 | onPageShowCus(): void { | 145 | onPageShowCus(): void { |
| 1 | import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index'; | 1 | import { ContentDetailDTO, LiveRoomDataBean } from 'wdBean/Index'; |
| 2 | import { LiveViewModel } from '../viewModel/LiveViewModel'; | 2 | import { LiveViewModel } from '../viewModel/LiveViewModel'; |
| 3 | -import { WindowModel } from 'wdKit/Index'; | 3 | +import { CustomToast, WindowModel } from 'wdKit/Index'; |
| 4 | import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; | 4 | import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; |
| 5 | import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; | 5 | import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; |
| 6 | import { WDAliPlayerController } from 'wdPlayer/Index'; | 6 | import { WDAliPlayerController } from 'wdPlayer/Index'; |
| @@ -9,6 +9,7 @@ import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; | @@ -9,6 +9,7 @@ import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; | ||
| 9 | import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; | 9 | import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; |
| 10 | import { TrackConstants, TrackingButton } from 'wdTracking/Index'; | 10 | import { TrackConstants, TrackingButton } from 'wdTracking/Index'; |
| 11 | import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic'; | 11 | import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic'; |
| 12 | +import { onlyWifiLoadVideo } from 'wdComponent/src/main/ets/utils/lazyloadImg'; | ||
| 12 | 13 | ||
| 13 | const storage = LocalStorage.getShared(); | 14 | const storage = LocalStorage.getShared(); |
| 14 | const TAG = 'DetailPlayVLivePage' | 15 | const TAG = 'DetailPlayVLivePage' |
| @@ -40,11 +41,32 @@ export struct DetailPlayVLivePage { | @@ -40,11 +41,32 @@ export struct DetailPlayVLivePage { | ||
| 40 | //播放错误 | 41 | //播放错误 |
| 41 | @State isPlayerError: boolean = false | 42 | @State isPlayerError: boolean = false |
| 42 | @State isCanplay: boolean = false | 43 | @State isCanplay: boolean = false |
| 44 | + @State toastText: ResourceStr = "这是一个非Wi-Fi环境。请注意流量消耗" | ||
| 45 | + dialogToast: CustomDialogController = new CustomDialogController({ | ||
| 46 | + builder: CustomToast({ | ||
| 47 | + bgColor: 0xB3000000, | ||
| 48 | + opacityValue: 1, | ||
| 49 | + fontSizeValue: "25lpx", | ||
| 50 | + lineHeightValue: "36lpx", | ||
| 51 | + msg: this.toastText, | ||
| 52 | + }), | ||
| 53 | + autoCancel: false, | ||
| 54 | + alignment: DialogAlignment.Center, | ||
| 55 | + customStyle: true, | ||
| 56 | + maskColor: "#00000000" | ||
| 57 | + }) | ||
| 58 | + | ||
| 59 | + showToastTip(msg: ResourceStr) { | ||
| 60 | + this.toastText = msg | ||
| 61 | + this.dialogToast.open() | ||
| 62 | + } | ||
| 43 | 63 | ||
| 44 | - aboutToAppear(): void { | 64 | + async aboutToAppear(): Promise<void> { |
| 45 | this.openFullScreen() | 65 | this.openFullScreen() |
| 46 | this.getLiveRoomData() | 66 | this.getLiveRoomData() |
| 47 | - | 67 | + if(!await onlyWifiLoadVideo()){ |
| 68 | + this.showToastTip(this.toastText) | ||
| 69 | + } | ||
| 48 | } | 70 | } |
| 49 | 71 | ||
| 50 | aboutToDisappear(): void { | 72 | aboutToDisappear(): void { |
| @@ -17,7 +17,7 @@ export struct ColumnPage { | @@ -17,7 +17,7 @@ export struct ColumnPage { | ||
| 17 | pageId: string = ""; | 17 | pageId: string = ""; |
| 18 | channelId: string = ""; | 18 | channelId: string = ""; |
| 19 | pageName: string = '' | 19 | pageName: string = '' |
| 20 | - | 20 | + @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 21 | aboutToAppear() { | 21 | aboutToAppear() { |
| 22 | this.pageId = this.param.pageId | 22 | this.pageId = this.param.pageId |
| 23 | this.channelId = this.param.channelId | 23 | this.channelId = this.param.channelId |
| @@ -26,6 +26,7 @@ export struct ColumnPage { | @@ -26,6 +26,7 @@ export struct ColumnPage { | ||
| 26 | 26 | ||
| 27 | build() { | 27 | build() { |
| 28 | Column() { | 28 | Column() { |
| 29 | + Blank().height(`${this.topSafeHeight}px`) | ||
| 29 | CustomTitleUI({ titleName: this.pageName }) | 30 | CustomTitleUI({ titleName: this.pageName }) |
| 30 | PageComponent({ | 31 | PageComponent({ |
| 31 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | 32 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, |
| @@ -44,7 +44,7 @@ struct LaunchInterestsHobbiesPage { | @@ -44,7 +44,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 44 | .fontColor('#333333') | 44 | .fontColor('#333333') |
| 45 | .width('54lpx') | 45 | .width('54lpx') |
| 46 | .height('35lpx') | 46 | .height('35lpx') |
| 47 | - .margin({right:'46lpx'}) | 47 | + .margin({top:'30lpx',right:'46lpx'}) |
| 48 | .onClick(()=>{ | 48 | .onClick(()=>{ |
| 49 | //直接跳过到首页 | 49 | //直接跳过到首页 |
| 50 | //跳转首页 | 50 | //跳转首页 |
| @@ -64,7 +64,7 @@ struct LaunchInterestsHobbiesPage { | @@ -64,7 +64,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 64 | .fontColor('#333333') | 64 | .fontColor('#333333') |
| 65 | .width('100%') | 65 | .width('100%') |
| 66 | .height('61lpx') | 66 | .height('61lpx') |
| 67 | - .margin({top:'84lpx'}) | 67 | + .margin({top:'54lpx'}) |
| 68 | Text('完善信息,将为您推荐个性化的内容') | 68 | Text('完善信息,将为您推荐个性化的内容') |
| 69 | .fontSize('27lpx') | 69 | .fontSize('27lpx') |
| 70 | .textAlign(TextAlign.Center) | 70 | .textAlign(TextAlign.Center) |
| @@ -76,6 +76,7 @@ struct LaunchInterestsHobbiesPage { | @@ -76,6 +76,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 76 | if(!this.isConnectNetwork){ | 76 | if(!this.isConnectNetwork){ |
| 77 | EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => { | 77 | EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => { |
| 78 | this.isConnectNetwork = NetworkUtil.isNetConnected() | 78 | this.isConnectNetwork = NetworkUtil.isNetConnected() |
| 79 | + this.requestInterestsData() | ||
| 79 | }}) | 80 | }}) |
| 80 | .layoutWeight(1) | 81 | .layoutWeight(1) |
| 81 | .width('100%') | 82 | .width('100%') |
| @@ -81,7 +81,7 @@ export struct BottomNavigationComponent { | @@ -81,7 +81,7 @@ export struct BottomNavigationComponent { | ||
| 81 | if (CompUtils.isMine(navItem)) { | 81 | if (CompUtils.isMine(navItem)) { |
| 82 | // 我的页面组件数据列表 | 82 | // 我的页面组件数据列表 |
| 83 | MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 }) | 83 | MinePageComponent({ isMinePage: this.currentNavIndex === this.bottomNavList.length - 1 }) |
| 84 | - } else if (navItem.name === '视频') { | 84 | + } else if (CompUtils.isVideo(navItem)) { |
| 85 | // 视频频道,包含视频和直播 | 85 | // 视频频道,包含视频和直播 |
| 86 | VideoChannelPage({ | 86 | VideoChannelPage({ |
| 87 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | 87 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), |
| @@ -89,14 +89,14 @@ export struct BottomNavigationComponent { | @@ -89,14 +89,14 @@ export struct BottomNavigationComponent { | ||
| 89 | autoRefresh: this.autoRefresh | 89 | autoRefresh: this.autoRefresh |
| 90 | }) | 90 | }) |
| 91 | } else { | 91 | } else { |
| 92 | + // 其它带顶到的页面,如 新闻、人民号、服务 | ||
| 92 | TopNavigationComponentNew({ | 93 | TopNavigationComponentNew({ |
| 93 | - groupId: navItem.id, | ||
| 94 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), | 94 | topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), |
| 95 | _currentNavIndex: $currentNavIndex, | 95 | _currentNavIndex: $currentNavIndex, |
| 96 | bottomNavIndex: index, | 96 | bottomNavIndex: index, |
| 97 | - currentBottomNavName: navItem.name, | ||
| 98 | assignChannel: this.assignChannel, | 97 | assignChannel: this.assignChannel, |
| 99 | - autoRefresh: this.autoRefresh | 98 | + autoRefresh: this.autoRefresh, |
| 99 | + navItem: navItem | ||
| 100 | }) | 100 | }) |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| @@ -246,7 +246,7 @@ export struct BottomNavigationComponent { | @@ -246,7 +246,7 @@ export struct BottomNavigationComponent { | ||
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | onBottomNavigationDataUpdated() { | 248 | onBottomNavigationDataUpdated() { |
| 249 | - Logger.error('yyyy','onBottomNavigationDataUpdated '+JSON.stringify(this.bottomNavList)) | 249 | + Logger.error('yyyy', 'onBottomNavigationDataUpdated ' + JSON.stringify(this.bottomNavList)) |
| 250 | // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); | 250 | // Logger.info(TAG, `onBottomNavigationDataUpdated currentNavIndex: ${this.currentNavIndex},length:${this.bottomNavItemList.length}`); |
| 251 | } | 251 | } |
| 252 | 252 | ||
| @@ -353,11 +353,20 @@ export struct BottomNavigationComponent { | @@ -353,11 +353,20 @@ export struct BottomNavigationComponent { | ||
| 353 | list = list.filter(item => item.name !== '服务'); | 353 | list = list.filter(item => item.name !== '服务'); |
| 354 | list.forEach(item => { | 354 | list.forEach(item => { |
| 355 | switch (item.name) { | 355 | switch (item.name) { |
| 356 | - case '新闻': item.pageName = 'NEWS'; break; | ||
| 357 | - case '人民号': item.pageName = 'PEOPLE'; break; | ||
| 358 | - case '视频': item.pageName = 'VIDEOS'; break; | ||
| 359 | - case '我的': item.pageName = 'MY'; break; | ||
| 360 | - default : item.pageName = 'NEWS'; break; | 356 | + case '新闻': |
| 357 | + item.pageName = 'NEWS'; | ||
| 358 | + break; | ||
| 359 | + case '人民号': | ||
| 360 | + item.pageName = 'PEOPLE'; | ||
| 361 | + break; | ||
| 362 | + case '视频': | ||
| 363 | + item.pageName = 'VIDEOS'; | ||
| 364 | + break; | ||
| 365 | + case '我的': | ||
| 366 | + item.pageName = 'MY'; | ||
| 367 | + break; | ||
| 368 | + default: | ||
| 369 | + item.pageName = 'NEWS'; break; | ||
| 361 | } | 370 | } |
| 362 | }) | 371 | }) |
| 363 | this.bottomNavList = list | 372 | this.bottomNavList = list |
| @@ -58,7 +58,7 @@ export struct VideoChannelPage { | @@ -58,7 +58,7 @@ export struct VideoChannelPage { | ||
| 58 | * TODO:根据顶导配置获取颜色展示效果不对,待确认 | 58 | * TODO:根据顶导配置获取颜色展示效果不对,待确认 |
| 59 | */ | 59 | */ |
| 60 | getTopNavFontColor(item: TopNavDTO, index: number): Color | string { | 60 | getTopNavFontColor(item: TopNavDTO, index: number): Color | string { |
| 61 | - if (item.name === '视频' && this.currentBottomNavInfo.name === '视频') { | 61 | + if (item.channelStyle === 1) { |
| 62 | return this.currentTopNavSelectedIndex === index ? Color.White : '#949494' | 62 | return this.currentTopNavSelectedIndex === index ? Color.White : '#949494' |
| 63 | } else { | 63 | } else { |
| 64 | return this.currentTopNavSelectedIndex === index ? Color.Black : "#B2B2B2" | 64 | return this.currentTopNavSelectedIndex === index ? Color.Black : "#B2B2B2" |
-
Please register or login to post a comment