yuzhilin

版面切换

... ... @@ -35,6 +35,7 @@ export struct TopNavigationComponent {
// 地方频道列表
@State localChannelList: TopNavDTO[] = []
readonly MAX_LINE: number = 1;
//处理新闻tab顶导频道数据
topNavListHandle() {
let _channelIds: number [] = []
... ... @@ -120,6 +121,20 @@ export struct TopNavigationComponent {
return item.name === '播报'
}
isLayout(item: TopNavDTO) {
return item.name === '版面'
}
jumpToENewPaper() {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'E_NEWSPAPER'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
... ... @@ -131,13 +146,7 @@ export struct TopNavigationComponent {
.width(72)
.height(29)
.onClick((event: ClickEvent) => {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'E_NEWSPAPER'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
this.jumpToENewPaper()
})
Stack({ alignContent: Alignment.Center }) {
... ... @@ -172,7 +181,7 @@ export struct TopNavigationComponent {
}
.width('100%')
.height(40)
.padding({top:10})
.padding({ top: 10 })
.backgroundColor($r('app.color.white'))
.visibility(this._currentNavIndex == 0 ? Visibility.Visible : Visibility.None)
... ... @@ -181,7 +190,7 @@ export struct TopNavigationComponent {
Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
TabContent() {
if (!this.isBroadcast(navItem)) {
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
... ... @@ -198,9 +207,12 @@ export struct TopNavigationComponent {
.vertical(false)
.onChange((index: number) => {
Logger.info(TAG, `onChange index : ${index}`);
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
if (!this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index]) &&
!this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])
) {
this.currentTopNavSelectedIndex = index;
} else {
}
if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
// 跳转到播报页面
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
... ... @@ -212,6 +224,10 @@ export struct TopNavigationComponent {
WDRouterRule.jumpWithAction(taskAction)
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}
if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
this.jumpToENewPaper()
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}
})
// 分类列表最右侧频道设置
... ...