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 LogUtils from '../utils/LogUtils'; 17 18const TAG = 'InComDialog'; 19 20@CustomDialog 21export default struct InComDialog { 22 @StorageLink('curBp') curBp: string = 'md' 23 controller: CustomDialogController; 24 cancel: () => void; 25 confirm: (msg) => void; 26 cancelHandle: () => void; 27 list: []; 28 29 build() { 30 GridRow({ columns: { xs: 4, sm: 4, md: 8, lg: 12 }, gutter: 12 }) { 31 GridCol({ span: 4, offset: { md: 2, lg: 4 } }) { 32 Column() { 33 Column() { 34 Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Start }) { 35 Text($r('app.string.hangUpReply')) 36 .fontSize(20) 37 .fontWeight(FontWeight.Medium) 38 .fontColor('#182431') 39 .height(56) 40 } 41 .onClick(() => { 42 return; 43 }) 44 45 Column() { 46 ForEach(this.list, (item) => { 47 Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { 48 Text(item.msg) 49 .width('100%') 50 .fontSize(16) 51 .height(48) 52 .fontColor('#182431') 53 .fontWeight(FontWeight.Medium) 54 } 55 .onClick(() => { 56 this.controller.close(); 57 this.confirm(item) 58 LogUtils.i(TAG, 'onClick and confirm'); 59 }) 60 61 if (item.id !== 4) { 62 Divider() 63 .color($r('app.color.divider_gray')) 64 .height(0.5) 65 } 66 }) 67 } 68 69 Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { 70 Text($r('app.string.cancel')) 71 .fontColor('#00CB87') 72 .fontSize(16) 73 .height(40) 74 .fontWeight(FontWeight.Medium) 75 } 76 .margin({ top: 8, bottom: 16 }) 77 .onClick(() => { 78 LogUtils.i(TAG, 'onClick'); 79 this.controller.close(); 80 }) 81 } 82 .padding({ left: 24, right: 24 }) 83 .backgroundColor(Color.White) 84 .borderRadius(32) 85 } 86 .height('100%') 87 .justifyContent(this.curBp === 'sm' ? FlexAlign.End : FlexAlign.Center) 88 } 89 } 90 .margin({ left: 12, right: 12, bottom: this.curBp === 'sm' ? 16 : 0 }) 91 .onClick(() => { 92 this.controller.close(); 93 }) 94 } 95}