wangyujian_wd

feat:1)底部tab为视频模块时,隐藏顶部搜索/人民日报/早晚报栏;

... ... @@ -4,8 +4,8 @@
*/
export const enum BottomNavi {
NEWS = 0,
PEOPLE,
VIDEO,
SERVICE,
MINE,
PEOPLE=1,
VIDEO=2,
SERVICE=3,
MINE=4,
}
... ...
... ... @@ -16,7 +16,7 @@ export struct BottomNavigationComponent {
// 底导/顶导全部数据
@State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = []
// 底导当前选中/焦点下标
@Provide currentNavIndex: number = BottomNavi.NEWS;
@State currentNavIndex: number = BottomNavi.NEWS;
// 底导TabsController
private navController: TabsController = new TabsController();
readonly ASPECT_RATIO_1_1: number = 1 / 1; // 底导图片宽高比
... ... @@ -51,7 +51,7 @@ export struct BottomNavigationComponent {
// 我的页面组件数据列表
MinePageComponent()
} else {
TopNavigationComponent({ topNavList: navItem.topNavChannelList })
TopNavigationComponent({ topNavList: navItem.topNavChannelList, _currentNavIndex: this.currentNavIndex })
}
}
}
... ... @@ -85,6 +85,7 @@ export struct BottomNavigationComponent {
}
.height($r('app.float.bottom_navigation_barHeight'))
.hoverEffect(HoverEffect.Highlight)
// .justifyContent(FlexAlign.Center)
// .onClick(() => {
// Logger.info(TAG, `onClick, index: ${index}`);
... ...
... ... @@ -10,6 +10,7 @@ const TAG = 'TopNavigationComponent';
*/
@Component
export struct TopNavigationComponent {
@Prop _currentNavIndex?: number;
// 顶导当前选中/焦点下标
@State currentTopNavSelectedIndex: number = 0;
// 顶导数据
... ... @@ -19,15 +20,15 @@ export struct TopNavigationComponent {
build() {
Column() {
RelativeContainer(){
Stack({ alignContent: Alignment.Center }){
RelativeContainer() {
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.background_search'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Contain)
Row(){
Row() {
Image($r('app.media.icon_search'))
.width(18)
.height(18)
... ... @@ -62,12 +63,12 @@ export struct TopNavigationComponent {
.alignRules({ middle: { anchor: "__container__", align: HorizontalAlign.Center },
center: { anchor: "__container__", align: VerticalAlign.Center } })
Stack({ alignContent: Alignment.Center }){
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.background_read_paper_home'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Contain)
Row(){
Row() {
Image($r('app.media.icon_read_paper_home'))
.width(18)
.height(18)
... ... @@ -84,7 +85,7 @@ export struct TopNavigationComponent {
.id('read')
.alignRules({ right: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center } })
.onClick((event: ClickEvent)=>{
.onClick((event: ClickEvent) => {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
... ... @@ -97,6 +98,7 @@ export struct TopNavigationComponent {
}
.width('100%')
.height(40)
.visibility(this._currentNavIndex != 2 ? Visibility.Visible : Visibility.None)
Tabs() {
ForEach(this.topNavList, (navItem: TopNavDTO, index: number) => {
... ... @@ -132,7 +134,7 @@ export struct TopNavigationComponent {
.maxLines(this.MAX_LINE)
Divider()
.width(16)
.strokeWidth(2) // 分割线粗细度。
.strokeWidth(2)// 分割线粗细度。
.padding({ top: 2 })
.color(Color.Red)
.opacity(this.currentTopNavSelectedIndex === index ? 1 : 0)
... ...