Commit 875260b8 authored by van.chen's avatar van.chen

加载

parent 12e033d7
......@@ -75,14 +75,12 @@ export class AlarmPage implements OnInit {
} else {
this.itemExit = false;
}
data.map((value, index) => {
const it = {
con: value.description,
time: value.alarmTime,
name: value.fieldRegionName,
};
this.data.push(it);
});
} else {
......
......@@ -26,9 +26,10 @@
.alarmItem {
width: 100%;
height: 60px;
color: #ff0000;
font-size: 12px;
height: auto;
position: relative;
}
.alarmItem.active {
......@@ -45,10 +46,12 @@
.alarmTime {
text-align: right;
padding-right: 10px;
color: #ff0000;
font-size: 12px;
padding-top: 5px;
position: absolute;
bottom: 0;
right: 10px;
}
@-webkit-keyframes slideIn {
......
......@@ -37,5 +37,4 @@ export class AlarmBarComponent implements OnInit {
}
}]);
}
}
......@@ -147,7 +147,7 @@ export class HomePage implements OnInit, OnDestroy {
case '出料池' :
ret = 'chuliao.jpg';
break;
case '沉池' :
case '沉池' :
ret = 'chensha.jpg';
break;
default:
......
......@@ -40,6 +40,6 @@ export class MinePage implements OnInit {
}
onLeftClick() {
this.tf.transfer({url: '/home'});
this.tf.transfer({url: '/index'});
}
}
......@@ -101,7 +101,8 @@ export class OtherPage implements OnInit {
const req = {
fieldRegionNo: this.fieldRegionNo,
op: a.v ? 0 : 1,
type: a.t
type: a.t,
ts: parseInt((new Date().getTime() / 1000).toString(), 10)
};
this.api.control.controlBatchSwitch([req, (data) => {
if (data.code === 1) {
......
......@@ -105,10 +105,10 @@ export class Api {
async presentMsgToast(msg, wz?, t?) {
const toast = await this.toast.create({
message: msg,
duration: t ? t : 2000,
duration: t ? t : 5000,
mode: 'ios',
cssClass: 'msgToast',
position: wz ? wz : 'bottom'
position: wz ? wz : 'top'
});
toast.present();
}
......@@ -118,7 +118,7 @@ export class Api {
message: msg,
showCloseButton: true,
position: position,
closeButtonText: btn,
closeButtonText: '取消',
mode: 'ios',
cssClass: 'btnToast'
});
......
import {Injectable} from '@angular/core';
import {LocalNotifications} from '@ionic-native/local-notifications/ngx';
import {Api} from './api';
import {environment} from '../../environments/environment';
declare var mqtt: any;
......@@ -34,7 +35,7 @@ export class Mqtt {
}
public initMqtt(name) {
this.client = mqtt.connect('ws://172.16.1.24:8083/mqtt', this.options);
this.client = mqtt.connect('ws://' + environment.mqttUrl + ':8083/mqtt', this.options);
this.topic = 'Pasture/' + name + '/Alarm';
this.client.on('connect', () => {
......@@ -53,7 +54,7 @@ export class Mqtt {
led: '#ff0000'
}]);
this.api.presentMsgToast(
this.api.formatTime('yyyy-MM-dd hh:mm:ss', new Date(obj.alarmTime)) + ' ' + obj.description, 'bottom', 5000
this.api.formatTime('yyyy-MM-dd hh:mm:ss', new Date(obj.alarmTime)) + ' ' + obj.description, 'top', 5000
);
});
});
......
......@@ -2,4 +2,5 @@ export const environment = {
production: true,
url: 'http://pasture.witium.com/api', // 对外访问测试网地址
// url: 'http://172.16.1.13:8096', // 测试
mqttUrl: '120.27.235.39'
};
......@@ -9,6 +9,7 @@ export const environment = {
// url: 'http://172.16.1.53:8097', // cy
url: 'http://172.16.1.52:8096', // zz
// url: 'http://172.16.1.13:8096', // 测试
mqttUrl: '172.16.1.24'
};
/*
......
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