1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { Log } from '../../utils/Log' 17import getStore from '../../redux/store' 18import { Action } from '../../redux/actions/Action' 19 20let tabBarState = (state) => { 21 return { 22 isThirdPartyCall: state.ContextReducer.isThirdPartyCall 23 } 24} 25 26let tabBarDispatcher = (dispatch) => { 27 return { 28 showSettingView: () => { 29 dispatch(Action.showSettingView(true)) 30 }, 31 } 32} 33 34@Component 35export struct TabBar { 36 private TAG: string = '[TabBar]' 37 @State state: any = {} 38 private onBackClicked:Function 39 40 aboutToAppear(): void { 41 Log.info(`${this.TAG} aboutToAppear invoke E`) 42 getStore().connect(tabBarState, tabBarDispatcher)(this.state) 43 Log.info(`${this.TAG} aboutToAppear invoke X`) 44 } 45 46 build() { 47 Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { 48 Column() { 49// TabBarOther() 50 }.width('40%').height('100%') 51 Column() { 52 if (this.state.isThirdPartyCall) { 53 Row() { 54 Image($r("app.media.ic_public_back")).width(24).height(24) 55 .onClick(() => { 56 this.state.showSettingView() 57 this.onBackClicked() 58 }) 59 }.width(48).height(48) 60 .padding({left: 12}) 61 .margin({ bottom: 12 }) 62 } 63 }.width('40%').height('100%') 64 Column() { 65 Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { 66 Image($r('app.media.setting')).width(24).height(24) 67 }.width('100%').height('100%') 68 }.width('20%').height('100%').onClick(() => { 69 this.state.showSettingView() 70 }) 71 }.width('100%').height('100%') 72 } 73}