Showing
10 changed files
with
137 additions
and
71 deletions
| @@ -41,20 +41,20 @@ export default struct MinePageUserSimpleInfoUI { | @@ -41,20 +41,20 @@ export default struct MinePageUserSimpleInfoUI { | ||
| 41 | 41 | ||
| 42 | Image(this.isLogin?(this.headPhotoUrl?this.headPhotoUrl:this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon')):$r('app.media.default_head')) | 42 | Image(this.isLogin?(this.headPhotoUrl?this.headPhotoUrl:this.userType === "1"?$r('app.media.default_head'):$r('app.media.AccountOwner_DefaultIcon')):$r('app.media.default_head')) |
| 43 | .alt($r('app.media.default_head')) | 43 | .alt($r('app.media.default_head')) |
| 44 | - .width(`${this.calcHeight(110)}lpx`) | ||
| 45 | - .height(`${this.calcHeight(110)}lpx`) | 44 | + .width(`${this.calcHeight(120)}lpx`) |
| 45 | + .height(`${this.calcHeight(120)}lpx`) | ||
| 46 | .objectFit(ImageFit.Cover) | 46 | .objectFit(ImageFit.Cover) |
| 47 | .borderRadius(50) | 47 | .borderRadius(50) |
| 48 | 48 | ||
| 49 | if(StringUtils.isNotEmpty(this.levelHead)){ | 49 | if(StringUtils.isNotEmpty(this.levelHead)){ |
| 50 | Image(this.levelHead) | 50 | Image(this.levelHead) |
| 51 | - .width(`${this.calcHeight(140)}lpx`) | ||
| 52 | - .height(`${this.calcHeight(140)}lpx`) | 51 | + .width(`${this.calcHeight(155)}lpx`) |
| 52 | + .height(`${this.calcHeight(155)}lpx`) | ||
| 53 | .objectFit(ImageFit.Cover) | 53 | .objectFit(ImageFit.Cover) |
| 54 | .borderRadius(50) | 54 | .borderRadius(50) |
| 55 | } | 55 | } |
| 56 | - }.width(`${this.calcHeight(130)}lpx`) | ||
| 57 | - .height(`${this.calcHeight(130)}lpx`) | 56 | + }.width(`${this.calcHeight(140)}lpx`) |
| 57 | + .height(`${this.calcHeight(140)}lpx`) | ||
| 58 | .alignContent(Alignment.Center) | 58 | .alignContent(Alignment.Center) |
| 59 | .onClick(()=>{ | 59 | .onClick(()=>{ |
| 60 | this.jumpLogin() | 60 | this.jumpLogin() |
| @@ -21,7 +21,7 @@ export struct PagePersonFunction{ | @@ -21,7 +21,7 @@ export struct PagePersonFunction{ | ||
| 21 | .type(ButtonType.Circle) | 21 | .type(ButtonType.Circle) |
| 22 | .width(`${this.calcHeight(12)}lpx`) | 22 | .width(`${this.calcHeight(12)}lpx`) |
| 23 | .height(`${this.calcHeight(12)}lpx`) | 23 | .height(`${this.calcHeight(12)}lpx`) |
| 24 | - .backgroundColor($r('app.color.color_ED2800')) | 24 | + .backgroundColor(this.navItem?.noticeColor.length > 0?this.navItem?.noticeColor:$r('app.color.color_ED2800')) |
| 25 | } | 25 | } |
| 26 | }.width(`${this.calcHeight(46)}lpx`) | 26 | }.width(`${this.calcHeight(46)}lpx`) |
| 27 | .height(`${this.calcHeight(46)}lpx`) | 27 | .height(`${this.calcHeight(46)}lpx`) |
| @@ -30,7 +30,6 @@ export struct PagePersonFunction{ | @@ -30,7 +30,6 @@ export struct PagePersonFunction{ | ||
| 30 | .margin({top:`${this.calcHeight(8)}lpx`}) | 30 | .margin({top:`${this.calcHeight(8)}lpx`}) |
| 31 | .height(`${this.calcHeight(23)}lpx`) | 31 | .height(`${this.calcHeight(23)}lpx`) |
| 32 | .fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222')) | 32 | .fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222')) |
| 33 | - .fontColor($r('app.color.color_222222')) | ||
| 34 | .fontSize(`${this.calcHeight(23)}lpx`) | 33 | .fontSize(`${this.calcHeight(23)}lpx`) |
| 35 | } | 34 | } |
| 36 | .alignItems(HorizontalAlign.Center) | 35 | .alignItems(HorizontalAlign.Center) |
| @@ -199,20 +199,22 @@ struct EditUserInfoPage { | @@ -199,20 +199,22 @@ struct EditUserInfoPage { | ||
| 199 | if (backParams) { | 199 | if (backParams) { |
| 200 | let userName = backParams.userName as string ///昵称 | 200 | let userName = backParams.userName as string ///昵称 |
| 201 | let introduction = backParams.introduction as string ///简介 | 201 | let introduction = backParams.introduction as string ///简介 |
| 202 | - | 202 | + this.listData = [] |
| 203 | if (userName) { | 203 | if (userName) { |
| 204 | if (userName != this.currentUserInfo.userName) { | 204 | if (userName != this.currentUserInfo.userName) { |
| 205 | - // this.currentUserInfo.userName = userName; | ||
| 206 | - // this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname | 205 | + this.currentUserInfo.userName = userName; |
| 206 | + this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_nickname | ||
| 207 | + this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) | ||
| 207 | // this.updateEditModel() | 208 | // this.updateEditModel() |
| 208 | - this.getAccountOwnerInfo() | 209 | + // this.getAccountOwnerInfo() |
| 209 | } | 210 | } |
| 210 | } else if (introduction){ | 211 | } else if (introduction){ |
| 211 | if (introduction != this.currentUserInfo.userExtend.introduction ) { | 212 | if (introduction != this.currentUserInfo.userExtend.introduction ) { |
| 212 | - // this.currentUserInfo.userExtend.introduction = introduction; | ||
| 213 | - // this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro | 213 | + this.currentUserInfo.userExtend.introduction = introduction; |
| 214 | + this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_intro | ||
| 215 | + this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) | ||
| 214 | // this.updateEditModel() | 216 | // this.updateEditModel() |
| 215 | - this.getAccountOwnerInfo() | 217 | + // this.getAccountOwnerInfo() |
| 216 | } | 218 | } |
| 217 | } | 219 | } |
| 218 | } | 220 | } |
| @@ -127,6 +127,10 @@ export struct MinePageComponent { | @@ -127,6 +127,10 @@ export struct MinePageComponent { | ||
| 127 | } | 127 | } |
| 128 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.My,TrackConstants.PageName.My,Math.floor(duration)) | 128 | TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.My,TrackConstants.PageName.My,Math.floor(duration)) |
| 129 | } | 129 | } |
| 130 | + | ||
| 131 | + WindowModel.shared.setWindowSystemBarProperties({ | ||
| 132 | + statusBarContentColor: '#000000', | ||
| 133 | + }) | ||
| 130 | } | 134 | } |
| 131 | 135 | ||
| 132 | aboutToAppear(){ | 136 | aboutToAppear(){ |
| 1 | import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean'; | 1 | import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean'; |
| 2 | -import { Logger, NetworkUtil, SPHelper, ToastUtils, WindowModel } from 'wdKit'; | 2 | +import { Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; |
| 3 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; | 3 | import { ProcessUtils, WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 4 | import { PageComponent } from './PageComponent'; | 4 | import { PageComponent } from './PageComponent'; |
| 5 | import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; | 5 | import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout'; |
| @@ -12,6 +12,8 @@ import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'; | @@ -12,6 +12,8 @@ import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'; | ||
| 12 | import { CompUtils } from '../../utils/CompUtils'; | 12 | import { CompUtils } from '../../utils/CompUtils'; |
| 13 | import ChannelViewModel from '../../viewmodel/ChannelViewModel'; | 13 | import ChannelViewModel from '../../viewmodel/ChannelViewModel'; |
| 14 | import { ColorUtils } from '../../utils/ColorUtils'; | 14 | import { ColorUtils } from '../../utils/ColorUtils'; |
| 15 | +import { ImageKnifeComponent } from '@ohos/imageknife'; | ||
| 16 | +import { CommonUtils } from '../../utils/CommonUtils'; | ||
| 15 | 17 | ||
| 16 | const TAG = 'TopNavigationComponent'; | 18 | const TAG = 'TopNavigationComponent'; |
| 17 | 19 | ||
| @@ -35,7 +37,6 @@ export struct TopNavigationComponentNew { | @@ -35,7 +37,6 @@ export struct TopNavigationComponentNew { | ||
| 35 | navItem: BottomNavDTO = {} as BottomNavDTO | 37 | navItem: BottomNavDTO = {} as BottomNavDTO |
| 36 | // 首页当前正在哪个tab的索引值 | 38 | // 首页当前正在哪个tab的索引值 |
| 37 | @Link @Watch('setBarBackgroundColor') _currentNavIndex?: number; | 39 | @Link @Watch('setBarBackgroundColor') _currentNavIndex?: number; |
| 38 | - | ||
| 39 | @Consume @Watch('pageShowChange') pageShow: number | 40 | @Consume @Watch('pageShowChange') pageShow: number |
| 40 | // 记录首页底部tab 的索引值 | 41 | // 记录首页底部tab 的索引值 |
| 41 | @State bottomNavIndex: number = 0 | 42 | @State bottomNavIndex: number = 0 |
| @@ -43,7 +44,6 @@ export struct TopNavigationComponentNew { | @@ -43,7 +44,6 @@ export struct TopNavigationComponentNew { | ||
| 43 | @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0; | 44 | @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0; |
| 44 | // 顶导数据 | 45 | // 顶导数据 |
| 45 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] | 46 | @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] |
| 46 | - | ||
| 47 | @Consume barBackgroundColor: Color | 47 | @Consume barBackgroundColor: Color |
| 48 | @Consume isImmersive: boolean | 48 | @Consume isImmersive: boolean |
| 49 | // | 49 | // |
| @@ -329,36 +329,33 @@ export struct TopNavigationComponentNew { | @@ -329,36 +329,33 @@ export struct TopNavigationComponentNew { | ||
| 329 | @Builder | 329 | @Builder |
| 330 | tabBarBuilder(item: TopNavDTO, index: number) { | 330 | tabBarBuilder(item: TopNavDTO, index: number) { |
| 331 | Column() { | 331 | Column() { |
| 332 | + | ||
| 333 | + if (item.iconUrl && item.iconCUrl) { | ||
| 334 | + // 有图 | ||
| 335 | + ImageKnifeComponent({ imageKnifeOption: CommonUtils.getTopImageKnifeOption(item, this.currentTopNavSelectedIndex === index) }) | ||
| 336 | + .height(36) | ||
| 337 | + .width(CommonUtils.calTopTabWidth(36,item.iconUrlSize)) | ||
| 338 | + .enabled(false) | ||
| 339 | + } else { | ||
| 340 | + // 无图 | ||
| 332 | Text(item?.name) | 341 | Text(item?.name) |
| 333 | .fontSize($r('app.float.selected_text_size')) | 342 | .fontSize($r('app.float.selected_text_size')) |
| 334 | .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) | 343 | .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) |
| 335 | .fontColor(this.tabSelectedColor(this.currentTopNavSelectedIndex === index)) | 344 | .fontColor(this.tabSelectedColor(this.currentTopNavSelectedIndex === index)) |
| 336 | - .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') }) | 345 | + .padding({ |
| 346 | + top: $r('app.float.top_tab_item_padding_top'), | ||
| 347 | + bottom: $r('app.float.top_tab_item_padding_bottom') | ||
| 348 | + }) | ||
| 337 | .maxLines(this.MAX_LINE) | 349 | .maxLines(this.MAX_LINE) |
| 338 | .id(index.toString()) | 350 | .id(index.toString()) |
| 339 | - // .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 340 | - // if (this.currentTopNavSelectedIndex === index && | ||
| 341 | - // (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) { | ||
| 342 | - // if (newValue.position.x != undefined) { | ||
| 343 | - // let positionX = Number.parseFloat(newValue.position.x.toString()) | ||
| 344 | - // this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX | ||
| 345 | - // } | ||
| 346 | - // let width = Number.parseFloat(newValue.width.toString()) | ||
| 347 | - // this.indicatorWidth = Number.isNaN(width) ? 0 : width | ||
| 348 | - // } | ||
| 349 | - // }) | ||
| 350 | if (this.currentTopNavSelectedIndex === index) { | 351 | if (this.currentTopNavSelectedIndex === index) { |
| 351 | - | ||
| 352 | - Image($r('app.media.icon_channel_active')) | ||
| 353 | - .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor(""))) | 352 | + Image($r('app.media.icon_channel_active'))//.colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor(""))) |
| 354 | .width(20) | 353 | .width(20) |
| 355 | .height(3) | 354 | .height(3) |
| 356 | - // Row() | ||
| 357 | - // .width(20) | ||
| 358 | - // .height(3) | ||
| 359 | - // .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat) | ||
| 360 | - // .backgroundImageSize(ImageSize.Contain) | 355 | + |
| 356 | + } | ||
| 361 | } | 357 | } |
| 358 | + | ||
| 362 | } | 359 | } |
| 363 | .hoverEffect(HoverEffect.Highlight) | 360 | .hoverEffect(HoverEffect.Highlight) |
| 364 | .constraintSize({ | 361 | .constraintSize({ |
| @@ -368,8 +365,8 @@ export struct TopNavigationComponentNew { | @@ -368,8 +365,8 @@ export struct TopNavigationComponentNew { | ||
| 368 | .height('100%') | 365 | .height('100%') |
| 369 | // .backgroundColor(Color.Transparent) | 366 | // .backgroundColor(Color.Transparent) |
| 370 | .padding({ | 367 | .padding({ |
| 371 | - left: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 372 | - right: $r('app.float.top_tab_item_padding_horizontal'), | 368 | + left: item.iconUrl && item.iconCUrl ? 0 : $r('app.float.top_tab_item_padding_horizontal'), |
| 369 | + right: item.iconUrl && item.iconCUrl ? 0 : $r('app.float.top_tab_item_padding_horizontal'), | ||
| 373 | }) | 370 | }) |
| 374 | .justifyContent(FlexAlign.Center) | 371 | .justifyContent(FlexAlign.Center) |
| 375 | .id(`col_tabBar${index}`) | 372 | .id(`col_tabBar${index}`) |
| @@ -385,6 +382,8 @@ export struct TopNavigationComponentNew { | @@ -385,6 +382,8 @@ export struct TopNavigationComponentNew { | ||
| 385 | }) | 382 | }) |
| 386 | } | 383 | } |
| 387 | 384 | ||
| 385 | + | ||
| 386 | + | ||
| 388 | /** | 387 | /** |
| 389 | * 频道文字颜色 | 388 | * 频道文字颜色 |
| 390 | * @returns | 389 | * @returns |
| @@ -482,24 +481,22 @@ export struct TopNavigationComponentNew { | @@ -482,24 +481,22 @@ export struct TopNavigationComponentNew { | ||
| 482 | this.backgroundImageH = px2vp(this.topRectHeight) + 44 | 481 | this.backgroundImageH = px2vp(this.topRectHeight) + 44 |
| 483 | } | 482 | } |
| 484 | 483 | ||
| 485 | - ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) | 484 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1) |
| 486 | 485 | ||
| 487 | } | 486 | } |
| 488 | 487 | ||
| 489 | pageShowChange() { | 488 | pageShowChange() { |
| 490 | - ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) | 489 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1) |
| 491 | } | 490 | } |
| 492 | 491 | ||
| 493 | - | ||
| 494 | - | ||
| 495 | /** | 492 | /** |
| 496 | * 修改手机顶部状态栏颜色 | 493 | * 修改手机顶部状态栏颜色 |
| 497 | */ | 494 | */ |
| 498 | setBarBackgroundColor() { | 495 | setBarBackgroundColor() { |
| 499 | 496 | ||
| 500 | 497 | ||
| 501 | - if(this._currentNavIndex == this.bottomNavIndex){ | ||
| 502 | - ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) | 498 | + if (this._currentNavIndex == this.bottomNavIndex) { |
| 499 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1) | ||
| 503 | 500 | ||
| 504 | this.isImmersive = false | 501 | this.isImmersive = false |
| 505 | this.barBackgroundColor = Color.White | 502 | this.barBackgroundColor = Color.White |
| @@ -646,7 +643,6 @@ export struct TopNavigationComponentNew { | @@ -646,7 +643,6 @@ export struct TopNavigationComponentNew { | ||
| 646 | return null | 643 | return null |
| 647 | } | 644 | } |
| 648 | 645 | ||
| 649 | - | ||
| 650 | /** | 646 | /** |
| 651 | * 进入早晚报专题 | 647 | * 进入早晚报专题 |
| 652 | */ | 648 | */ |
| @@ -44,7 +44,7 @@ export struct CustomTitleAndEditUI { | @@ -44,7 +44,7 @@ export struct CustomTitleAndEditUI { | ||
| 44 | if (this.isDisplayButton){ | 44 | if (this.isDisplayButton){ |
| 45 | Button(this.isEditState === true?'取消':'编辑') | 45 | Button(this.isEditState === true?'取消':'编辑') |
| 46 | .type(ButtonType.Normal) | 46 | .type(ButtonType.Normal) |
| 47 | - .fontColor($r('app.color.color_222222')) | 47 | + .fontColor($r('app.color.color_B0B0B0')) |
| 48 | .backgroundColor(Color.White) | 48 | .backgroundColor(Color.White) |
| 49 | .id("edit_Button") | 49 | .id("edit_Button") |
| 50 | .alignRules({ | 50 | .alignRules({ |
| @@ -78,7 +78,7 @@ export struct EmptyComponent { | @@ -78,7 +78,7 @@ export struct EmptyComponent { | ||
| 78 | /** | 78 | /** |
| 79 | * The empty data text opacity. | 79 | * The empty data text opacity. |
| 80 | */ | 80 | */ |
| 81 | - readonly TEXT_OPACITY: number = 0.4; | 81 | + readonly TEXT_OPACITY: number = 1.0; |
| 82 | private timer: number = -1 | 82 | private timer: number = -1 |
| 83 | retry: () => void = () => { | 83 | retry: () => void = () => { |
| 84 | } | 84 | } |
| @@ -270,10 +270,16 @@ export class ColorUtils { | @@ -270,10 +270,16 @@ export class ColorUtils { | ||
| 270 | 270 | ||
| 271 | /** | 271 | /** |
| 272 | * 修改手机顶部状态栏颜色 | 272 | * 修改手机顶部状态栏颜色 |
| 273 | - * @param statusValue | 273 | + * @param statusValue 动态修改值 |
| 274 | + * @param defaultValue 页面默认值:statusValue== null 就按此值走 | ||
| 274 | */ | 275 | */ |
| 275 | - public static changeTopStatusBarColor(statusValue: number) { | ||
| 276 | - if (statusValue === 1) { // 黑色状态栏 | 276 | + public static changeTopStatusBarColor(statusValue: number, defaultValue: number) { |
| 277 | + if (statusValue == null) { | ||
| 278 | + statusValue = defaultValue | ||
| 279 | + } else { //白色状态栏 | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + if (statusValue === 1 || statusValue == null) { // 黑色状态栏 | ||
| 277 | WindowModel.shared.setWindowSystemBarProperties({ | 283 | WindowModel.shared.setWindowSystemBarProperties({ |
| 278 | statusBarContentColor: '#000000', | 284 | statusBarContentColor: '#000000', |
| 279 | 285 |
| 1 | +import { ALL, ImageKnifeOption } from '@ohos/imageknife'; | ||
| 2 | +import { TopNavDTO } from 'wdBean/Index'; | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * 通用工具类,只记录处理build里面组件业务计算逻辑 | ||
| 6 | + */ | ||
| 7 | +export class CommonUtils{ | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + /** | ||
| 11 | + * 获取顶部导航栏的频道option | ||
| 12 | + * @param item | ||
| 13 | + * @param isSelect | ||
| 14 | + * @returns | ||
| 15 | + */ | ||
| 16 | + public static getTopImageKnifeOption(item: TopNavDTO, isSelect: boolean): ImageKnifeOption { | ||
| 17 | + // let defaultIcon = this.getBottomLocalIcon(navItem, isSelect) | ||
| 18 | + let url = isSelect ? item.iconCUrl:item.iconUrl // this.getBottomIcon(navItem, isSelect) | ||
| 19 | + | ||
| 20 | + let imageKnifeOption: ImageKnifeOption = { | ||
| 21 | + loadSrc: url, | ||
| 22 | + // // 占位图使用本地资源 | ||
| 23 | + // placeholderSrc: defaultIcon, | ||
| 24 | + // // 失败占位图使用本地资源 | ||
| 25 | + // errorholderSrc: defaultIcon, | ||
| 26 | + // 是否开启一级内存缓存 | ||
| 27 | + isCacheable: true, | ||
| 28 | + // 磁盘缓存 | ||
| 29 | + strategy: new ALL(), | ||
| 30 | + gif: { | ||
| 31 | + playTimes: 1 | ||
| 32 | + } | ||
| 33 | + }; | ||
| 34 | + return imageKnifeOption | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 计算 频道tab 宽度 | ||
| 39 | + * @param height 已知高度 | ||
| 40 | + * @returns | ||
| 41 | + */ | ||
| 42 | + public static calTopTabWidth(height:number,scale:string):number{ | ||
| 43 | + if(scale){ | ||
| 44 | + | ||
| 45 | + if(scale.includes('*')){ | ||
| 46 | + let scaleArray = scale.split('*'); | ||
| 47 | + return height*Number.parseInt(scaleArray[0])/parseInt(scaleArray[1]) | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + return height*210/60 | ||
| 51 | + | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | +} |
| @@ -2,15 +2,16 @@ | @@ -2,15 +2,16 @@ | ||
| 2 | * 视频频道,包含视频和直播 | 2 | * 视频频道,包含视频和直播 |
| 3 | * 视频为沉浸式,直播同新闻页面 | 3 | * 视频为沉浸式,直播同新闻页面 |
| 4 | */ | 4 | */ |
| 5 | -import { BottomNavDTO, TopNavDTO } from 'wdBean/Index' | 5 | +import { BottomNavDTO, TopNavDTO } from 'wdBean/Index'; |
| 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; | 6 | import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index'; |
| 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 8 | import { DisplayDirection } from 'wdConstant/Index'; | 8 | import { DisplayDirection } from 'wdConstant/Index'; |
| 9 | import { CompUtils, PageComponent } from 'wdComponent/Index'; | 9 | import { CompUtils, PageComponent } from 'wdComponent/Index'; |
| 10 | -import { TrackingButton, TrackConstants } from 'wdTracking/Index'; | ||
| 11 | -import { Logger, WindowModel } from 'wdKit'; | ||
| 12 | -import { ParamType, Tracking } from 'wdTracking/Index'; | 10 | +import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/Index'; |
| 11 | +import { Logger } from 'wdKit'; | ||
| 13 | import { ColorUtils } from 'wdComponent/src/main/ets/utils/ColorUtils'; | 12 | import { ColorUtils } from 'wdComponent/src/main/ets/utils/ColorUtils'; |
| 13 | +import { ImageKnifeComponent } from '@ohos/imageknife'; | ||
| 14 | +import { CommonUtils } from 'wdComponent/src/main/ets/utils/CommonUtils'; | ||
| 14 | 15 | ||
| 15 | const TAG = 'VideoChannelPage' | 16 | const TAG = 'VideoChannelPage' |
| 16 | 17 | ||
| @@ -39,7 +40,6 @@ export struct VideoChannelPage { | @@ -39,7 +40,6 @@ export struct VideoChannelPage { | ||
| 39 | navItem: BottomNavDTO = {} as BottomNavDTO | 40 | navItem: BottomNavDTO = {} as BottomNavDTO |
| 40 | // 背景高度 | 41 | // 背景高度 |
| 41 | @State backgroundImageH: number = 0 | 42 | @State backgroundImageH: number = 0 |
| 42 | - | ||
| 43 | @Consume @Watch('setBarBackgroundColor') pageShow: number | 43 | @Consume @Watch('setBarBackgroundColor') pageShow: number |
| 44 | 44 | ||
| 45 | async aboutToAppear() { | 45 | async aboutToAppear() { |
| @@ -48,7 +48,6 @@ export struct VideoChannelPage { | @@ -48,7 +48,6 @@ export struct VideoChannelPage { | ||
| 48 | this.setBarBackgroundColor() | 48 | this.setBarBackgroundColor() |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | - | ||
| 52 | /** | 51 | /** |
| 53 | * 顶导、底导切换下标都到改变背景色,进入或退出沉浸式 | 52 | * 顶导、底导切换下标都到改变背景色,进入或退出沉浸式 |
| 54 | */ | 53 | */ |
| @@ -57,16 +56,15 @@ export struct VideoChannelPage { | @@ -57,16 +56,15 @@ export struct VideoChannelPage { | ||
| 57 | if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) { | 56 | if (this.isImmerseChannel() && CompUtils.isVideo(this.currentBottomNavInfo)) { |
| 58 | this.barBackgroundColor = Color.Black | 57 | this.barBackgroundColor = Color.Black |
| 59 | this.isImmersive = true | 58 | this.isImmersive = true |
| 60 | - ColorUtils.changeTopStatusBarColor(0)// 沉浸页面顶部导航栏颜色固定黑色 | 59 | + ColorUtils.changeTopStatusBarColor(0, 0) // 沉浸页面顶部导航栏颜色固定黑色 |
| 61 | } else { | 60 | } else { |
| 62 | this.isImmersive = false | 61 | this.isImmersive = false |
| 63 | this.barBackgroundColor = Color.White | 62 | this.barBackgroundColor = Color.White |
| 64 | - ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor) | 63 | + ColorUtils.changeTopStatusBarColor(this.navItem.statusBarColor, 1) |
| 65 | } | 64 | } |
| 66 | 65 | ||
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | - | ||
| 70 | /** | 68 | /** |
| 71 | * 得到顶导文字颜色 | 69 | * 得到顶导文字颜色 |
| 72 | * @param item | 70 | * @param item |
| @@ -114,7 +112,15 @@ export struct VideoChannelPage { | @@ -114,7 +112,15 @@ export struct VideoChannelPage { | ||
| 114 | Row() { | 112 | Row() { |
| 115 | ForEach(this.topNavList, (item: TopNavDTO, index: number) => { | 113 | ForEach(this.topNavList, (item: TopNavDTO, index: number) => { |
| 116 | Column() { | 114 | Column() { |
| 117 | - | 115 | + if (item.iconUrl && item.iconCUrl) { |
| 116 | + // 有图 | ||
| 117 | + ImageKnifeComponent({ | ||
| 118 | + imageKnifeOption: CommonUtils.getTopImageKnifeOption(item, this.currentTopNavSelectedIndex === index) | ||
| 119 | + }) | ||
| 120 | + .height(36) | ||
| 121 | + .width(CommonUtils.calTopTabWidth(36, item.iconUrlSize)) | ||
| 122 | + .enabled(false) | ||
| 123 | + } else { | ||
| 118 | Text(item.name) | 124 | Text(item.name) |
| 119 | .fontSize($r('app.float.selected_text_size')) | 125 | .fontSize($r('app.float.selected_text_size')) |
| 120 | .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) | 126 | .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) |
| @@ -125,17 +131,16 @@ export struct VideoChannelPage { | @@ -125,17 +131,16 @@ export struct VideoChannelPage { | ||
| 125 | }) | 131 | }) |
| 126 | .maxLines(this.MAX_LINE) | 132 | .maxLines(this.MAX_LINE) |
| 127 | 133 | ||
| 128 | - | ||
| 129 | - Image($r('app.media.icon_channel_active')) | ||
| 130 | - .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor(""))) | 134 | + Image($r('app.media.icon_channel_active'))// .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor(""))) |
| 131 | .width(20) | 135 | .width(20) |
| 132 | - .height(3).visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden) | ||
| 133 | - | 136 | + .height(3) |
| 137 | + .visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden) | ||
| 134 | 138 | ||
| 135 | } | 139 | } |
| 140 | + } | ||
| 136 | .padding({ | 141 | .padding({ |
| 137 | - left: $r('app.float.top_tab_item_padding_horizontal'), | ||
| 138 | - right: $r('app.float.top_tab_item_padding_horizontal'), | 142 | + left: item.iconUrl && item.iconCUrl ? 0 : $r('app.float.top_tab_item_padding_horizontal'), |
| 143 | + right: item.iconUrl && item.iconCUrl ? 0 : $r('app.float.top_tab_item_padding_horizontal'), | ||
| 139 | }) | 144 | }) |
| 140 | .onClick(() => { | 145 | .onClick(() => { |
| 141 | // 视频tab埋点 | 146 | // 视频tab埋点 |
| @@ -197,7 +202,7 @@ export struct VideoChannelPage { | @@ -197,7 +202,7 @@ export struct VideoChannelPage { | ||
| 197 | * 检测是否是沉浸式频道 | 202 | * 检测是否是沉浸式频道 |
| 198 | * @returns | 203 | * @returns |
| 199 | */ | 204 | */ |
| 200 | - isImmerseChannel():boolean{ | 205 | + isImmerseChannel(): boolean { |
| 201 | 206 | ||
| 202 | return this.navItem.topNavChannelList[this.currentTopNavSelectedIndex].channelStyle === 1; | 207 | return this.navItem.topNavChannelList[this.currentTopNavSelectedIndex].channelStyle === 1; |
| 203 | } | 208 | } |
| @@ -215,7 +220,7 @@ export struct VideoChannelPage { | @@ -215,7 +220,7 @@ export struct VideoChannelPage { | ||
| 215 | pageSwiperView() { | 220 | pageSwiperView() { |
| 216 | Swiper(this.swiperController) { | 221 | Swiper(this.swiperController) { |
| 217 | ForEach(this.topNavList, (item: TopNavDTO, index: number) => { | 222 | ForEach(this.topNavList, (item: TopNavDTO, index: number) => { |
| 218 | - if (item.channelStyle===1) { | 223 | + if (item.channelStyle === 1) { |
| 219 | // 视频 | 224 | // 视频 |
| 220 | VideoChannelDetail({ | 225 | VideoChannelDetail({ |
| 221 | bottomNavIndex: $_currentNavIndex, | 226 | bottomNavIndex: $_currentNavIndex, |
-
Please register or login to post a comment