陈剑华

Merge remote-tracking branch 'origin/main'

Showing 19 changed files with 363 additions and 119 deletions
@@ -21,7 +21,7 @@ export enum HostEnum { @@ -21,7 +21,7 @@ export enum HostEnum {
21 * 环境host管理工具类 21 * 环境host管理工具类
22 */ 22 */
23 export class HostManager { 23 export class HostManager {
24 - private static _hostUrl: HostEnum = HostEnum.HOST_PRODUCT; 24 + private static _hostUrl: HostEnum = HostEnum.HOST_UAT;
25 25
26 static changeHost(host: HostEnum) { 26 static changeHost(host: HostEnum) {
27 HostManager._hostUrl = host; 27 HostManager._hostUrl = host;
@@ -39,15 +39,15 @@ export default struct MinePageUserSimpleInfoUI { @@ -39,15 +39,15 @@ export default struct MinePageUserSimpleInfoUI {
39 39
40 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')) 40 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'))
41 .alt($r('app.media.default_head')) 41 .alt($r('app.media.default_head'))
42 - .width(`${this.calcHeight(100)}lpx`)  
43 - .height(`${this.calcHeight(100)}lpx`) 42 + .width(`${this.calcHeight(110)}lpx`)
  43 + .height(`${this.calcHeight(110)}lpx`)
44 .objectFit(ImageFit.Cover) 44 .objectFit(ImageFit.Cover)
45 .borderRadius(50) 45 .borderRadius(50)
46 46
47 if(StringUtils.isNotEmpty(this.levelHead)){ 47 if(StringUtils.isNotEmpty(this.levelHead)){
48 Image(this.levelHead) 48 Image(this.levelHead)
49 - .width(`${this.calcHeight(130)}lpx`)  
50 - .height(`${this.calcHeight(130)}lpx`) 49 + .width(`${this.calcHeight(140)}lpx`)
  50 + .height(`${this.calcHeight(140)}lpx`)
51 .objectFit(ImageFit.Cover) 51 .objectFit(ImageFit.Cover)
52 .borderRadius(50) 52 .borderRadius(50)
53 } 53 }
@@ -64,8 +64,7 @@ export default struct MinePageUserSimpleInfoUI { @@ -64,8 +64,7 @@ export default struct MinePageUserSimpleInfoUI {
64 Column(){ 64 Column(){
65 Row(){ 65 Row(){
66 Text(this.userName) 66 Text(this.userName)
67 - // .fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222'))  
68 - .fontColor($r('app.color.color_222222')) 67 + .fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222'))
69 .maxLines(1) 68 .maxLines(1)
70 .fontWeight(FontWeight.Medium) 69 .fontWeight(FontWeight.Medium)
71 .textOverflow({ overflow: TextOverflow.Ellipsis }) 70 .textOverflow({ overflow: TextOverflow.Ellipsis })
@@ -75,8 +74,7 @@ export default struct MinePageUserSimpleInfoUI { @@ -75,8 +74,7 @@ export default struct MinePageUserSimpleInfoUI {
75 Image($r('app.media.mine_user_edit')) 74 Image($r('app.media.mine_user_edit'))
76 .width(`${this.calcHeight(27)}lpx`) 75 .width(`${this.calcHeight(27)}lpx`)
77 .height(`${this.calcHeight(27)}lpx`) 76 .height(`${this.calcHeight(27)}lpx`)
78 - // .colorBlend(this.navItem?.homePageColor.length > 0?this.navItem?.homePageColor:null)  
79 - .colorBlend(Color.Red) 77 + .colorBlend(this.navItem?.homePageColor.length > 0?this.navItem?.homePageColor:null)
80 .margin({left:`${this.calcHeight(15)}lpx`}) 78 .margin({left:`${this.calcHeight(15)}lpx`})
81 .objectFit(ImageFit.Cover) 79 .objectFit(ImageFit.Cover)
82 Blank() 80 Blank()
@@ -101,7 +99,7 @@ export default struct MinePageUserSimpleInfoUI { @@ -101,7 +99,7 @@ export default struct MinePageUserSimpleInfoUI {
101 }.margin({top:'`${this.calcHeight(15)}lpx`'}) 99 }.margin({top:'`${this.calcHeight(15)}lpx`'})
102 } 100 }
103 }.alignItems(HorizontalAlign.Start) 101 }.alignItems(HorizontalAlign.Start)
104 - .margin({top:`${this.calcHeight(12)}lpx`,left:`${this.calcHeight(23)}lpx`}) 102 + .margin({top:`${this.calcHeight(12)}lpx`,left:`${this.calcHeight(4)}lpx`})
105 .width(`${this.calcHeight(352)}lpx`) 103 .width(`${this.calcHeight(352)}lpx`)
106 }else{ 104 }else{
107 Row(){ 105 Row(){
@@ -121,7 +119,7 @@ export default struct MinePageUserSimpleInfoUI { @@ -121,7 +119,7 @@ export default struct MinePageUserSimpleInfoUI {
121 this.jumpLogin() 119 this.jumpLogin()
122 trackButtonClick("myPageUserLogin") 120 trackButtonClick("myPageUserLogin")
123 }) 121 })
124 - .margin({top:`${this.calcHeight(11)}lpx`,left:`${this.calcHeight(23)}lpx`}) 122 + .margin({top:`${this.calcHeight(11)}lpx`,left:`${this.calcHeight(4)}lpx`})
125 .width(`${this.calcHeight(352)}lpx`) 123 .width(`${this.calcHeight(352)}lpx`)
126 } 124 }
127 125
@@ -12,7 +12,7 @@ export struct PagePersonFunction{ @@ -12,7 +12,7 @@ export struct PagePersonFunction{
12 Column(){ 12 Column(){
13 Stack({ alignContent: Alignment.TopEnd }){ 13 Stack({ alignContent: Alignment.TopEnd }){
14 Image(this.item.imgSrc) 14 Image(this.item.imgSrc)
15 - // .colorBlend(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:null) 15 + .colorBlend(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:null)
16 .objectFit(ImageFit.Auto) 16 .objectFit(ImageFit.Auto)
17 .interpolation(ImageInterpolation.High) 17 .interpolation(ImageInterpolation.High)
18 if (this.item.isShowRedPoint) { 18 if (this.item.isShowRedPoint) {
@@ -28,7 +28,7 @@ export struct PagePersonFunction{ @@ -28,7 +28,7 @@ export struct PagePersonFunction{
28 Text(`${this.item.msg}`) 28 Text(`${this.item.msg}`)
29 .margin({top:`${this.calcHeight(8)}lpx`}) 29 .margin({top:`${this.calcHeight(8)}lpx`})
30 .height(`${this.calcHeight(23)}lpx`) 30 .height(`${this.calcHeight(23)}lpx`)
31 - // .fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222')) 31 + .fontColor(this.navItem?.homePageColor.length > 0?this.navItem.homePageColor:$r('app.color.color_222222'))
32 .fontColor($r('app.color.color_222222')) 32 .fontColor($r('app.color.color_222222'))
33 .fontSize(`${this.calcHeight(23)}lpx`) 33 .fontSize(`${this.calcHeight(23)}lpx`)
34 } 34 }
1 -import { TopNavDTO } from 'wdBean'; 1 +import { BottomNavDTO, TopNavDTO } from 'wdBean';
2 import curves from '@ohos.curves'; 2 import curves from '@ohos.curves';
3 import { Logger, SPHelper } from 'wdKit/Index'; 3 import { Logger, SPHelper } from 'wdKit/Index';
4 import { SpConstants } from 'wdConstant/Index'; 4 import { SpConstants } from 'wdConstant/Index';
  5 +import { ColorUtils } from '../../utils/ColorUtils';
5 6
6 const INDEX_SETTING_TITLE: string = '首页设置' 7 const INDEX_SETTING_TITLE: string = '首页设置'
7 const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页' 8 const INDEX_SETTING_SUBTITLE: string = '将指定频道设置为首页'
@@ -42,6 +43,7 @@ struct ChannelSubscriptionLayout { @@ -42,6 +43,7 @@ struct ChannelSubscriptionLayout {
42 private FIX_VP_Y: number = 48 43 private FIX_VP_Y: number = 48
43 @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 44 @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
44 @State isEditIng: boolean = false 45 @State isEditIng: boolean = false
  46 + navItem: BottomNavDTO = {} as BottomNavDTO
45 // 顶部导航栏是否有临时跳转频道数据不 47 // 顶部导航栏是否有临时跳转频道数据不
46 @Prop haveTempTabData: boolean 48 @Prop haveTempTabData: boolean
47 changeTab: (index: number) => void = () => { 49 changeTab: (index: number) => void = () => {
@@ -566,13 +568,13 @@ struct ChannelSubscriptionLayout { @@ -566,13 +568,13 @@ struct ChannelSubscriptionLayout {
566 568
567 build() { 569 build() {
568 Row() { 570 Row() {
569 - Image($r('app.media.channel_button')) 571 + Image($r('app.media.icon_news_home_menu'))
570 .width(18) 572 .width(18)
  573 + .colorFilter(ColorUtils.getDrawingColorFilter(this.getChannelMoreColor("")))
571 } 574 }
572 .width(36) 575 .width(36)
573 .height(40) 576 .height(40)
574 .justifyContent(FlexAlign.Center) 577 .justifyContent(FlexAlign.Center)
575 - .backgroundColor(Color.White)  
576 .onClick(() => { 578 .onClick(() => {
577 this.isShow = true 579 this.isShow = true
578 if (this.haveTempTabData) { 580 if (this.haveTempTabData) {
@@ -614,5 +616,14 @@ struct ChannelSubscriptionLayout { @@ -614,5 +616,14 @@ struct ChannelSubscriptionLayout {
614 console.debug('TopNavigationComponent', '--changeMyChannelData channelIds--->' + this.channelIds.join(',')) 616 console.debug('TopNavigationComponent', '--changeMyChannelData channelIds--->' + this.channelIds.join(','))
615 617
616 } 618 }
  619 +
  620 + /**
  621 + * 两侧文字图标颜色,搜索图标颜色
  622 + * @returns
  623 + */
  624 + getChannelMoreColor(defaultColor: string): string {
  625 + let bothColor = this.navItem.channelMoreColor ? this.navItem.channelMoreColor : defaultColor
  626 + return bothColor
  627 + }
617 } 628 }
618 629
  1 +import { WindowModel } from 'wdKit/Index';
1 import CommonPageTitle from './CommonPageTitle'; 2 import CommonPageTitle from './CommonPageTitle';
2 import TemplatePageComponent from './template/TemplatePageComponent'; 3 import TemplatePageComponent from './template/TemplatePageComponent';
3 import { TemplatePageConstant } from './template/TemplatePageConstant'; 4 import { TemplatePageConstant } from './template/TemplatePageConstant';
@@ -16,6 +17,13 @@ struct LiveMorePage { @@ -16,6 +17,13 @@ struct LiveMorePage {
16 17
17 title: string = '直播列表' 18 title: string = '直播列表'
18 19
  20 + onPageShow(): void {
  21 + WindowModel.shared.setWindowSystemBarProperties({
  22 + statusBarContentColor: '#000000',
  23 +
  24 + })
  25 + }
  26 +
19 build() { 27 build() {
20 28
21 Column() { 29 Column() {
@@ -4,6 +4,7 @@ import PageAdModel from '../../viewmodel/PageAdvModel'; @@ -4,6 +4,7 @@ import PageAdModel from '../../viewmodel/PageAdvModel';
4 import CommonPageTitle from './CommonPageTitle'; 4 import CommonPageTitle from './CommonPageTitle';
5 import TemplatePageComponent from './template/TemplatePageComponent'; 5 import TemplatePageComponent from './template/TemplatePageComponent';
6 import { TemplatePageConstant } from './template/TemplatePageConstant'; 6 import { TemplatePageConstant } from './template/TemplatePageConstant';
  7 +import { WindowModel } from 'wdKit/Index';
7 8
8 const TAG: string = 'ThemeListPage'; 9 const TAG: string = 'ThemeListPage';
9 10
@@ -31,6 +32,12 @@ struct ThemeListPage { @@ -31,6 +32,12 @@ struct ThemeListPage {
31 32
32 } 33 }
33 34
  35 + onPageShow(): void {
  36 + WindowModel.shared.setWindowSystemBarProperties({
  37 + statusBarContentColor: '#000000',
  38 +
  39 + })
  40 + }
34 build() { 41 build() {
35 42
36 Column() { 43 Column() {
1 import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean'; 1 import { BottomNavDTO, NavigationDetailDTO, TopNavDTO } from 'wdBean';
2 -import { Logger, NetworkUtil, SPHelper, ToastUtils } from 'wdKit'; 2 +import { Logger, NetworkUtil, SPHelper, ToastUtils, WindowModel } 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';
@@ -11,6 +11,8 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/ @@ -11,6 +11,8 @@ import { ParamType, TrackConstants, Tracking, TrackingButton } from 'wdTracking/
11 import DailyPaperTopicModel from '../../model/DailyPaperTopicModel'; 11 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 { common2D, drawing } from '@kit.ArkGraphics2D';
  15 +import { ColorUtils } from '../../utils/ColorUtils';
14 16
15 const TAG = 'TopNavigationComponent'; 17 const TAG = 'TopNavigationComponent';
16 18
@@ -22,7 +24,7 @@ const storage = LocalStorage.getShared(); @@ -22,7 +24,7 @@ const storage = LocalStorage.getShared();
22 @Entry(storage) 24 @Entry(storage)
23 @Component 25 @Component
24 export struct TopNavigationComponentNew { 26 export struct TopNavigationComponentNew {
25 - private topRectHeight: string = AppStorage.get<number>('topSafeHeight') + 'px'; 27 + private topRectHeight: number = AppStorage.get<number>('topSafeHeight') || 0;
26 private pageName: string = '' 28 private pageName: string = ''
27 private pageId: number = 0 29 private pageId: number = 0
28 readonly MAX_LINE: number = 1; // 顶部tab text最大行数 30 readonly MAX_LINE: number = 1; // 顶部tab text最大行数
@@ -32,16 +34,17 @@ export struct TopNavigationComponentNew { @@ -32,16 +34,17 @@ export struct TopNavigationComponentNew {
32 * 首页 底导 某个tab 对象 34 * 首页 底导 某个tab 对象
33 */ 35 */
34 navItem: BottomNavDTO = {} as BottomNavDTO 36 navItem: BottomNavDTO = {} as BottomNavDTO
35 - // 背景色  
36 - @Consume barBackgroundColor: Color  
37 // 首页当前正在哪个tab的索引值 37 // 首页当前正在哪个tab的索引值
38 - @Link _currentNavIndex?: number; 38 + @Link @Watch('setBarBackgroundColor') _currentNavIndex?: number;
  39 +
  40 + @Consume @Watch('pageShowChange') pageShow: number
39 // 记录首页底部tab 的索引值 41 // 记录首页底部tab 的索引值
40 @State bottomNavIndex: number = 0 42 @State bottomNavIndex: number = 0
41 // 顶导当前选中/焦点下标 43 // 顶导当前选中/焦点下标
42 @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0; 44 @State @Watch('updateCurrentTopNavSelectedIndex') currentTopNavSelectedIndex: number = 0;
43 // 顶导数据 45 // 顶导数据
44 @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = [] 46 @State @Watch('onTopNavigationDataUpdated') topNavList: TopNavDTO[] = []
  47 +
45 // 48 //
46 @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002 49 @State indexSettingChannelId: number = AppStorage.get<number>('indexSettingChannelId') || 2002
47 //本地缓存频道id列表 50 //本地缓存频道id列表
@@ -65,6 +68,7 @@ export struct TopNavigationComponentNew { @@ -65,6 +68,7 @@ export struct TopNavigationComponentNew {
65 @State isClickMorningEveningPaper: boolean = false 68 @State isClickMorningEveningPaper: boolean = false
66 // 顶部导航栏是否有临时跳转频道数据不 69 // 顶部导航栏是否有临时跳转频道数据不
67 @State haveTempTabData: boolean = false 70 @State haveTempTabData: boolean = false
  71 + @State backgroundImageH: number = 0
68 72
69 build() { 73 build() {
70 Column() { 74 Column() {
@@ -150,8 +154,7 @@ export struct TopNavigationComponentNew { @@ -150,8 +154,7 @@ export struct TopNavigationComponentNew {
150 .width('100%') 154 .width('100%')
151 .height('100%') 155 .height('100%')
152 } 156 }
153 - // 预留状态栏  
154 - .margin({ top: this.topRectHeight }) 157 +
155 } 158 }
156 159
157 /** 160 /**
@@ -161,26 +164,35 @@ export struct TopNavigationComponentNew { @@ -161,26 +164,35 @@ export struct TopNavigationComponentNew {
161 topBar() { 164 topBar() {
162 Column() { 165 Column() {
163 Row() { 166 Row() {
  167 + //新闻页面搜索组件
  168 + FirstTabTopSearchComponent({ navItem: this.navItem })
164 169
165 - FirstTabTopSearchComponent()  
166 -  
167 - Image($r('app.media.icon_ren_min_ri_bao')) 170 + Image(this.navItem.logoUrl ? this.navItem.logoUrl : $r('app.media.icon_ren_min_ri_bao'))
168 .width(72) 171 .width(72)
169 .height(29) 172 .height(29)
170 .onClick(() => { 173 .onClick(() => {
171 ProcessUtils.gotoENewsPaper() 174 ProcessUtils.gotoENewsPaper()
172 }) 175 })
  176 +
  177 + // 新闻页面早晚报组件
173 Stack({ alignContent: Alignment.Center }) { 178 Stack({ alignContent: Alignment.Center }) {
174 - Image($r('app.media.background_read_paper_home')) 179 +
  180 + Image(this.navItem.morningAndEveningUrl ? this.navItem.morningAndEveningUrl :
  181 + $r('app.media.background_read_paper_home'))
175 .width('100%') 182 .width('100%')
176 .height('100%') 183 .height('100%')
177 .objectFit(ImageFit.Contain) 184 .objectFit(ImageFit.Contain)
  185 +
178 Row() { 186 Row() {
  187 +
179 Image($r('app.media.icon_read_paper_home')) 188 Image($r('app.media.icon_read_paper_home'))
180 .width(18) 189 .width(18)
181 .height(18) 190 .height(18)
  191 + .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
  192 + .margin({ right: '10lpx' })
  193 +
182 Text('早晚报') 194 Text('早晚报')
183 - .fontColor("#666666") 195 + .fontColor(this.getBothColor("#666666"))
184 .fontSize($r('app.float.font_size_13')) 196 .fontSize($r('app.float.font_size_13'))
185 } 197 }
186 .alignItems(VerticalAlign.Center) 198 .alignItems(VerticalAlign.Center)
@@ -201,15 +213,29 @@ export struct TopNavigationComponentNew { @@ -201,15 +213,29 @@ export struct TopNavigationComponentNew {
201 .width('100%') 213 .width('100%')
202 .height(40) 214 .height(40)
203 .padding({ top: 10 }) 215 .padding({ top: 10 })
204 - .backgroundColor($r('app.color.white')) 216 + // 预留状态栏
  217 + .margin({ top: this.topRectHeight + 'px' })
205 .id('topBar') 218 .id('topBar')
206 } 219 }
207 220
  221 + /**
  222 + * 两侧文字图标颜色,搜索图标颜色
  223 + * @returns
  224 + */
  225 + getBothColor(defaultColor: string): string {
  226 + let bothColor = this.navItem.searchBothColor ? this.navItem.searchBothColor : defaultColor
  227 + return bothColor
  228 + }
  229 +
208 @Builder 230 @Builder
209 tabBar() { 231 tabBar() {
  232 +
210 if (CompUtils.isNews(this.navItem)) { 233 if (CompUtils.isNews(this.navItem)) {
  234 + // 顶部背景图
  235 + Image(this.navItem.backgroundUrl).width('100%')
211 // 顶部搜索、日报logo、早晚报 236 // 顶部搜索、日报logo、早晚报
212 this.topBar() 237 this.topBar()
  238 +
213 ChannelSubscriptionLayout({ 239 ChannelSubscriptionLayout({
214 currentTopNavSelectedIndex: $currentTopNavSelectedIndex, 240 currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
215 homeChannelList: this.homeChannelList, 241 homeChannelList: this.homeChannelList,
@@ -217,6 +243,7 @@ export struct TopNavigationComponentNew { @@ -217,6 +243,7 @@ export struct TopNavigationComponentNew {
217 moreChannelList: $moreChannelList, 243 moreChannelList: $moreChannelList,
218 localChannelList: $localChannelList, 244 localChannelList: $localChannelList,
219 haveTempTabData: this.haveTempTabData, 245 haveTempTabData: this.haveTempTabData,
  246 + navItem: this.navItem,
220 changeTab: (index) => { 247 changeTab: (index) => {
221 this.channelJumpToPage(index) 248 this.channelJumpToPage(index)
222 } 249 }
@@ -239,7 +266,6 @@ export struct TopNavigationComponentNew { @@ -239,7 +266,6 @@ export struct TopNavigationComponentNew {
239 .edgeEffect(EdgeEffect.None) 266 .edgeEffect(EdgeEffect.None)
240 .padding({ left: 8, top: 0, right: 0 }) 267 .padding({ left: 8, top: 0, right: 0 })
241 .height($r('app.float.top_tab_bar_height')) 268 .height($r('app.float.top_tab_bar_height'))
242 - .backgroundColor(this.barBackgroundColor)  
243 .id('tabList') 269 .id('tabList')
244 .alignRules({ 270 .alignRules({
245 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom }, 271 'top': { 'anchor': 'topBar', 'align': VerticalAlign.Bottom },
@@ -247,14 +273,18 @@ export struct TopNavigationComponentNew { @@ -247,14 +273,18 @@ export struct TopNavigationComponentNew {
247 'right': { 'anchor': 'channelManageBtn', 'align': HorizontalAlign.Start } 273 'right': { 'anchor': 'channelManageBtn', 'align': HorizontalAlign.Start }
248 }) 274 })
249 } else { 275 } else {
  276 + // 顶部背景图
  277 + Image(this.navItem.backgroundUrl).width('100%').height(this.backgroundImageH)
  278 +
250 Row() { 279 Row() {
251 Image($r('app.media.icon_search')) 280 Image($r('app.media.icon_search'))
  281 + .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
252 .width('24vp') 282 .width('24vp')
253 .height('24vp') 283 .height('24vp')
254 } 284 }
255 .height($r('app.float.top_tab_bar_height_common')) 285 .height($r('app.float.top_tab_bar_height_common'))
256 .width('40vp') 286 .width('40vp')
257 - .margin({ right: 10 }) 287 + .margin({ right: 10, top: this.topRectHeight + 'px' })
258 .alignItems(VerticalAlign.Center) 288 .alignItems(VerticalAlign.Center)
259 .justifyContent(FlexAlign.Center) 289 .justifyContent(FlexAlign.Center)
260 .id('searchBtn') 290 .id('searchBtn')
@@ -280,7 +310,8 @@ export struct TopNavigationComponentNew { @@ -280,7 +310,8 @@ export struct TopNavigationComponentNew {
280 .scrollBar(BarState.Off) 310 .scrollBar(BarState.Off)
281 .edgeEffect(EdgeEffect.None) 311 .edgeEffect(EdgeEffect.None)
282 .height($r('app.float.top_tab_bar_height_common')) 312 .height($r('app.float.top_tab_bar_height_common'))
283 - .backgroundColor(this.barBackgroundColor) 313 + // 预留状态栏
  314 + .margin({ top: this.topRectHeight + 'px' })
284 .id('tabList') 315 .id('tabList')
285 .alignRules({ 316 .alignRules({
286 'top': { 'anchor': '__container__', 'align': VerticalAlign.Top }, 317 'top': { 'anchor': '__container__', 'align': VerticalAlign.Top },
@@ -300,27 +331,32 @@ export struct TopNavigationComponentNew { @@ -300,27 +331,32 @@ export struct TopNavigationComponentNew {
300 Text(item?.name) 331 Text(item?.name)
301 .fontSize($r('app.float.selected_text_size')) 332 .fontSize($r('app.float.selected_text_size'))
302 .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) 333 .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
303 - .fontColor(this.currentTopNavSelectedIndex === index ? Color.Black : "#999999") 334 + .fontColor(this.tabSelectedColor(this.currentTopNavSelectedIndex === index))
304 .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') }) 335 .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') })
305 .maxLines(this.MAX_LINE) 336 .maxLines(this.MAX_LINE)
306 .id(index.toString()) 337 .id(index.toString())
307 - // .onAreaChange((oldValue: Area, newValue: Area) => {  
308 - // if (this.currentTopNavSelectedIndex === index &&  
309 - // (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) {  
310 - // if (newValue.position.x != undefined) {  
311 - // let positionX = Number.parseFloat(newValue.position.x.toString())  
312 - // this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX  
313 - // }  
314 - // let width = Number.parseFloat(newValue.width.toString())  
315 - // this.indicatorWidth = Number.isNaN(width) ? 0 : width  
316 - // }  
317 - // }) 338 + // .onAreaChange((oldValue: Area, newValue: Area) => {
  339 + // if (this.currentTopNavSelectedIndex === index &&
  340 + // (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) {
  341 + // if (newValue.position.x != undefined) {
  342 + // let positionX = Number.parseFloat(newValue.position.x.toString())
  343 + // this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX
  344 + // }
  345 + // let width = Number.parseFloat(newValue.width.toString())
  346 + // this.indicatorWidth = Number.isNaN(width) ? 0 : width
  347 + // }
  348 + // })
318 if (this.currentTopNavSelectedIndex === index) { 349 if (this.currentTopNavSelectedIndex === index) {
319 - Row() 350 +
  351 + Image($r('app.media.icon_channel_active'))
  352 + .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
320 .width(20) 353 .width(20)
321 .height(3) 354 .height(3)
322 - .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat)  
323 - .backgroundImageSize(ImageSize.Contain) 355 + // Row()
  356 + // .width(20)
  357 + // .height(3)
  358 + // .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat)
  359 + // .backgroundImageSize(ImageSize.Contain)
324 } 360 }
325 } 361 }
326 .hoverEffect(HoverEffect.Highlight) 362 .hoverEffect(HoverEffect.Highlight)
@@ -349,6 +385,20 @@ export struct TopNavigationComponentNew { @@ -349,6 +385,20 @@ export struct TopNavigationComponentNew {
349 } 385 }
350 386
351 /** 387 /**
  388 + * 频道文字颜色
  389 + * @returns
  390 + */
  391 + tabSelectedColor(selected: boolean): string {
  392 + if (selected) {
  393 + return this.navItem.channelChooseColor ? this.navItem.channelChooseColor : '#222222'
  394 + } else {
  395 + let ccolor = this.navItem.channelChooseCColor.replace('#', '#B3')
  396 + return this.navItem.channelChooseCColor ? ccolor : '#999999'
  397 + }
  398 +
  399 + }
  400 +
  401 + /**
352 * 频道信息跳转页面方法 402 * 频道信息跳转页面方法
353 * @param index 403 * @param index
354 */ 404 */
@@ -419,25 +469,58 @@ export struct TopNavigationComponentNew { @@ -419,25 +469,58 @@ export struct TopNavigationComponentNew {
419 return item?.channelType === 3 469 return item?.channelType === 3
420 } 470 }
421 471
  472 + @Consume barBackgroundColor: Color
  473 + @Consume isImmersive: boolean
  474 +
422 async aboutToAppear() { 475 async aboutToAppear() {
423 476
424 if (CompUtils.isNews(this.navItem)) { 477 if (CompUtils.isNews(this.navItem)) {
425 -  
426 // 请求顶导网络数据 478 // 请求顶导网络数据
427 this.getTopNavList(this.navItem.id) 479 this.getTopNavList(this.navItem.id)
428 480
429 } else { 481 } else {
430 - // if(CompUtils.isNews(this.navItem)){  
431 - // //处理新闻tab顶导频道数据  
432 - // this.topNavListHandle()  
433 - // }  
434 -  
435 this.changePage(this.currentTopNavSelectedIndex) 482 this.changePage(this.currentTopNavSelectedIndex)
  483 + // 背景图高度
  484 + this.backgroundImageH = px2vp(this.topRectHeight) + 44
436 } 485 }
437 486
  487 + this.changeTopStatusBarColor(this.navItem.statusBarColor)
438 488
439 } 489 }
440 490
  491 + pageShowChange() {
  492 + this.changeTopStatusBarColor(this.navItem.statusBarColor)
  493 + }
  494 +
  495 +
  496 +
  497 + /**
  498 + * 修改手机顶部状态栏颜色
  499 + */
  500 + setBarBackgroundColor() {
  501 +
  502 + Logger.debug('setBarBackgroundColor','setBarBackgroundColor '+this.navItem.name+' '+this._currentNavIndex +' '+this.bottomNavIndex)
  503 +
  504 + if(this._currentNavIndex == this.bottomNavIndex){
  505 + this.changeTopStatusBarColor(this.navItem.statusBarColor)
  506 + }
  507 +
  508 + }
  509 + /**
  510 + * 修改手机顶部状态栏颜色
  511 + * @param statusValue
  512 + */
  513 + changeTopStatusBarColor(statusValue: number) {
  514 + if (statusValue === 1) { // 黑色状态栏
  515 + WindowModel.shared.setWindowSystemBarProperties({
  516 + statusBarContentColor: '#000000',
  517 + })
  518 + } else { //白色状态栏
  519 + WindowModel.shared.setWindowSystemBarProperties({
  520 + statusBarContentColor: '#ffffff',
  521 + })
  522 + }
  523 + }
441 onTopNavigationDataUpdated() { 524 onTopNavigationDataUpdated() {
442 Logger.info(TAG, 525 Logger.info(TAG,
443 `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); 526 `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`);
@@ -577,6 +660,7 @@ export struct TopNavigationComponentNew { @@ -577,6 +660,7 @@ export struct TopNavigationComponentNew {
577 return null 660 return null
578 } 661 }
579 662
  663 +
580 /** 664 /**
581 * 进入早晚报专题 665 * 进入早晚报专题
582 */ 666 */
@@ -618,9 +702,6 @@ export struct TopNavigationComponentNew { @@ -618,9 +702,6 @@ export struct TopNavigationComponentNew {
618 async getTopNavList(id: number) { 702 async getTopNavList(id: number) {
619 703
620 704
621 - Logger.debug(TAG, 'getTopNavList=存储=>' + this.storageChannelIds)  
622 -  
623 -  
624 // 1 、使用存储数据或者预置数据,首先使用缓存数据,其次使用预置数据 705 // 1 、使用存储数据或者预置数据,首先使用缓存数据,其次使用预置数据
625 let bottomDetailCache = await ChannelViewModel.getBottomNavDetailCacheData(id) 706 let bottomDetailCache = await ChannelViewModel.getBottomNavDetailCacheData(id)
626 707
  1 +import { WindowModel } from 'wdKit/Index';
1 import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index'; 2 import { TrackConstants, TrackingPageBrowse } from 'wdTracking/Index';
2 import CommonPageTitle from '../page/CommonPageTitle'; 3 import CommonPageTitle from '../page/CommonPageTitle';
3 import TemplatePageComponent from '../page/template/TemplatePageComponent'; 4 import TemplatePageComponent from '../page/template/TemplatePageComponent';
@@ -52,6 +53,10 @@ struct ReserveMorePage { @@ -52,6 +53,10 @@ struct ReserveMorePage {
52 53
53 onPageShow(): void { 54 onPageShow(): void {
54 this.pageShowStartTime = Date.now() 55 this.pageShowStartTime = Date.now()
  56 + WindowModel.shared.setWindowSystemBarProperties({
  57 + statusBarContentColor: '#000000',
  58 +
  59 + })
55 } 60 }
56 61
57 onPageHide(): void { 62 onPageHide(): void {
@@ -9,6 +9,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter' @@ -9,6 +9,8 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter'
9 import { TrackingButton, TrackConstants } from 'wdTracking/Index' 9 import { TrackingButton, TrackConstants } from 'wdTracking/Index'
10 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' 10 import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
11 import { Logger } from 'wdKit'; 11 import { Logger } from 'wdKit';
  12 +import { BottomNavDTO } from 'wdBean/Index'
  13 +import { ColorUtils } from '../../utils/ColorUtils'
12 14
13 const TAG = "FirstTabTopSearchComponent" 15 const TAG = "FirstTabTopSearchComponent"
14 16
@@ -16,6 +18,7 @@ const TAG = "FirstTabTopSearchComponent" @@ -16,6 +18,7 @@ const TAG = "FirstTabTopSearchComponent"
16 export struct FirstTabTopSearchComponent { 18 export struct FirstTabTopSearchComponent {
17 @State searchTextData: string[] = [] 19 @State searchTextData: string[] = []
18 private swiperController: SwiperController = new SwiperController() 20 private swiperController: SwiperController = new SwiperController()
  21 + navItem: BottomNavDTO = {} as BottomNavDTO
19 22
20 async aboutToAppear() { 23 async aboutToAppear() {
21 this.getSearchHint() 24 this.getSearchHint()
@@ -33,8 +36,8 @@ export struct FirstTabTopSearchComponent { @@ -33,8 +36,8 @@ export struct FirstTabTopSearchComponent {
33 }) 36 })
34 } 37 }
35 38
36 - setDefaultHitData(){  
37 - if(this.searchTextData.length === 0){ 39 + setDefaultHitData() {
  40 + if (this.searchTextData.length === 0) {
38 this.searchTextData.push("搜索") 41 this.searchTextData.push("搜索")
39 } 42 }
40 } 43 }
@@ -44,14 +47,15 @@ export struct FirstTabTopSearchComponent { @@ -44,14 +47,15 @@ export struct FirstTabTopSearchComponent {
44 Image($r('app.media.icon_search')) 47 Image($r('app.media.icon_search'))
45 .width(18) 48 .width(18)
46 .height(18) 49 .height(18)
47 - .margin({right:'10lpx'}) 50 + .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
  51 + .margin({ right: '10lpx' })
48 52
49 if (this.searchTextData != null && this.searchTextData.length > 0) { 53 if (this.searchTextData != null && this.searchTextData.length > 0) {
50 Swiper(this.swiperController) { 54 Swiper(this.swiperController) {
51 ForEach(this.searchTextData, (item: string, index: number) => { 55 ForEach(this.searchTextData, (item: string, index: number) => {
52 Text(item) 56 Text(item)
53 .fontWeight(400) 57 .fontWeight(400)
54 - .fontColor("#666666") 58 + .fontColor(this.getBothColor("#666666"))
55 .fontSize($r('app.float.font_size_13')) 59 .fontSize($r('app.float.font_size_13'))
56 .textAlign(TextAlign.Start) 60 .textAlign(TextAlign.Start)
57 .maxLines(1) 61 .maxLines(1)
@@ -64,20 +68,31 @@ export struct FirstTabTopSearchComponent { @@ -64,20 +68,31 @@ export struct FirstTabTopSearchComponent {
64 .indicator(false) 68 .indicator(false)
65 .vertical(true) 69 .vertical(true)
66 .height(30) 70 .height(30)
67 - .enabled(false) 71 + .enabled(false)
68 .focusable(false) 72 .focusable(false)
69 } 73 }
70 } 74 }
71 .height(30) 75 .height(30)
72 .width(124) 76 .width(124)
73 .padding({ left: 15 }) 77 .padding({ left: 15 })
74 - .backgroundImage($r('app.media.background_search')) 78 + .backgroundImage(this.navItem.searchUrl ? this.navItem.searchUrl :
  79 + $r('app.media.background_search'))
75 .backgroundImageSize(ImageSize.Cover) 80 .backgroundImageSize(ImageSize.Cover)
76 .onClick(() => { 81 .onClick(() => {
77 Logger.info(TAG, `搜索按钮点击: 新闻`); 82 Logger.info(TAG, `搜索按钮点击: 新闻`);
78 - TrackingButton.searchClick( TrackConstants.PageName.Search, "NEWS") 83 + TrackingButton.searchClick(TrackConstants.PageName.Search, "NEWS")
79 let params = { 'tabName': "NEWS" } as Record<string, string> 84 let params = { 'tabName': "NEWS" } as Record<string, string>
80 - WDRouterRule.jumpWithPage(WDRouterPage.searchPage,params) 85 + WDRouterRule.jumpWithPage(WDRouterPage.searchPage, params)
81 }) 86 })
82 } 87 }
  88 + /**
  89 + * 两侧文字图标颜色,搜索图标颜色
  90 + * @returns
  91 + */
  92 + getBothColor(defaultColor: string): string {
  93 + let bothColor = this.navItem.searchBothColor ? this.navItem.searchBothColor : defaultColor
  94 + return bothColor
  95 + }
  96 +
  97 +
83 } 98 }
1 -import { DateTimeUtils } from 'wdKit/Index'; 1 +import { DateTimeUtils, WindowModel } from 'wdKit/Index';
2 import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index'; 2 import { TrackingPageBrowse, TrackConstants } from 'wdTracking/Index';
3 import { SearchComponent } from '../components/search/SearchComponent' 3 import { SearchComponent } from '../components/search/SearchComponent'
4 import { router } from '@kit.ArkUI'; 4 import { router } from '@kit.ArkUI';
@@ -16,6 +16,10 @@ struct SearchPage { @@ -16,6 +16,10 @@ struct SearchPage {
16 onPageShow() { 16 onPageShow() {
17 this.fromTabName = this.params?.['tabName']; 17 this.fromTabName = this.params?.['tabName'];
18 this.pageShowTime = DateTimeUtils.getTimeStamp() 18 this.pageShowTime = DateTimeUtils.getTimeStamp()
  19 + WindowModel.shared.setWindowSystemBarProperties({
  20 + statusBarContentColor: '#000000',
  21 +
  22 + })
19 } 23 }
20 24
21 onPageHide(): void { 25 onPageHide(): void {
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 * See the License for the specific language governing permissions and 12 * See the License for the specific language governing permissions and
13 * limitations under the License. 13 * limitations under the License.
14 */ 14 */
  15 +import { common2D, drawing } from '@kit.ArkGraphics2D';
15 16
16 /** 17 /**
17 * RGB颜色类型 18 * RGB颜色类型
@@ -175,10 +176,10 @@ export class ColorUtils { @@ -175,10 +176,10 @@ export class ColorUtils {
175 } 176 }
176 177
177 178
178 - public static getMorningEveningPaperRgb(color: ColorRgb): ColorRgb{ 179 + public static getMorningEveningPaperRgb(color: ColorRgb): ColorRgb {
179 // RGB颜色取值范围是0~255,需要转换为0~1的浮点数 180 // RGB颜色取值范围是0~255,需要转换为0~1的浮点数
180 - const red: number = color.red ;  
181 - const green: number = color.green ; 181 + const red: number = color.red;
  182 + const green: number = color.green;
182 const blue: number = color.blue; 183 const blue: number = color.blue;
183 184
184 const max: number = Math.max(red, green, blue); 185 const max: number = Math.max(red, green, blue);
@@ -216,4 +217,52 @@ export class ColorUtils { @@ -216,4 +217,52 @@ export class ColorUtils {
216 217
217 } 218 }
218 219
  220 + /**
  221 + * 十六进制色值转成arg
  222 + * @param hex 必须是十六进制的色值 如#999999
  223 + * @returns
  224 + */
  225 + public static hexColorValueToRGB(hex: string): number[] {
  226 +
  227 + let rgbArray: number[] = []
  228 +
  229 + let sanitizedHex = hex.replace("#", "");
  230 + // 解析红、绿、蓝色值
  231 + let r = parseInt(sanitizedHex.substring(0, 2), 16);
  232 + let g = parseInt(sanitizedHex.substring(2, 4), 16);
  233 + let b = parseInt(sanitizedHex.substring(4, 6), 16);
  234 + rgbArray.push(r)
  235 + rgbArray.push(g)
  236 + rgbArray.push(b)
  237 +
  238 + return rgbArray
  239 + }
  240 +
  241 + /**
  242 + * 获取图片填充的ColorFilter
  243 + * @param hex 十六进制颜色值
  244 + * @returns undefined:无填充颜色
  245 + */
  246 + public static getDrawingColorFilter(hex: string): ColorFilter | undefined {
  247 +
  248 + let drawColorFilter: ColorFilter | undefined = undefined
  249 +
  250 + if (hex) {
  251 +
  252 + let color: common2D.Color = {
  253 + alpha: 255,
  254 + red: 0,
  255 + green: 0,
  256 + blue: 0
  257 + }
  258 +
  259 + let rgbArray = ColorUtils.hexColorValueToRGB(hex)
  260 + color.red = rgbArray[0]
  261 + color.green = rgbArray[1]
  262 + color.blue = rgbArray[2]
  263 + drawColorFilter = drawing.ColorFilter.createBlendModeColorFilter(color, drawing.BlendMode.SRC_IN);
  264 + }
  265 +
  266 + return drawColorFilter
  267 + }
219 } 268 }
@@ -82,6 +82,7 @@ export struct VideoChannelDetail { @@ -82,6 +82,7 @@ export struct VideoChannelDetail {
82 } 82 }
83 83
84 pageShowChange() { 84 pageShowChange() {
  85 +
85 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) { 86 if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
86 this.barBackgroundColor = Color.Black 87 this.barBackgroundColor = Color.Black
87 this.switchVideoStatus = true 88 this.switchVideoStatus = true
@@ -89,7 +90,6 @@ export struct VideoChannelDetail { @@ -89,7 +90,6 @@ export struct VideoChannelDetail {
89 } 90 }
90 91
91 this.pageShowTime = DateTimeUtils.getTimeStamp() 92 this.pageShowTime = DateTimeUtils.getTimeStamp()
92 - console.log(TAG, '一级视频显示')  
93 } 93 }
94 94
95 pageHideChange() { 95 pageHideChange() {
@@ -135,29 +135,21 @@ export struct VideoChannelDetail { @@ -135,29 +135,21 @@ export struct VideoChannelDetail {
135 135
136 /** 136 /**
137 * 开启沉浸式 137 * 开启沉浸式
138 - * TODO:颜色待根据业务接口修改  
139 */ 138 */
140 openFullScreen() { 139 openFullScreen() {
141 - WindowModel.shared.setWindowSystemBarProperties({  
142 - statusBarContentColor: '#ffffff',  
143 - // statusBarColor: '#000000',  
144 - // navigationBarColor: '#000000',  
145 - // navigationBarContentColor: '#ffffff'  
146 - }) 140 + // WindowModel.shared.setWindowSystemBarProperties({
  141 + // statusBarContentColor: '#ffffff',
  142 + // })
147 } 143 }
148 144
149 /** 145 /**
150 * 关闭沉浸式 146 * 关闭沉浸式
151 - * TODO:颜色待根据业务接口修改  
152 */ 147 */
153 closeFullScreen() { 148 closeFullScreen() {
154 - WindowModel.shared.setWindowSystemBarProperties({  
155 - statusBarContentColor: '#000000',  
156 - // statusBarColor: '#ffffff',  
157 - // navigationBarColor: '#0x66000000',  
158 - // navigationBarContentColor: '#0xE5FFFFFF'  
159 -  
160 - }) 149 + // WindowModel.shared.setWindowSystemBarProperties({
  150 + // statusBarContentColor: '#000000',
  151 + //
  152 + // })
161 } 153 }
162 154
163 onBackPress(): boolean | void { 155 onBackPress(): boolean | void {
@@ -55,7 +55,7 @@ struct ENewspaper { @@ -55,7 +55,7 @@ struct ENewspaper {
55 } 55 }
56 56
57 onPageHide() { 57 onPageHide() {
58 - this.setSystemBar('#FFFFFFFF', '#00000000', '#000000') 58 + // this.setSystemBar('#FFFFFFFF', '#00000000', '#000000')
59 Logger.info(TAG, 'onPageHide'); 59 Logger.info(TAG, 'onPageHide');
60 //页面浏览 60 //页面浏览
61 TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.NewsPaperPage, 61 TrackingPageBrowse.trackCommonPageExposureEnd(TrackConstants.PageName.NewsPaperPage,
@@ -14,6 +14,7 @@ const TAG = 'MainPage'; @@ -14,6 +14,7 @@ const TAG = 'MainPage';
14 @Entry 14 @Entry
15 @Component 15 @Component
16 struct MainPage { 16 struct MainPage {
  17 +
17 @Provide pageShow: number = -1 18 @Provide pageShow: number = -1
18 @Provide pageHide: number = -1 19 @Provide pageHide: number = -1
19 private breakpointSystem: BreakpointSystem = new BreakpointSystem() 20 private breakpointSystem: BreakpointSystem = new BreakpointSystem()
@@ -58,6 +59,8 @@ struct MainPage { @@ -58,6 +59,8 @@ struct MainPage {
58 59
59 // 升级检查 60 // 升级检查
60 this.upgradeCheck() 61 this.upgradeCheck()
  62 +
  63 + Logger.debug('setBarBackgroundColor','Top onPageShow ')
61 } 64 }
62 65
63 upgradeCheck() { 66 upgradeCheck() {
@@ -111,4 +114,5 @@ struct MainPage { @@ -111,4 +114,5 @@ struct MainPage {
111 BottomNavigationComponent() 114 BottomNavigationComponent()
112 } 115 }
113 } 116 }
  117 +
114 } 118 }
@@ -24,6 +24,7 @@ let storage = LocalStorage.getShared(); @@ -24,6 +24,7 @@ let storage = LocalStorage.getShared();
24 @Entry(storage) 24 @Entry(storage)
25 @Component 25 @Component
26 export struct BottomNavigationComponent { 26 export struct BottomNavigationComponent {
  27 +
27 @Provide bottomRectHeight: number = 0 28 @Provide bottomRectHeight: number = 0
28 private bottomRectHeight1: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; 29 private bottomRectHeight1: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
29 @Provide topRectHeight: number = 0 30 @Provide topRectHeight: number = 0
@@ -34,7 +35,7 @@ export struct BottomNavigationComponent { @@ -34,7 +35,7 @@ export struct BottomNavigationComponent {
34 @Provide currentBottomNavInfo: BottomNavDTO = {} as BottomNavDTO; // 当前底导信息 35 @Provide currentBottomNavInfo: BottomNavDTO = {} as BottomNavDTO; // 当前底导信息
35 @Provide currentTopNavInfo: TopNavDTO = {} as TopNavDTO; // 当前顶导信息 36 @Provide currentTopNavInfo: TopNavDTO = {} as TopNavDTO; // 当前顶导信息
36 @Provide barBackgroundColor: Color = Color.Transparent 37 @Provide barBackgroundColor: Color = Color.Transparent
37 - @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 38 + // @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
38 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 39 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
39 @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据 40 @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] // 底导/顶导全部数据
40 @State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标 41 @State currentNavIndex: number = BottomNavi.NEWS; // 底导当前选中/焦点下标
@@ -89,7 +90,9 @@ export struct BottomNavigationComponent { @@ -89,7 +90,9 @@ export struct BottomNavigationComponent {
89 VideoChannelPage({ 90 VideoChannelPage({
90 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), 91 topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073),
91 _currentNavIndex: $currentNavIndex, 92 _currentNavIndex: $currentNavIndex,
92 - autoRefresh: this.autoRefresh 93 + bottomNavIndex: index,
  94 + autoRefresh: this.autoRefresh,
  95 + navItem: navItem
93 }) 96 })
94 } else { 97 } else {
95 // 其它带顶到的页面,如 新闻、人民号、服务 98 // 其它带顶到的页面,如 新闻、人民号、服务
@@ -381,7 +384,10 @@ export struct BottomNavigationComponent { @@ -381,7 +384,10 @@ export struct BottomNavigationComponent {
381 break 384 break
382 } 385 }
383 } 386 }
  387 +
384 } 388 }
  389 +
  390 +
385 // 没有匹配到换肤,则直接用data.bottomNavList 391 // 没有匹配到换肤,则直接用data.bottomNavList
386 if (list.length <= 0) { 392 if (list.length <= 0) {
387 list = data.bottomNavList 393 list = data.bottomNavList
@@ -6,10 +6,11 @@ import { BottomNavDTO, TopNavDTO } from 'wdBean/Index' @@ -6,10 +6,11 @@ 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 { PageComponent } from 'wdComponent/Index'; 9 +import { CompUtils, PageComponent } from 'wdComponent/Index';
10 import { TrackingButton, TrackConstants } from 'wdTracking/Index'; 10 import { TrackingButton, TrackConstants } from 'wdTracking/Index';
11 -import { Logger } from 'wdKit'; 11 +import { Logger, WindowModel } from 'wdKit';
12 import { ParamType, Tracking } from 'wdTracking/Index'; 12 import { ParamType, Tracking } from 'wdTracking/Index';
  13 +import { ColorUtils } from 'wdComponent/src/main/ets/utils/ColorUtils';
13 14
14 const TAG = 'VideoChannelPage' 15 const TAG = 'VideoChannelPage'
15 16
@@ -22,6 +23,7 @@ export struct VideoChannelPage { @@ -22,6 +23,7 @@ export struct VideoChannelPage {
22 @Prop autoRefresh: number = 0 23 @Prop autoRefresh: number = 0
23 @Prop topNavList: TopNavDTO[] 24 @Prop topNavList: TopNavDTO[]
24 @Link _currentNavIndex?: number; 25 @Link _currentNavIndex?: number;
  26 + @State bottomNavIndex: number = 0
25 @Consume barBackgroundColor: Color 27 @Consume barBackgroundColor: Color
26 @Consume isImmersive: boolean 28 @Consume isImmersive: boolean
27 @Consume displayDirection: DisplayDirection 29 @Consume displayDirection: DisplayDirection
@@ -34,42 +36,89 @@ export struct VideoChannelPage { @@ -34,42 +36,89 @@ export struct VideoChannelPage {
34 @State autoRefresh2Page: number = 0 36 @State autoRefresh2Page: number = 0
35 @Provide showComment: boolean = false 37 @Provide showComment: boolean = false
36 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 38 @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
37 - aboutToAppear(): void {  
38 - this.setBarBackgroundColor()  
39 - console.log(TAG, 'aboutToAppear') 39 + navItem: BottomNavDTO = {} as BottomNavDTO
  40 + // 背景高度
  41 + @State backgroundImageH: number = 0
  42 +
  43 + @Consume @Watch('setBarBackgroundColor') pageShow: number
40 44
41 - console.log('XY', '----VideoChannel-------aboutToAppear') 45 + async aboutToAppear() {
  46 + // 背景图高度
  47 + this.backgroundImageH = px2vp(this.topSafeHeight) + 44
  48 + this.setBarBackgroundColor()
42 } 49 }
43 50
  51 +
44 /** 52 /**
45 * 顶导、底导切换下标都到改变背景色,进入或退出沉浸式 53 * 顶导、底导切换下标都到改变背景色,进入或退出沉浸式
46 */ 54 */
47 setBarBackgroundColor() { 55 setBarBackgroundColor() {
48 - if (this.currentTopNavSelectedIndex === 0 && this.currentBottomNavInfo?.name === '视频') {  
49 - console.error('setBarBackgroundColor', '黑色') 56 +
  57 + Logger.debug('setBarBackgroundColor','setBarBackgroundColor '+this.navItem.name+' '+this.navItem.statusBarColor)
  58 +
  59 + if (this.currentTopNavSelectedIndex === 0 && CompUtils.isVideo(this.currentBottomNavInfo)) {
50 this.barBackgroundColor = Color.Black 60 this.barBackgroundColor = Color.Black
51 this.isImmersive = true 61 this.isImmersive = true
  62 + this.changeTopStatusBarColor(0)
52 } else { 63 } else {
53 - this.barBackgroundColor = Color.White  
54 this.isImmersive = false 64 this.isImmersive = false
55 - console.error('setBarBackgroundColor', '白色') 65 + this.barBackgroundColor = Color.White
  66 + this.changeTopStatusBarColor(this.navItem.statusBarColor)
56 } 67 }
  68 +
57 } 69 }
58 70
59 /** 71 /**
60 - * TODO:根据顶导配置获取颜色展示效果不对,待确认 72 + * 修改手机顶部状态栏颜色
  73 + * @param statusValue
  74 + */
  75 + changeTopStatusBarColor(statusValue: number) {
  76 + if (statusValue === 1) { // 黑色状态栏
  77 + WindowModel.shared.setWindowSystemBarProperties({
  78 + statusBarContentColor: '#000000',
  79 +
  80 + })
  81 + } else { //白色状态栏
  82 + WindowModel.shared.setWindowSystemBarProperties({
  83 + statusBarContentColor: '#ffffff',
  84 + })
  85 + }
  86 + }
  87 +
  88 + /**
  89 + * 得到顶导文字颜色
  90 + * @param item
  91 + * @param index
  92 + * @returns
61 */ 93 */
62 getTopNavFontColor(item: TopNavDTO, index: number): Color | string { 94 getTopNavFontColor(item: TopNavDTO, index: number): Color | string {
63 if (item.channelStyle === 1) { 95 if (item.channelStyle === 1) {
64 - return this.currentTopNavSelectedIndex === index ? Color.White : '#949494' 96 + return this.currentTopNavSelectedIndex === index ? Color.White : this.tabSelectedColor(false)
  97 + } else {
  98 + return this.tabSelectedColor(this.currentTopNavSelectedIndex ===
  99 + index)
  100 + }
  101 + }
  102 +
  103 + /**
  104 + * 频道文字颜色
  105 + * @returns
  106 + */
  107 + tabSelectedColor(selected: boolean): string {
  108 + if (selected) {
  109 + return this.navItem.channelChooseColor ? this.navItem.channelChooseColor : '#222222'
65 } else { 110 } else {
66 - return this.currentTopNavSelectedIndex === index ? Color.Black : "#B2B2B2" 111 + let ccolor = this.navItem.channelChooseCColor.replace('#', '#B3')
  112 + return this.navItem.channelChooseCColor ? ccolor : '#B3999999'
67 } 113 }
  114 +
68 } 115 }
69 116
70 build() { 117 build() {
71 Stack({ alignContent: Alignment.Top }) { 118 Stack({ alignContent: Alignment.Top }) {
  119 +
72 this.pageSwiperView() 120 this.pageSwiperView()
  121 +
73 this.topNavView() 122 this.topNavView()
74 } 123 }
75 .width('100%') 124 .width('100%')
@@ -79,9 +128,11 @@ export struct VideoChannelPage { @@ -79,9 +128,11 @@ export struct VideoChannelPage {
79 @Builder 128 @Builder
80 topNavView() { 129 topNavView() {
81 Stack({ alignContent: Alignment.End }) { 130 Stack({ alignContent: Alignment.End }) {
  131 +
82 Row() { 132 Row() {
83 ForEach(this.topNavList, (item: TopNavDTO, index: number) => { 133 ForEach(this.topNavList, (item: TopNavDTO, index: number) => {
84 Column() { 134 Column() {
  135 +
85 Text(item.name) 136 Text(item.name)
86 .fontSize($r('app.float.selected_text_size')) 137 .fontSize($r('app.float.selected_text_size'))
87 .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal) 138 .fontWeight(this.currentTopNavSelectedIndex === index ? FontWeight.Bold : FontWeight.Normal)
@@ -92,12 +143,12 @@ export struct VideoChannelPage { @@ -92,12 +143,12 @@ export struct VideoChannelPage {
92 }) 143 })
93 .maxLines(this.MAX_LINE) 144 .maxLines(this.MAX_LINE)
94 145
95 - Row() 146 +
  147 + Image($r('app.media.icon_channel_active'))
  148 + .colorFilter(ColorUtils.getDrawingColorFilter(this.getBothColor("")))
96 .width(20) 149 .width(20)
97 - .height(3)  
98 - .backgroundImage($r('app.media.icon_channel_active'), ImageRepeat.NoRepeat)  
99 - .backgroundImageSize(ImageSize.Contain)  
100 - .visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden) 150 + .height(3).visibility(this.currentTopNavSelectedIndex === index ? Visibility.Visible : Visibility.Hidden)
  151 +
101 152
102 } 153 }
103 .padding({ 154 .padding({
@@ -105,11 +156,9 @@ export struct VideoChannelPage { @@ -105,11 +156,9 @@ export struct VideoChannelPage {
105 right: $r('app.float.top_tab_item_padding_horizontal'), 156 right: $r('app.float.top_tab_item_padding_horizontal'),
106 }) 157 })
107 .onClick(() => { 158 .onClick(() => {
108 -  
109 // 视频tab埋点 159 // 视频tab埋点
110 const tab = this.topNavList[index] 160 const tab = this.topNavList[index]
111 Logger.info(TAG, `视频tab埋点: ${JSON.stringify(tab)}`); 161 Logger.info(TAG, `视频tab埋点: ${JSON.stringify(tab)}`);
112 -  
113 const params: ParamType = { 162 const params: ParamType = {
114 "pageName": tab.name, 163 "pageName": tab.name,
115 "tabName": tab.name, 164 "tabName": tab.name,
@@ -131,7 +180,10 @@ export struct VideoChannelPage { @@ -131,7 +180,10 @@ export struct VideoChannelPage {
131 180
132 // 搜索按钮 181 // 搜索按钮
133 Row() { 182 Row() {
134 - Image($r(this.currentTopNavSelectedIndex === 0 ? 'app.media.icon_search_gray_svg' :'app.media.icon_search_svg')) 183 + Image($r(this.currentTopNavSelectedIndex === 0 ? 'app.media.icon_search_gray_svg' :
  184 + 'app.media.icon_search'))
  185 + .colorFilter(this.currentTopNavSelectedIndex === 0 ? undefined :
  186 + ColorUtils.getDrawingColorFilter(this.getBothColor("")))
135 .width('24vp') 187 .width('24vp')
136 .height('24vp') 188 .height('24vp')
137 } 189 }
@@ -159,6 +211,15 @@ export struct VideoChannelPage { @@ -159,6 +211,15 @@ export struct VideoChannelPage {
159 211
160 } 212 }
161 213
  214 + /**
  215 + * 两侧文字图标颜色,搜索图标颜色
  216 + * @returns
  217 + */
  218 + getBothColor(defaultColor: string): string {
  219 + let bothColor = this.navItem.searchBothColor ? this.navItem.searchBothColor : defaultColor
  220 + return bothColor
  221 + }
  222 +
162 @Builder 223 @Builder
163 pageSwiperView() { 224 pageSwiperView() {
164 Swiper(this.swiperController) { 225 Swiper(this.swiperController) {
@@ -175,16 +236,20 @@ export struct VideoChannelPage { @@ -175,16 +236,20 @@ export struct VideoChannelPage {
175 autoRefresh: this.autoRefresh, 236 autoRefresh: this.autoRefresh,
176 }) 237 })
177 } else { 238 } else {
178 - // 直播  
179 - PageComponent({  
180 - currentTopNavSelectedIndex: $currentTopNavSelectedIndex,  
181 - navIndex: index,  
182 - pageId: item.pageId + '',  
183 - channelId: item.channelId + '',  
184 - autoRefresh: this.autoRefresh  
185 - })  
186 - .padding({ top: px2vp(this.topSafeHeight) + 44 })  
187 - .backgroundColor(Color.White) 239 + Column() {
  240 + // 顶部背景图
  241 + Image(this.navItem.backgroundUrl).width('100%').height(this.backgroundImageH)
  242 + // 直播
  243 + PageComponent({
  244 + currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
  245 + navIndex: index,
  246 + pageId: item.pageId + '',
  247 + channelId: item.channelId + '',
  248 + autoRefresh: this.autoRefresh
  249 + })// .padding({ top: px2vp(this.topSafeHeight) + 44 })
  250 + .backgroundColor(Color.White)
  251 + }
  252 +
188 } 253 }
189 }, (item: TopNavDTO) => item.channelId + '') 254 }, (item: TopNavDTO) => item.channelId + '')
190 } 255 }
@@ -197,7 +262,6 @@ export struct VideoChannelPage { @@ -197,7 +262,6 @@ export struct VideoChannelPage {
197 .displayCount(1, true) 262 .displayCount(1, true)
198 .alignSelf(ItemAlign.Start) 263 .alignSelf(ItemAlign.Start)
199 .effectMode(EdgeEffect.None) 264 .effectMode(EdgeEffect.None)
200 - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP])  
201 .onChange((index: number) => { 265 .onChange((index: number) => {
202 this.currentTopNavSelectedIndex = index 266 this.currentTopNavSelectedIndex = index
203 }) 267 })