• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
15import { StartTestTitleComponent } from '../common/ui/StartTestTitleComponent';
16import { AppInfoItem } from '../common/entity/LocalConfigEntity';
17import router from '@system.router';
18import SPLogger from '../common/utils/SPLogger'
19
20
21const TAG = 'AppSelectPage'
22/**
23 * app应用选择页
24 */
25@Entry
26@Component
27struct AppSelectPage {
28  build() {
29    Column() {
30      StartTestTitleComponent({ title: '选择应用' })
31      appInfoComponent()
32    }.width('100%').height('100%')
33  }
34}
35
36@Component
37struct appInfoComponent {
38  @State appInfoList: Array<AppInfoItem> = globalThis.appList
39  aboutToAppear() {
40
41  }
42
43  build() {
44    List() {
45      ForEach(this.appInfoList, (appInfoItem) => {
46
47        ListItem() {
48          Row() {
49            Image(appInfoItem.appIcon).width('40vp').height('40vp').margin({ left: '2%' })
50            Flex({
51              justifyContent: FlexAlign.SpaceBetween,
52              alignItems: ItemAlign.Start,
53              direction: FlexDirection.Column
54            }) {
55              Text(appInfoItem.appName)
56                .fontSize('15fp')
57                .fontColor($r('app.color.color_333'))
58                .fontWeight(FontWeight.Bold)
59              Text(appInfoItem.appVersion).fontSize('12fp').fontColor($r('app.color.color_333'))
60              Divider().vertical(false).margin({ top: '5vp' }).height('1vp')
61            }.margin({ left: '4%' }).height('100%').padding({ top: '20vp' })
62          }.alignSelf(ItemAlign.Start).width('100%').height('80vp').onClick(() => {
63            if (router.getParams()['startPage'] == 'startTest') {
64              router.back({ uri: 'pages/StartTestPage', params: {
65                selectPackageName: appInfoItem.packageName,
66                selectAbilityName: appInfoItem.abilityName,
67                appName: appInfoItem.appName,
68                appVersion: appInfoItem.appVersion,
69                appIconId: appInfoItem.appIcon
70              } })
71            }
72          })
73        }
74      }, appInfoItem => appInfoItem.packageName)
75    }.edgeEffect(EdgeEffect.None) // 滑动到边缘无效果
76    .chainAnimation(false) // 联动特效关闭
77  }
78}