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 router from '@ohos.router' 17import { RESOURCES } from '../mock/InfoData' 18import { TitleBar, Title } from './common/Common' 19 20@Entry 21@Component 22struct MobileData { 23 private isLand: boolean = false 24 25 build() { 26 Column() { 27 if (this.isLand) { 28 TitleBar() 29 } 30 31 Title({ title: $r('app.string.mobile_network') }) 32 33 Column() { 34 Row() { 35 Text($r('app.string.airplane')) 36 .height(48) 37 .fontSize(16) 38 .fontColor('#182431') 39 40 Blank() 41 42 Toggle({ type: ToggleType.Switch, isOn: false }) 43 .width(36) 44 .height(20) 45 .enabled(false) 46 .selectedColor('#0D9FFB') 47 .switchPointColor(0xe5ffffff) 48 } 49 .width('100%') 50 .borderRadius(24) 51 .padding({ left: 24, right: 24 }) 52 .backgroundColor(Color.White) 53 54 ForEach(RESOURCES, (item) => { 55 this.textShow(item) 56 }, item => JSON.stringify(item)) 57 } 58 .width('95%') 59 .borderRadius(24) 60 .margin({ bottom: 8 }) 61 .padding({ top: 4, bottom: 4 }) 62 .backgroundColor(Color.White) 63 64 Row() { 65 Text($r('app.string.traffic_management')) 66 .fontSize(16) 67 .fontColor('#182431') 68 .layoutWeight(1) 69 70 Blank() 71 72 Image($r('app.media.right')) 73 .width(16) 74 .height(18) 75 .objectFit(ImageFit.Contain) 76 } 77 .width('95%') 78 .borderRadius(24) 79 .height(56) 80 .padding({ top: 4, bottom: 4, left: 24, right: 24 }) 81 .backgroundColor(Color.White) 82 } 83 .width('100%') 84 .height('100%') 85 .backgroundColor('#fff6f6f6') 86 } 87 88 @Builder textShow(text: string) { 89 Row() { 90 Text(text) 91 .fontSize(16) 92 .fontColor('#182431') 93 94 Blank() 95 96 Image($r('app.media.right')) 97 .width(16) 98 .height(18) 99 .objectFit(ImageFit.Contain) 100 } 101 .width('100%') 102 .height(48) 103 .padding({ left: 24, right: 24 }) 104 } 105 106 aboutToAppear() { 107 try { 108 this.isLand = router.getParams()['bool'] 109 } catch (err) { 110 this.isLand = false 111 } 112 } 113}