Commit dda81506 authored by frank's avatar frank 🏀

增加了三级路由

修正了在线的点亮暗的bug
parent 00be34d3
This diff is collapsed.
......@@ -27,7 +27,7 @@
"@ionic-native/local-notifications": "^5.8.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.1.0",
"@ionic/angular": "^4.6.2",
"cordova-android": "7.1.4",
"cordova-ios": "~4.5.5",
"cordova-plugin-appminimize": "1.0.1",
......@@ -69,6 +69,7 @@
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.12.0",
"protractor": "~5.4.0",
"ts-node": "~8.0.0",
"tslint": "~5.12.0",
......
......@@ -26,8 +26,8 @@ const routes: Routes = [
]
},
{path: 'login', component: LoginPage},
{path: 'tabs', loadChildren: './envCtrl/tabs/tabs.module#TabsPageModule'},
// { path: 'env-detail', loadChildren: './envCtrl/env-detail/env-detail.module#EnvDetailPageModule' },
// {path: 'tabs', loadChildren: './envCtrl/tabs/tabs.module#TabsPageModule'},
// { path: 'env-detail', loadChildren: './envCtrl/env-detail/env-detail.module#EnvDetailPageModule' },
// { path: 'env-cfg', loadChildren: './envCtrl/env-cfg/env-cfg.module#EnvCfgPageModule' },
// { path: 'env-alarm', loadChildren: './envCtrl/env-alarm/env-alarm.module#EnvAlarmPageModule' },
// { path: 'env-home', loadChildren: './envCtrl/env-home/env-home.module#EnvHomePageModule' },
......
......@@ -6,11 +6,19 @@ import { Routes, RouterModule } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { EnvDetailPage } from './env-detail.page';
import {WtModule} from '../../components/wt/wt.module';
import {EnvHomePage} from '../env-home/env-home.page';
const routes: Routes = [
{
path: '',
component: EnvDetailPage
component: EnvDetailPage,
children: [
{
path: 'tab-2-fan',
component: EnvHomePage
},
]
}
];
......@@ -19,8 +27,10 @@ const routes: Routes = [
CommonModule,
FormsModule,
IonicModule,
WtModule, // for test
RouterModule.forChild(routes)
],
declarations: [EnvDetailPage]
declarations: [EnvDetailPage,
EnvHomePage,]
})
export class EnvDetailPageModule {}
......@@ -2,8 +2,39 @@
<ion-toolbar>
<ion-title>envDetail</ion-title>
</ion-toolbar>
<div>
<span style="font-size: 20px">{{item.online ? '在线' : '离线'}}</span>
<div class="right">{{item.time | date: 'yyyy-MM-dd HH:mm:ss'}}</div>
</div>
<v-kanban class="home-bar"></v-kanban>
<v-kanban class="home-bar"></v-kanban>
<v-kanban class="home-bar"></v-kanban>
<v-kanban class="home-bar"></v-kanban>
</ion-header>
<ion-content>
<ion-tabs>
<!-- Tab bar -->
<ion-tab-bar slot="top">
<ion-tab-button tab="tab-2-fan">
<ion-icon name="person"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="喷淋">
<ion-icon name="call"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="照明">
<ion-icon name="settings"></ion-icon>
</ion-tab-button>
<ion-tab-button tab="水槽">
<ion-icon name="settings"></ion-icon>
</ion-tab-button>
<!--<ion-tab-button tab="settings">-->
<!--<ion-icon name="settings"></ion-icon>-->
<!--</ion-tab-button>-->
<!--<ion-tab-button tab="settings">-->
<!--<ion-icon name="settings"></ion-icon>-->
<!--</ion-tab-button>-->
</ion-tab-bar>
</ion-tabs>
<ion-router-outlet></ion-router-outlet>
</ion-content>
.right {
float: right;
color: #ffd31a;
}
.home-bar{
display: inline-block;
margin-right: 3px;
width: 23%;
}
\ No newline at end of file
......@@ -9,6 +9,17 @@ export class EnvDetailPage implements OnInit {
constructor() { }
item = {
name : '1号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44',
online : true,
ctrl: 0,
alarm: true,
};
ngOnInit() {
}
......
......@@ -2,6 +2,14 @@
<div class="topIcon" (click)="toIndex()">
<i class="vo v-back"></i>
</div>
<ion-slides style="width: 100%;height: 125px;" mode="ios"
[options]="lunbo" #slide (ionSlideTouchEnd)="slideDidChange()">
<ion-slide class="slideCon" *ngFor="let one of imgs">
<div class="inBox">
<img [src]="'../../../assets/lunbo/' + one">
</div>
</ion-slide>
</ion-slides>
</ion-header>
<ion-content color='light'>
......@@ -23,4 +31,32 @@
border-left: 5px solid #28c9bd;
line-height: 25px;
margin-bottom: 5px;">牛舍列表</h1>
<ion-list mode="md" class="listview" insert = "false" line="none" style="width:96%;margin-left: 2%">
<ion-item *ngFor="let item of items" (click)="toControl(item)" class="ion-item" style="width: 100%; --padding-start: 0px">
<div class="item">
<div class="top">{{item.name}}
<!--<div class="right">{{item.time | date: 'yyyy-MM-dd HH:mm:ss'}}</div>-->
<ion-icon class="right" name="ios-heart"></ion-icon>
</div>
<div class="content">
<!--<div class="left">-->
<!--<img [src]="'../../assets/img/' + item.img">-->
<!--</div>-->
<!--<div class="rightCon">-->
<span style="font-size: 20px">{{item.online ? '在线' : '离线'}}</span>
<!--<div class="block1" *ngIf="item.yewei || item.yewei === 0">池体液位: &nbsp;&nbsp;{{item.yewei}} m</div>-->
<!--<div class="block2" *ngIf="item.temp || item.temp === 0">液体温度: &nbsp;&nbsp;{{item.temp}} ℃</div>-->
<!--<div class="block2">运行状态: &nbsp;&nbsp;{{item.state ? '工作中' : '未运行'}} </div>-->
<div class="right">{{item.time | date: 'yyyy-MM-dd HH:mm:ss'}}</div>
<!--</div>-->
</div>
<div class="bottom">
<!--<div [ngClass]="{'sucCir': item.state, 'errCir': !item.state}"></div>&nbsp;-->
<!--<span style="font-size: 13px">{{item.online ? '在线' : '离线'}}</span>-->
<span class="block2" *ngIf="item.temp || item.temp === 0">温度: &nbsp;&nbsp;{{item.temp}} ℃</span>
<span class="block1" *ngIf="item.humi || item.humi === 0">湿度: &nbsp;&nbsp;{{item.humi}} %</span>
</div>
</div>
</ion-item>
</ion-list>
</ion-content>
......@@ -3,3 +3,45 @@
margin-right: 3px;
width: 32%;
}
.item {
margin-bottom: 10px;
padding: 0px 3px 0px;
background-color: #ffffff;
display:block;
width: calc(100%);
}
.top {
line-height: 20px;
//border-bottom: 1px solid #cccc;
padding-bottom: 5px;
font-size: 15px;
display: block;
width: 100%;
}
.rightCon {
width: calc(50%);
line-height: 25px;
vertical-align: top;
display: inline-block;
padding-left: 20px;
padding-top: 5px;
font-size: 12px;
}
.right {
float: right;
color: #ffd31a;
}
.bottom {
//border-top: 1px solid #ccc;
padding: 3px;
color: #aaa;
margin-top: 10px;
}
.content{
margin-top: 10px;
}
\ No newline at end of file
import { Component, OnInit } from '@angular/core';
import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute} from '@angular/router';
import {Transfer} from '../../service/transfer';
import {Api} from '../../service/api';
......@@ -16,10 +16,127 @@ export class EnvHomePage implements OnInit {
private api: Api, private load: Load, public nav: NavController) { }
ifFocus = false;
lunbo = {
speed: 1000,
allowTouchMove: true,
effect: 'flip',
autoplay: {
delay: 2000,
},
loop: true,
spaceBetween: 0,
zoom: false
};
items = [
{
name : '1号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44',
online : true,
ctrl: 0,
alarm: true,
},
{
name : '2号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44',
online : true,
ctrl: 0,
alarm: true,
},
{
name : '2号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44',
online : true,
ctrl: 0,
alarm: true,
},
{
name : '2号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44',
online : true,
ctrl: 0,
alarm: true,
},
{
name : '2号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44',
online : true,
ctrl: 0,
alarm: true,
},
{
name : '2号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44',
online : true,
ctrl: 0,
alarm: true,
},
{
name : '2号牛舍',
temp : '23.5',
humi : '82',
thi: '轻',
time : '2019-08-05 23:44',
online : true,
ctrl: 0,
alarm: true,
},
];
imgs = ['1.jpg', '2.jpg', '3.jpg'];
itam = {
name : '',
temp : '',
humi : '',
thi: '',
time : '',
online : false,
ctrl: 0,
alarm: true,
};
dummyData = {
name : '1好',
temp : '',
humi : '',
thi: '',
time : '',
online : false,
ctrl: 0,
alarm: true,
};
@ViewChild('slide') slide;
ngOnInit() {
this.ionViewWillEnter();
}
// ionic的生命周期函数
ionViewWillEnter() {
this.slideDidChange();
//this.getData(0);
}
toIndex() {
if (this.ifFocus) {
this.ifFocus = false;
......@@ -28,4 +145,17 @@ export class EnvHomePage implements OnInit {
}
}
toControl(p){
}
getData()
{
}
slideDidChange() {
this.slide.startAutoplay();
}
}
......@@ -26,7 +26,10 @@ const routes: Routes = [
},
{
path: 'tab-detail',
component: EnvDetailPage
component: EnvDetailPage,
// loadChildren:[{
// path:'./envCtrl/env-detail/env-detail.module#EnvDetailPageModule',
// }]
},
{
path: 'tab-anal',
......
<ion-tabs>
<!--<ion-tab tab="home">Home Content</ion-tab>-->
<!--<ion-tab tab="settings">Settings Content</ion-tab>-->
<ion-tab-bar slot="bottom">
<ion-tab-button tab="tab-home">
......
......@@ -61,7 +61,7 @@
</div>
</div>
<div class="bottom">
<div [ngClass]="{'sucCir': item.state, 'errCir': !item.state}"></div>&nbsp;
<div [ngClass]="{'sucCir': item.online, 'errCir': !item.online}"></div>&nbsp;
<span style="font-size: 13px">{{item.online ? '在线' : '离线'}}</span>
</div>
</div>
......
......@@ -12,8 +12,8 @@
<div class="mainContent">
<div class="contentPart">
<div class="leftOnPart" (click)="goTo('home')"></div>
<!--<div class="rightOnPart " (click)="goTo('row')"></div>-->
<div class="rightOnPart " (click)="goTo('tabs/tab-home')"></div>
<div class="rightOnPart " (click)="goTo('row')"></div>
<!--<div class="rightOnPart " (click)="goTo('tabs/tab-home')"></div>-->
<div class="leftUnderPart" (click)="goTo('alarm')"></div>
<div class="rightUnderPart" (click)="goTo('mine')"></div>
</div>
......
......@@ -34,7 +34,7 @@
<div Button class="button" (click)="loginOut()" [type]="'primary'" style="letter-spacing: 2px">退出登录</div>
</div>
<div style="position: fixed;bottom: 20px;display: inline-block;width: 100%;text-align: center;color: #666666;font-size: 14px;">
版本信息: v2.6.1
版本信息: v2.7.1
</div>
</div>
......
......@@ -4,7 +4,7 @@
export const environment = {
// production: false,
url: 'http://pasture.witium.com.cn/api', // 对外访问测试网地址
// url: 'http://pasture.witium.com.cn/api', // 对外访问测试网地址
// url: 'http://cloud-test.witium.com:8096', // 测试
// url: 'http://172.16.1.53:8097', // cy
// url: 'http://172.16.1.52:8096', // zz
......@@ -12,7 +12,7 @@ export const environment = {
// mqttUrl: '172.16.1.24',
// mqttUrl: '120.27.235.39'
production: true,
// url: 'http://pasture.witium.com/api', // 对外访问测试网地址
url: 'http://pasture.witium.com/api', // 对外访问测试网地址
// url: 'http://172.16.1.13:8096', // 测试
mqttUrl: '120.27.235.39'
};
......
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