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 { WLANDATA } from '../mock/InfoData' 18import { TitleBar, Title, Taggle, Show } from './common/Common' 19 20@Entry 21@Component 22struct Wlan { 23 private isLand: boolean = false 24 25 build() { 26 Column() { 27 if (this.isLand) { 28 TitleBar() 29 } 30 31 Title({ title: $r('app.string.wlan') }) 32 Taggle({ info: $r('app.string.wlan') }) 33 34 Show({ info: $r('app.string.connect_wlan') }) 35 .margin({ left: 24 }) 36 37 Row() { 38 this.ShowInfo($r('app.string.wlan_index'), $r('app.string.connect'), $r('app.media.wlanLock')) 39 } 40 .width('95%') 41 .height(64) 42 .borderRadius(24) 43 .padding({ left: 24, right: 24, top: 4, bottom: 4 }) 44 .backgroundColor(Color.White) 45 46 Show({ info: $r('app.string.available_wlan') }) 47 .margin({ left: 24 }) 48 49 Column() { 50 ForEach(WLANDATA, (item) => { 51 Row() { 52 this.ShowInfo(item.text, item.info, item.img) 53 } 54 .height(64) 55 }, item => JSON.stringify(item)) 56 } 57 .width('95%') 58 .borderRadius(24) 59 .padding({ top: 4, bottom: 4, left: 24, right: 24 }) 60 .backgroundColor(Color.White) 61 } 62 .width('100%') 63 .height('100%') 64 .backgroundColor('#fff6f6f6') 65 } 66 67 @Builder ShowInfo(text: Resource, info: Resource, img: Resource) { 68 Row() { 69 Column() { 70 Row() { 71 Text(text) 72 .fontSize(16) 73 .layoutWeight(1) 74 75 Blank() 76 } 77 78 Row() { 79 Text(info) 80 .fontSize(14) 81 .layoutWeight(1) 82 83 Blank() 84 } 85 .margin({ top: 2 }) 86 } 87 .layoutWeight(1) 88 89 Blank() 90 91 Image(img) 92 .width(24) 93 .height(18) 94 .objectFit(ImageFit.Contain) 95 } 96 } 97 98 aboutToAppear() { 99 try { 100 this.isLand = router.getParams()['bool'] 101 } catch (err) { 102 this.isLand = false 103 } 104 } 105}