TASK:110956 添加天气状态空气质量传值时判断逻辑
This commit is contained in:
parent
f90b00640e
commit
8d01cd5309
|
@ -105,8 +105,7 @@ export class StarWeather extends LitElement {
|
|||
<span class="detail-today-item-top">空气质量</span>
|
||||
<span class="detail-today-item-bottom">
|
||||
${(this.dataBoo() &&
|
||||
this.data.weatherInfo[0]?.airQuality?.value +
|
||||
this.data.weatherInfo[0]?.airQuality?.type) ||
|
||||
this.fun(this.data.weatherInfo[0]?.airQuality?.value)) ||
|
||||
''}
|
||||
</span>
|
||||
</span>
|
||||
|
@ -175,7 +174,7 @@ export class StarWeather extends LitElement {
|
|||
</span>
|
||||
<span>
|
||||
空气质量${(this.dataBoo() &&
|
||||
this.data.weatherInfo[0]?.airQuality?.type) ||
|
||||
this.fun(this.data.weatherInfo[0]?.airQuality?.value)) ||
|
||||
''}
|
||||
</span>
|
||||
</span>
|
||||
|
@ -246,6 +245,25 @@ export class StarWeather extends LitElement {
|
|||
this.resize()
|
||||
})
|
||||
}
|
||||
fun(value: any) {
|
||||
let airQualityType = ''
|
||||
if (value > 0 && value <= 50) {
|
||||
airQualityType = '优'
|
||||
} else if (value <= 100) {
|
||||
airQualityType = '良'
|
||||
} else if (value <= 150) {
|
||||
airQualityType = '轻度污染'
|
||||
} else if (value <= 200) {
|
||||
airQualityType = '中度污染'
|
||||
} else if (value <= 300) {
|
||||
airQualityType = '重度污染'
|
||||
} else if (value > 300) {
|
||||
airQualityType = '严重污染'
|
||||
} else {
|
||||
airQualityType = 'null'
|
||||
}
|
||||
return airQualityType
|
||||
}
|
||||
protected resize() {
|
||||
let width = this.starWeather?.clientWidth || 10
|
||||
let height = this.starWeather?.clientHeight || 10
|
||||
|
|
|
@ -18,8 +18,7 @@ export const weatherData = {
|
|||
humidity: '40%',
|
||||
airQuality: {
|
||||
label: '空气质量',
|
||||
value: '26',
|
||||
type: '优',
|
||||
value: '400',
|
||||
},
|
||||
somatosensoryTemperature: '32°C',
|
||||
visibility: '33km',
|
||||
|
|
Loading…
Reference in New Issue