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

加载

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