Commit 4b3769e5 authored by van.chen's avatar van.chen

load改版

parent cd44eb77
<div id="v-loading"> <div id="v-loading" *ngIf="load.isLoad">
<div class="loading-inner"> <div class="loading-inner">
<div class="circle_process"> <div class="circle_process" *ngIf="load.showNum">
<div id="innerNum"></div> <div id="innerNum">{{load.time}}s</div>
<div class="wrapper right"> <div class="wrapper right">
<div class="circle rightcircle"></div> <div class="circle rightcircle"></div>
</div> </div>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<div class="circle leftcircle" id="leftcircle"></div> <div class="circle leftcircle" id="leftcircle"></div>
</div> </div>
</div> </div>
<div id="loading-inner"></div> <div id="loading-inner">{{load.msg}}</div>
</div> </div>
</div> </div>
<ion-app> <ion-app>
......
...@@ -6,18 +6,19 @@ import {StatusBar} from '@ionic-native/status-bar/ngx'; ...@@ -6,18 +6,19 @@ import {StatusBar} from '@ionic-native/status-bar/ngx';
import {Router, NavigationEnd} from '@angular/router'; import {Router, NavigationEnd} from '@angular/router';
import {AppMinimize} from '@ionic-native/app-minimize/ngx'; import {AppMinimize} from '@ionic-native/app-minimize/ngx';
import {Mqtt} from './service/mqtt'; import {Mqtt} from './service/mqtt';
import {Load} from './service/load';
declare var screen: any; declare var screen: any;
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: 'app.component.html', templateUrl: 'app.component.html',
providers: [Load],
styles: [` styles: [`
.circle_process { .circle_process {
width: 100px; width: 100px;
height: 100px; height: 100px;
margin: 0 auto; margin: 0 auto;
display: none;
} }
.circle_process .wrapper { .circle_process .wrapper {
...@@ -100,7 +101,8 @@ export class AppComponent implements AfterViewInit, OnDestroy { ...@@ -100,7 +101,8 @@ export class AppComponent implements AfterViewInit, OnDestroy {
private statusBar: StatusBar, private statusBar: StatusBar,
private appMinimize: AppMinimize, private appMinimize: AppMinimize,
private router: Router, private router: Router,
private mqtt: Mqtt private mqtt: Mqtt,
public load: Load
) { ) {
this.initializeApp(); this.initializeApp();
} }
......
...@@ -5,19 +5,18 @@ export class Load { ...@@ -5,19 +5,18 @@ export class Load {
constructor() { constructor() {
} }
private isLoad = false; public isLoad = false;
private time = 0; public showNum = false;
public msg = '';
public time = 0;
toLoad(msg, type) { toLoad(msg, type) {
if (!this.isLoad) { if (!this.isLoad) {
this.isLoad = true; this.isLoad = true;
document.getElementById('v-loading').style.display = 'block'; this.msg = msg;
document.getElementById('loading-inner').innerText = msg;
if (type) { if (type) {
this.showNum = true;
this.time = 0; this.time = 0;
// @ts-ignore
document.getElementsByClassName('circle_process')[0].style.display = 'block';
document.getElementById('innerNum').innerText = this.time.toString() + 's';
this.addNum(); this.addNum();
} }
} }
...@@ -26,8 +25,7 @@ export class Load { ...@@ -26,8 +25,7 @@ export class Load {
addNum() { addNum() {
setTimeout(() => { setTimeout(() => {
if (this.isLoad) { if (this.isLoad) {
this.time ++; this.time++;
document.getElementById('innerNum').innerText = this.time.toString() + 's';
this.addNum(); this.addNum();
} }
}, 1000); }, 1000);
...@@ -35,8 +33,8 @@ export class Load { ...@@ -35,8 +33,8 @@ export class Load {
offLoad() { offLoad() {
this.isLoad = false; this.isLoad = false;
document.getElementById('v-loading').style.display = 'none'; this.showNum = false;
document.getElementById('loading-inner').innerText = ''; this.msg = '';
document.getElementById('innerNum').innerText = '0s'; this.time = 0;
} }
} }
...@@ -107,7 +107,6 @@ img { ...@@ -107,7 +107,6 @@ img {
z-index: 9999999999999; z-index: 9999999999999;
position: relative; position: relative;
text-align: center; text-align: center;
display: none;
.loading-inner { .loading-inner {
min-height: 30px; min-height: 30px;
min-width: 150px; min-width: 150px;
...@@ -122,6 +121,9 @@ img { ...@@ -122,6 +121,9 @@ img {
line-height: 30px; line-height: 30px;
text-align: center; text-align: center;
} }
#loading-inner {
font-size: 16px;
}
} }
.msgToast { .msgToast {
......
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