Newer
Older
import {Component, ViewChild} from '@angular/core';
import {Platform, AlertController, Content} from 'ionic-angular';
import {StatusBar} from '@ionic-native/status-bar';
import {SplashScreen} from '@ionic-native/splash-screen';
import {Storage} from "@ionic/storage";
import {LoginPage} from '../pages/login/login';
import {AppVersion} from '@ionic-native/app-version';
import {AppUpdateService} from "../service/appUpdate.service";
import {Keyboard} from '@ionic-native/keyboard';
import {Response} from "@angular/http";
import {TabsPage} from "../pages/tabs/tabs";
import {MobileAccessibility} from "@ionic-native/mobile-accessibility";
import {ScreenOrientation} from "@ionic-native/screen-orientation";
@Component({
templateUrl: 'app.html'
})
export class MyApp {
@ViewChild(Content) content: Content;
rootPage;
private alertCtrl: AlertController,
private keyboard: Keyboard,
private appUpdateService: AppUpdateService,
private appVersion: AppVersion,
this.splashScreen.hide();
this.statusBar.show();
this.statusBar.overlaysWebView(false);
this.statusBar.backgroundColorByHexString('#e12724');
this.statusBar.styleLightContent();
timer(4500).subscribe((res) => {
this.showSplash = false;
});
});
await this.appUpdateService.compariVersion().subscribe(res => {
const data = res.json();
data.latestVersion = data.latestVersion.trim();
if (data.code == 200) {
if (data.latestVersion != null && data.latestVersion != this.nowVersion) {
this.appUpdateService.detectionUpgrade(data.androidDownload, true, data.latestVersion); //提示升级
async loadLogin() {
await this.storage.get('userLoginInfo').then((value => {
async takeLogin() {
this.user.newestVersion = this.nowVersion;
await this.tabSer.loginpost(this.user).subscribe((res) => {
if (res.code == '200') {
this.storage.set('user', res.data);
this.user.userid = res.data.id;
this.storage.set('userLoginInfo', this.user);
this.rootPage = TabsPage;
} else {
this.appService.ObserverHttpPost("/wisdomgroup/modules/message/findAllActivityForAppWithXQ", null)
.subscribe((res: Response) => {
if (data.length > 0) {
data.forEach(e => {
if (e.isRead == 0) num++;