Showing
2 changed files
with
23 additions
and
20 deletions
| @@ -59,7 +59,6 @@ export struct TopNavigationComponent { | @@ -59,7 +59,6 @@ export struct TopNavigationComponent { | ||
| 59 | @State autoRefresh2Page: number = 0 | 59 | @State autoRefresh2Page: number = 0 |
| 60 | // 当前底导index | 60 | // 当前底导index |
| 61 | @State navIndex: number = 0 | 61 | @State navIndex: number = 0 |
| 62 | - | ||
| 63 | @State animationDuration: number = 0 | 62 | @State animationDuration: number = 0 |
| 64 | @State indicatorLeftMargin: number = 0 | 63 | @State indicatorLeftMargin: number = 0 |
| 65 | @State indicatorWidth: number = 0 | 64 | @State indicatorWidth: number = 0 |
| @@ -93,7 +92,8 @@ export struct TopNavigationComponent { | @@ -93,7 +92,8 @@ export struct TopNavigationComponent { | ||
| 93 | 92 | ||
| 94 | //defaultMyChannelList | 93 | //defaultMyChannelList |
| 95 | defaultList.forEach(item => { | 94 | defaultList.forEach(item => { |
| 96 | - if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || item.headlinesOn === 1) { | 95 | + if (item.defaultPermitted === 1 || item.movePermitted === 0 || item.delPermitted === 0 || |
| 96 | + item.headlinesOn === 1) { | ||
| 97 | defaultMyChannelList.push(item); | 97 | defaultMyChannelList.push(item); |
| 98 | } | 98 | } |
| 99 | if (item.defaultPermitted === 1) { | 99 | if (item.defaultPermitted === 1) { |
| @@ -169,7 +169,6 @@ export struct TopNavigationComponent { | @@ -169,7 +169,6 @@ export struct TopNavigationComponent { | ||
| 169 | return item.name === '版面' | 169 | return item.name === '版面' |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | - | ||
| 173 | build() { | 172 | build() { |
| 174 | Column() { | 173 | Column() { |
| 175 | // 顶部搜索、日报logo、早晚报 | 174 | // 顶部搜索、日报logo、早晚报 |
| @@ -216,7 +215,8 @@ export struct TopNavigationComponent { | @@ -216,7 +215,8 @@ export struct TopNavigationComponent { | ||
| 216 | // 频道分类list | 215 | // 频道分类list |
| 217 | Stack({ alignContent: Alignment.TopEnd }) { | 216 | Stack({ alignContent: Alignment.TopEnd }) { |
| 218 | Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { | 217 | Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) { |
| 219 | - ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => { | 218 | + ForEach(this.currentBottomNavName === '新闻' ? this.myChannelList : this.topNavList, |
| 219 | + (navItem: TopNavDTO, index: number) => { | ||
| 220 | TabContent() { | 220 | TabContent() { |
| 221 | if (this.currentBottomNavName === '视频' && navItem.name === '视频') { | 221 | if (this.currentBottomNavName === '视频' && navItem.name === '视频') { |
| 222 | VideoChannelDetail({ | 222 | VideoChannelDetail({ |
| @@ -226,16 +226,14 @@ export struct TopNavigationComponent { | @@ -226,16 +226,14 @@ export struct TopNavigationComponent { | ||
| 226 | pageId: navItem.pageId + '', | 226 | pageId: navItem.pageId + '', |
| 227 | channelId: navItem.channelId + '', | 227 | channelId: navItem.channelId + '', |
| 228 | }) | 228 | }) |
| 229 | - } | ||
| 230 | - else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') { | 229 | + } else if (this.currentBottomNavName === '人民号' && navItem.name === '关注') { |
| 231 | PeopleShipMainComponent({ | 230 | PeopleShipMainComponent({ |
| 232 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | 231 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, |
| 233 | navIndex: index, | 232 | navIndex: index, |
| 234 | pageId: navItem.pageId + '', | 233 | pageId: navItem.pageId + '', |
| 235 | channelId: navItem.channelId + '', | 234 | channelId: navItem.channelId + '', |
| 236 | }) | 235 | }) |
| 237 | - } | ||
| 238 | - else | 236 | + } else |
| 239 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { | 237 | if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) { |
| 240 | PageComponent({ | 238 | PageComponent({ |
| 241 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, | 239 | currentTopNavSelectedIndex: $currentTopNavSelectedIndex, |
| @@ -254,13 +252,16 @@ export struct TopNavigationComponent { | @@ -254,13 +252,16 @@ export struct TopNavigationComponent { | ||
| 254 | .barMode(BarMode.Scrollable) | 252 | .barMode(BarMode.Scrollable) |
| 255 | .vertical(false) | 253 | .vertical(false) |
| 256 | .barBackgroundColor(this.barBackgroundColor) | 254 | .barBackgroundColor(this.barBackgroundColor) |
| 257 | - .onAreaChange((oldValue: Area,newValue: Area)=> { | 255 | + .backgroundColor(this.barBackgroundColor) |
| 256 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 257 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 258 | let width = Number.parseFloat(newValue.width.toString()) | 258 | let width = Number.parseFloat(newValue.width.toString()) |
| 259 | this.tabsWidth = Number.isNaN(width) ? 0 : width | 259 | this.tabsWidth = Number.isNaN(width) ? 0 : width |
| 260 | }) | 260 | }) |
| 261 | .animationDuration(this.animationDuration) | 261 | .animationDuration(this.animationDuration) |
| 262 | .onChange((index: number) => { | 262 | .onChange((index: number) => { |
| 263 | - this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name | 263 | + this.currentTopNavName = |
| 264 | + this._currentNavIndex === 0 ? this.myChannelList[index].name : this.topNavList[index].name | ||
| 264 | Logger.info(TAG, `onChange index : ${index}`); | 265 | Logger.info(TAG, `onChange index : ${index}`); |
| 265 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | 266 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && |
| 266 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | 267 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) |
| @@ -288,24 +289,24 @@ export struct TopNavigationComponent { | @@ -288,24 +289,24 @@ export struct TopNavigationComponent { | ||
| 288 | let targetIndexInfo = this.getTextInfo(targetIndex) | 289 | let targetIndexInfo = this.getTextInfo(targetIndex) |
| 289 | this.startAnimateTo(this.animationDuration, targetIndexInfo.left, targetIndexInfo.width) | 290 | this.startAnimateTo(this.animationDuration, targetIndexInfo.left, targetIndexInfo.width) |
| 290 | }) | 291 | }) |
| 291 | - .onAnimationEnd((index: number,event: TabsAnimationEvent) => { | 292 | + .onAnimationEnd((index: number, event: TabsAnimationEvent) => { |
| 292 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | 293 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && |
| 293 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | 294 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) |
| 294 | ) { | 295 | ) { |
| 295 | return | 296 | return |
| 296 | } | 297 | } |
| 297 | // 切换动画结束时触发该回调。下划线动画停止。 | 298 | // 切换动画结束时触发该回调。下划线动画停止。 |
| 298 | - let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,event) | ||
| 299 | - this.startAnimateTo(0,currentIndicatorInfo.left,currentIndicatorInfo.width) | 299 | + let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event) |
| 300 | + this.startAnimateTo(0, currentIndicatorInfo.left, currentIndicatorInfo.width) | ||
| 300 | }) | 301 | }) |
| 301 | - .onGestureSwipe((index: number,event: TabsAnimationEvent) => { | 302 | + .onGestureSwipe((index: number, event: TabsAnimationEvent) => { |
| 302 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && | 303 | if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) && |
| 303 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) | 304 | !this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) |
| 304 | ) { | 305 | ) { |
| 305 | return | 306 | return |
| 306 | } | 307 | } |
| 307 | // 在页面跟手滑动过程中,逐帧触发该回调。 | 308 | // 在页面跟手滑动过程中,逐帧触发该回调。 |
| 308 | - let currentIndicatorInfo = this.getCurrentIndicatorInfo(index,event) | 309 | + let currentIndicatorInfo = this.getCurrentIndicatorInfo(index, event) |
| 309 | this.currentTopNavSelectedIndex = currentIndicatorInfo.index | 310 | this.currentTopNavSelectedIndex = currentIndicatorInfo.index |
| 310 | this.indicatorLeftMargin = currentIndicatorInfo.left | 311 | this.indicatorLeftMargin = currentIndicatorInfo.left |
| 311 | this.indicatorWidth = currentIndicatorInfo.width | 312 | this.indicatorWidth = currentIndicatorInfo.width |
| @@ -351,8 +352,9 @@ export struct TopNavigationComponent { | @@ -351,8 +352,9 @@ export struct TopNavigationComponent { | ||
| 351 | .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') }) | 352 | .padding({ top: $r('app.float.top_tab_item_padding_top'), bottom: $r('app.float.top_tab_item_padding_bottom') }) |
| 352 | .maxLines(this.MAX_LINE) | 353 | .maxLines(this.MAX_LINE) |
| 353 | .id(index.toString()) | 354 | .id(index.toString()) |
| 354 | - .onAreaChange((oldValue: Area,newValue: Area) => { | ||
| 355 | - if (this.currentTopNavSelectedIndex === index && (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)){ | 355 | + .onAreaChange((oldValue: Area, newValue: Area) => { |
| 356 | + if (this.currentTopNavSelectedIndex === index && | ||
| 357 | + (this.indicatorLeftMargin === 0 || this.indicatorWidth === 0)) { | ||
| 356 | if (newValue.position.x != undefined) { | 358 | if (newValue.position.x != undefined) { |
| 357 | let positionX = Number.parseFloat(newValue.position.x.toString()) | 359 | let positionX = Number.parseFloat(newValue.position.x.toString()) |
| 358 | this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX | 360 | this.indicatorLeftMargin = Number.isNaN(positionX) ? 0 : positionX |
| @@ -396,7 +398,8 @@ export struct TopNavigationComponent { | @@ -396,7 +398,8 @@ export struct TopNavigationComponent { | ||
| 396 | } | 398 | } |
| 397 | 399 | ||
| 398 | onTopNavigationDataUpdated() { | 400 | onTopNavigationDataUpdated() { |
| 399 | - Logger.info(TAG, `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); | 401 | + Logger.info(TAG, |
| 402 | + `onTopNavigationDataUpdated currentTopNavIndex: ${this.currentTopNavSelectedIndex},topNavList.length:${this.topNavList.length}`); | ||
| 400 | } | 403 | } |
| 401 | 404 | ||
| 402 | onAutoRefresh() { | 405 | onAutoRefresh() { |
| @@ -101,7 +101,7 @@ export struct VideoChannelDetail { | @@ -101,7 +101,7 @@ export struct VideoChannelDetail { | ||
| 101 | openFullScreen() { | 101 | openFullScreen() { |
| 102 | WindowModel.shared.setWindowSystemBarProperties({ | 102 | WindowModel.shared.setWindowSystemBarProperties({ |
| 103 | statusBarContentColor: '#ffffff', | 103 | statusBarContentColor: '#ffffff', |
| 104 | - statusBarColor: '#000000', | 104 | + // statusBarColor: '#000000', |
| 105 | // navigationBarColor: '#000000', | 105 | // navigationBarColor: '#000000', |
| 106 | // navigationBarContentColor: '#ffffff' | 106 | // navigationBarContentColor: '#ffffff' |
| 107 | }) | 107 | }) |
| @@ -116,7 +116,7 @@ export struct VideoChannelDetail { | @@ -116,7 +116,7 @@ export struct VideoChannelDetail { | ||
| 116 | closeFullScreen() { | 116 | closeFullScreen() { |
| 117 | WindowModel.shared.setWindowSystemBarProperties({ | 117 | WindowModel.shared.setWindowSystemBarProperties({ |
| 118 | statusBarContentColor: '#000000', | 118 | statusBarContentColor: '#000000', |
| 119 | - statusBarColor: '#ffffff', | 119 | + // statusBarColor: '#ffffff', |
| 120 | // navigationBarColor: '#0x66000000', | 120 | // navigationBarColor: '#0x66000000', |
| 121 | // navigationBarContentColor: '#0xE5FFFFFF' | 121 | // navigationBarContentColor: '#0xE5FFFFFF' |
| 122 | 122 |
-
Please register or login to post a comment