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 16// 预测 气象列表 17class Forecast { 18 constructor(public degree: string, public date: string, public desc: string, public icon: Resource | string, public win: string, public winSpeed: string) { 19 this.degree = degree 20 this.date = date 21 this.desc = desc 22 this.icon = icon 23 this.win = win 24 this.winSpeed = winSpeed 25 } 26} 27 28// 一周天气 29class WeekWeather { 30 constructor(public date: string, public week: string, public icon: Resource | string, public weather: string, public airLevel: string, public max: string, public min: string) { 31 this.date = date 32 this.week = week 33 this.icon = icon 34 this.weather = weather 35 this.airLevel = airLevel 36 this.max = max 37 this.min = min 38 } 39} 40 41 42// 空气质量 43class AirIndex { 44 constructor(public index: string, public figure: number) { 45 this.index = index 46 this.figure = figure 47 } 48} 49 50// 舒适度 51class SuitData { 52 constructor(public src: Resource, public desc: string, public value: string) { 53 this.src = src 54 this.desc = desc 55 this.value = value 56 } 57} 58 59// canvas里数据 60class AirData { 61 constructor(public airQuality: string, public airDesc: string) { 62 this.airQuality = airQuality 63 this.airDesc = airDesc 64 } 65} 66 67class HeaderData { 68 constructor(public city: string, public temp: string, public weatherType: string, public max: string, public min: string, public icon: Resource | string, public airData: AirData, public airTips: string) { 69 this.city = city 70 this.temp = temp 71 this.weatherType = weatherType 72 this.max = max 73 this.min = min 74 this.icon = icon 75 this.airData = airData 76 this.airTips = airTips 77 } 78} 79 80// city里数据 81class City { 82 constructor(public name: string, public temp: string, public weather: string) { 83 this.name = name 84 this.temp = temp 85 this.weather = weather 86 } 87} 88 89class CityListData { 90 constructor(public city: string, public header: HeaderData, public hoursData: Forecast[], public weekData: WeekWeather[], public airData: AirData, public airIndex: AirIndex[], public suitDate: SuitData[]) { 91 this.city = city 92 this.header = header 93 this.hoursData = hoursData 94 this.weekData = weekData 95 this.airData = airData 96 this.airIndex = airIndex 97 this.suitDate = suitDate 98 } 99} 100 101 102export { HeaderData, CityListData, Forecast, AirIndex, SuitData, WeekWeather, AirData, City }