From 4b35f9a98f9431e17fc96d998c7cc9021776787b Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Thu, 12 Jul 2018 11:50:24 +0800 Subject: [PATCH] 删除多余文件 --- src/app/routes/home-page/home-page/home-page.component.ts | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/routes/home-page/home-page/home-page.component.ts b/src/app/routes/home-page/home-page/home-page.component.ts index d52b29f..08b5c83 100644 --- a/src/app/routes/home-page/home-page/home-page.component.ts +++ b/src/app/routes/home-page/home-page/home-page.component.ts @@ -8,7 +8,7 @@ styleUrls: ["./home-page.component.less"] }) export class HomePageComponent implements OnInit { - public cardData: {'api'?:number,'temperature'?:number,'windDirection'?: string,'pm2.5'?: number} + public cardData: {'api'?:number,'temperature'?:number,'windDirection'?: string,'pm25'?: number} = {}; constructor( private http:_HttpClient, @@ -21,10 +21,15 @@ this.http.get('http://sapi.7drlb.com/api/mj?cityID=1102&apiKey=aqi') ).subscribe( - ([conRes,aqiRes]) => { - debugger; - console.log(conRes); - console.log(aqiRes); + ([conRes,aqiRes]) => { + console.log(conRes); + console.log(aqiRes); + if( conRes.code == 0 && aqiRes.code == 0 ) { + this.cardData.windDirection =conRes.data.condition.windDir; + this.cardData.temperature =conRes.data.condition.temp; + this.cardData.api = aqiRes.data.aqi.value; + this.cardData.pm25 = aqiRes.data.aqi.pm25; + } } ) } -- Gitblit v1.8.0