Showing
1 changed file
with
14 additions
and
2 deletions
| @@ -72,6 +72,7 @@ export struct TopNavigationComponentNew { | @@ -72,6 +72,7 @@ export struct TopNavigationComponentNew { | ||
| 72 | private tabsWidth: number = 0 | 72 | private tabsWidth: number = 0 |
| 73 | 73 | ||
| 74 | build() { | 74 | build() { |
| 75 | + Column() { | ||
| 75 | // 频道分类list | 76 | // 频道分类list |
| 76 | RelativeContainer() { | 77 | RelativeContainer() { |
| 77 | this.tabBar() | 78 | this.tabBar() |
| @@ -135,6 +136,7 @@ export struct TopNavigationComponentNew { | @@ -135,6 +136,7 @@ export struct TopNavigationComponentNew { | ||
| 135 | .width('100%') | 136 | .width('100%') |
| 136 | .height('100%') | 137 | .height('100%') |
| 137 | } | 138 | } |
| 139 | + } | ||
| 138 | 140 | ||
| 139 | @Builder | 141 | @Builder |
| 140 | topBar() { | 142 | topBar() { |
| @@ -316,7 +318,7 @@ export struct TopNavigationComponentNew { | @@ -316,7 +318,7 @@ export struct TopNavigationComponentNew { | ||
| 316 | bottom: 2, | 318 | bottom: 2, |
| 317 | }) | 319 | }) |
| 318 | .id(`col_tabBar${index}`) | 320 | .id(`col_tabBar${index}`) |
| 319 | - .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 }) | 321 | + // .margin({ right: this.myChannelList.length === index + 1 ? 36 : 0 }) |
| 320 | .onClick(() => { | 322 | .onClick(() => { |
| 321 | Logger.debug(TAG, `onClick, index: ${index}`); | 323 | Logger.debug(TAG, `onClick, index: ${index}`); |
| 322 | if (this.currentTopNavSelectedIndex === index) { | 324 | if (this.currentTopNavSelectedIndex === index) { |
| @@ -487,9 +489,19 @@ export struct TopNavigationComponentNew { | @@ -487,9 +489,19 @@ export struct TopNavigationComponentNew { | ||
| 487 | } | 489 | } |
| 488 | 490 | ||
| 489 | /** | 491 | /** |
| 492 | + * 判断是否当前页面处理逻辑,如消息通知,只需要切换到当前底导的处理,过滤掉非当前。 | ||
| 493 | + */ | ||
| 494 | + private isCurrentPage(): boolean { | ||
| 495 | + return this._currentNavIndex === this.bottomNavIndex | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + /** | ||
| 490 | * 频道id变化,即指定频道跳转场景 | 499 | * 频道id变化,即指定频道跳转场景 |
| 491 | */ | 500 | */ |
| 492 | onAssignChannelChange() { | 501 | onAssignChannelChange() { |
| 502 | + if (!this.isCurrentPage()) { | ||
| 503 | + return | ||
| 504 | + } | ||
| 493 | let channelId = this.assignChannel.channelId | 505 | let channelId = this.assignChannel.channelId |
| 494 | let index = -1 | 506 | let index = -1 |
| 495 | if (this._currentNavIndex === 0) { | 507 | if (this._currentNavIndex === 0) { |
| @@ -537,7 +549,7 @@ export struct TopNavigationComponentNew { | @@ -537,7 +549,7 @@ export struct TopNavigationComponentNew { | ||
| 537 | private getChannelByMine(channelId: string) { | 549 | private getChannelByMine(channelId: string) { |
| 538 | for (let i = 0; i < this.myChannelList.length; i++) { | 550 | for (let i = 0; i < this.myChannelList.length; i++) { |
| 539 | let topNavDTO: TopNavDTO = this.myChannelList[i] | 551 | let topNavDTO: TopNavDTO = this.myChannelList[i] |
| 540 | - if (topNavDTO.channelId?.toString() === channelId) { | 552 | + if (topNavDTO?.channelId?.toString() === channelId) { |
| 541 | return i | 553 | return i |
| 542 | } | 554 | } |
| 543 | } | 555 | } |
-
Please register or login to post a comment