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 { FolderListComp } from '@ohos/component/src/main/ets/components/FolderListComp' 17import { NoteListComp } from '@ohos/component/src/main/ets/components/NoteListComp' 18import { NoteContentCompPortrait } from '@ohos/component/src/main/ets/components/NoteContentCompPortrait' 19import StyleConstants from '@ohos/utils/src/main/ets/default/constants/StyleConstants' 20import { LogUtil } from '@ohos/utils/src/main/ets/default/baseUtil/LogUtil' 21import { circleColorArray } from '@ohos/utils/src/main/ets/default/model/NoteBaseData' 22import FolderData from '@ohos/utils/src/main/ets/default/model/databaseModel/FolderData' 23import NoteData from '@ohos/utils/src/main/ets/default/model/databaseModel/NoteData' 24import { SysDefFolderUuid } from '@ohos/utils/src/main/ets/default/model/databaseModel/EnumData' 25import LayoutUtil from '@ohos/utils/src/main/ets/default/baseUtil/LayoutUtil' 26import NoteUtil from '@ohos/utils/src/main/ets/default/baseUtil/NoteUtil' 27 28@Entry 29@Component 30export struct NoteHomePortraitComp { 31 // 当前文件夹、笔记、分栏 32 @Provide('SelectedFolderData') selectedFolderData: FolderData = AppStorage.Get('Folder') 33 @Provide('SelectedNoteData') selectedNoteData: NoteData = AppStorage.Get('Note') 34 @Provide('SectionStatus') sectionStatus: number = 1; // 表示分栏状态, 3表示三分栏, 2表示二分栏,1表示一分栏 35 @Provide('LastSectionStatus') lastSectionStatus: number = 1; // 记录分栏上一次的状态 36 @Provide('SelectedColor') selectedColor: string = circleColorArray[0]; 37 @Provide('Longpress') longpress: boolean = false // 第二栏长按状态 38 39 // 分栏状态 40 @Provide('ExpandStatus') expandStatus: boolean = false // 笔记本折叠展开状态 41 @Provide('ChooseNote') chooseNote: boolean = AppStorage.Get<boolean>('Choose') // 是否选择笔记进行打开 42 43 @Provide('Search') search: boolean = false // 是否处于搜索状态 44 @Provide('SearchResultList') searchResultList: NoteData[] = [] // 搜索得到的笔记列表 45 @Provide('InputKeyword') inputKeyword: string = '' // 搜索的字串 46 @Provide('SelectedAll') selectedAll: boolean = false; 47 @Provide('EditModel') editModel: boolean = false 48 TAG = "NoteHomePortraitComp_Phone" 49 @Provide('AsideWidth') asideWidth: number = 200 50 51 build() { 52 Stack({ alignContent: Alignment.Start }) { 53 // Note list display area 54 Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap, justifyContent: FlexAlign.Start }) { 55 NoteListComp() 56 } 57 .width(StyleConstants.PERCENTAGE_100) 58 .height(StyleConstants.PERCENTAGE_100) 59 .enabled(this.expandStatus ? false : true) 60 .backgroundColor($r("app.color.notelist_bgcolor_f1f3f5")) 61 62 // 蒙层 63 if (this.expandStatus) { 64 Column() 65 .width('100%') 66 .height('100%') 67 .position({ x: 0, y: 0 }) 68 .backgroundColor(Color.Black) 69 .opacity(0.2) 70 .transition({ opacity: 0 }) 71 } 72 //Folder list display area 73 Column() { 74 FolderListComp() 75 } 76 .width(200) 77 .height(StyleConstants.PERCENTAGE_100) 78 .position({ x: 0, y: 0 }) 79 .translate({ x: this.expandStatus ? 0 : '-200', y: 0 }) 80 } 81 .width(StyleConstants.PERCENTAGE_100).height(StyleConstants.PERCENTAGE_100) 82 } 83 84 aboutToAppear(): void { 85 LogUtil.info(this.TAG, "aboutToAppear") 86 } 87 88 aboutToDisappear(): void { 89 LogUtil.info(this.TAG, "aboutToDisappear") 90 } 91}