• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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
16/**
17 * 热门城市列表项视图
18 * @param hotListItem: 热门列表项数据
19 * @param contentBuilder: 列表项视图
20 */
21
22export class HotListItemView {
23  hotListItem: string;
24  contentBuilder: WrappedBuilder<[string]>;
25
26  constructor(hotListItem: string, contentBuilder: WrappedBuilder<[string]>) {
27    this.hotListItem = hotListItem;
28    this.contentBuilder = contentBuilder;
29  }
30}
31
32/**
33 * 定义城市类型类
34 * name: 数据名称的首字母
35 * dataList: 字母对应的列表数据
36 */
37export class AlphabetListItemType {
38  name: string;
39  dataList: string[];
40
41  constructor(name: string, dataList: string[]) {
42    this.name = name;
43    this.dataList = dataList;
44  }
45}
46
47/**
48 * 城市列表项视图
49 * @param alphabetListItem: 列表项数据
50 * @param contentBuilder: 列表项视图
51 */
52export class AlphabetListItemView {
53  alphabetListItem: AlphabetListItemType;
54  contentBuilder: WrappedBuilder<[string]>;
55
56  constructor(alphabetListItem: AlphabetListItemType, contentBuilder: WrappedBuilder<[string]>) {
57    this.alphabetListItem = alphabetListItem;
58    this.contentBuilder = contentBuilder;
59  }
60}
61
62// 城市列表数据
63export const CITY_DATA = [
64  new AlphabetListItemType('A', ['阿尔山', '阿勒泰地区', '安庆', '安阳']),
65  new AlphabetListItemType('B', ['北京', '亳州', '包头', '宝鸡']),
66  new AlphabetListItemType('C', ['重庆', '长春', '长沙', '成都']),
67  new AlphabetListItemType('F', ['福州', '阜阳', '佛山', '抚顺']),
68  new AlphabetListItemType('G', ['广州', '桂林', '赣州', '高雄']),
69  new AlphabetListItemType('H', ['哈尔滨', '合肥', '杭州', '呼和浩特', '鹤岗', '呼兰']),
70  new AlphabetListItemType('J', ['济南', '九江', '佳木斯']),
71  new AlphabetListItemType('L', ['兰州', '丽江', '洛阳',]),
72  new AlphabetListItemType('N', ['南昌', '南京', '宁波']),
73  new AlphabetListItemType('Q', ['青岛', '七台河', '秦皇岛']),
74  new AlphabetListItemType('S', ['上海', '沈阳', '石家庄', '三亚', '双鸭山', '深圳', '苏州']),
75  new AlphabetListItemType('T', ['天津', '太原', '吐鲁番', '台北', '台湾', '唐山']),
76  new AlphabetListItemType('W', ['武汉', '文昌', '温岭', '温州', '芜湖']),
77  new AlphabetListItemType('X', ['西安', '咸阳', '信阳', '厦门', '香港', '响水', '湘西']),
78  new AlphabetListItemType('Y', ['银川', '延吉', '宜昌', '延边', '扬州', '烟台']),
79  new AlphabetListItemType('Z',
80    ['郑州', '珠海', '张家口', '张家界', '镇江', '中山', '枣阳', '枣庄', '漳州', '枝江', '芷江', '织金', '中牟', '中卫',
81      '周口', '舟山', '庄河', '珠海'])
82];
83
84
85// 国内热门城市数据
86export const HOT_CITY =
87  ['北京', '上海', '广州', '深圳', '杭州', '南京', '苏州', '天津', '武汉', '长沙', '重庆', '成都'];
88