Commit 880f7bdf authored by van.chen's avatar van.chen

改了页面退出重进home页不会刷新的问题

parent a7fc8453
<div class="loginPage" @fade> <div class="loginPage" @fade>
<div class="topBar"> <div class="topBar">
<img class="imgPart" src="../../../assets/icon/favicon.png"> <img class="imgPart" src="../../../assets/icon/favicon.png">
<div class="title"> 上海辉度智能科技有限公司</div> <div class="title">上海辉度智能科技有限公司</div>
</div> </div>
<div class="mainBar"> <div class="mainBar">
<div class="inputLine"> <div class="inputLine">
......
...@@ -10,7 +10,6 @@ import {ApiService} from '../../service/api.service'; ...@@ -10,7 +10,6 @@ import {ApiService} from '../../service/api.service';
animations: [fadeIn] animations: [fadeIn]
}) })
export class LoginComponent implements OnInit { export class LoginComponent implements OnInit {
req = {name: '', ps: ''}; req = {name: '', ps: ''};
constructor(private tf: TransferService, private api: ApiService) { constructor(private tf: TransferService, private api: ApiService) {
} }
...@@ -26,11 +25,12 @@ export class LoginComponent implements OnInit { ...@@ -26,11 +25,12 @@ export class LoginComponent implements OnInit {
this.api.login.dologin([req, (data) => { this.api.login.dologin([req, (data) => {
if (data.code === 1) { if (data.code === 1) {
window.localStorage.setItem('token', data.message); window.localStorage.setItem('token', data.message);
const query = {refresh: new Date().getTime()};
this.tf.transfer({ this.tf.transfer({
from: 'app-extra', from: 'app-extra',
to: 'app-home', to: 'app-home',
url: '/main', url: '/main',
query: '', query: query,
hash: '' hash: ''
}); });
} else { } else {
......
<ion-slides @fade id="slideComponent" style="width: 100%;height: 100%;" <ion-slides @fade id="slideComponent" style="width: 100%;height: 100%;"
mode="ios" [options]="options" [@toLeft]="toLeft" [@toRight]="toRight" (ionSlideDidChange)="slideOnChange()"> mode="ios" [options]="options" [@toLeft]="toLeft" [@toRight]="toRight" (ionSlideDidChange)="slideOnChange()">
<ion-slide> <ion-slide>
<div class="box"><app-page-one></app-page-one></div> <div class="box"><app-page-one #page_one></app-page-one></div>
</ion-slide> </ion-slide>
<ion-slide> <ion-slide>
<div class="box"><app-page-two></app-page-two></div> <div class="box"><app-page-two #page_two></app-page-two></div>
</ion-slide> </ion-slide>
<ion-slide> <ion-slide>
<div class="box"><app-page-three></app-page-three></div> <div class="box"><app-page-three #page_three></app-page-three></div>
</ion-slide> </ion-slide>
<ion-slide> <ion-slide>
<div class="box"><app-page-four></app-page-four></div> <div class="box"><app-page-four #page_four></app-page-four></div>
</ion-slide> </ion-slide>
</ion-slides> </ion-slides>
<div class="bottomPart"> <div class="bottomPart">
......
...@@ -4,7 +4,7 @@ import 'web-animations-js/web-animations.min'; ...@@ -4,7 +4,7 @@ import 'web-animations-js/web-animations.min';
import { toLeft } from '../animations/toLeftAndBack'; import { toLeft } from '../animations/toLeftAndBack';
import { toRight } from '../animations/toRightAndBack'; import { toRight } from '../animations/toRightAndBack';
import { fadeIn } from '../animations/fade-in'; import { fadeIn } from '../animations/fade-in';
import { Router } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
......
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