Commit d5796a0b authored by van.chen's avatar van.chen

判断0和null

parent 6b5a25a0
<?xml version='1.0' encoding='utf-8'?>
<widget id="online.hubeidiyi" version="1.1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="online.hubeidiyi" version="1.1.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>牧场云</name>
<description>牧场物业管理系统</description>
<author email="van_chen@foxmail.com" href="http://hubeidiyi.online/">Van.chen</author>
......
......@@ -12,7 +12,7 @@
style="min-height: calc(100% - 45px)"
>
<div class="topPart">
<ListItem multipleLine *ngIf="this.yewei">
<ListItem multipleLine *ngIf="yewei || yewei === 0">
当前液位:
<div class="process">
<div [class]="'inlineProcess ' + color" [ngStyle]="{width: proc + '%'}">
......@@ -20,7 +20,7 @@
</div>
{{yewei.toFixed(2)}}m
</ListItem>
<ListItem multipleLine *ngIf="this.temp">
<ListItem multipleLine *ngIf="temp || temp === 0">
当前温度:
<div style="display: inline-block;margin-left: calc(100% - 145px);vertical-align: middle">
{{temp.toFixed(2)}}℃
......
......@@ -11,8 +11,8 @@ import {ActivatedRoute} from '@angular/router';
})
export class EastPage implements OnInit {
value = [];
yewei = 0;
temp = 0;
yewei;
temp;
proc = 0;
duration = 23;
nanClicked = false;
......@@ -140,14 +140,14 @@ export class EastPage implements OnInit {
}]);
this.api.app.getLiquidLevelData([{fieldRegionNo: this.fieldRegionNo}, (data) => {
if (data.liquidLevel) {
if (typeof (data.liquidLevel) === 'number') {
this.yewei = Number(data.liquidLevel);
this.proc = (Number(data.liquidLevel) / (Number(data.liquidLevelMax) * 1.5)) > 1
? 100 : (Number(data.liquidLevel) / (Number(data.liquidLevelMax) * 1.5)) * 100;
this.color = Number(data.liquidLevel) > Number(data.liquidLevelMax) ||
Number(data.liquidLevel) < Number(data.liquidLevelMin) ? 'red' : '';
}
if (data.temp) {
if (typeof (data.temp) === 'number') {
this.temp = Number(data.temp);
}
}]);
......
......@@ -12,7 +12,7 @@
style="min-height: calc(100% - 45px)"
>
<div class="topPart">
<ListItem multipleLine *ngIf="this.yewei">
<ListItem multipleLine *ngIf="yewei || yewei === 0">
当前液位:
<div class="process">
<div [class]="'inlineProcess ' + color" [ngStyle]="{width: proc + '%'}">
......@@ -20,7 +20,7 @@
</div>
{{yewei.toFixed(2)}}m
</ListItem>
<ListItem multipleLine *ngIf="this.temp">
<ListItem multipleLine *ngIf="temp || temp === 0">
当前温度:
<div style="display: inline-block;margin-left: calc(100% - 145px);vertical-align: middle">
{{temp.toFixed(2)}}℃
......
......@@ -12,8 +12,8 @@ import {ActivatedRoute} from '@angular/router';
export class OtherPage implements OnInit {
value = [false, false, false, false, false, false, false];
yewei = 0;
temp = 0;
proc = 0;
temp;
proc;
duration = 23;
_inv;
color;
......@@ -136,13 +136,13 @@ export class OtherPage implements OnInit {
}]);
this.api.app.getLiquidLevelData([{fieldRegionNo: this.fieldRegionNo}, (data) => {
if (data.liquidLevel) {
if (typeof (data.liquidLevel) === 'number') {
this.yewei = Number(data.liquidLevel);
this.proc = (Number(data.liquidLevel) / (Number(data.liquidLevelMax) * 1.5)) * 100;
this.color = Number(data.liquidLevel) > Number(data.liquidLevelMax) ||
Number(data.liquidLevel) < Number(data.liquidLevelMin) ? 'red' : '';
}
if (data.temp) {
if (typeof (data.temp) === 'number') {
this.temp = Number(data.temp);
}
}]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment