Pārlūkot izejas kodu

Merge branch 'develop' into lmm

seimin 2 gadi atpakaļ
vecāks
revīzija
a607acc87b
2 mainītis faili ar 15 papildinājumiem un 4 dzēšanām
  1. 8 1
      src/app/services/httpInterceptor.service.ts
  2. 7 3
      upload/development.js

+ 8 - 1
src/app/services/httpInterceptor.service.ts

@@ -7,9 +7,11 @@ import {
7 7
 } from "@angular/common/http";
8 8
 import { Observable } from "rxjs";
9 9
 import { tap } from "rxjs/operators";
10
+import { Router } from '@angular/router';
11
+import { NzMessageService } from 'ng-zorro-antd';
10 12
 // const ignoreToken = ['login', 'logout', 'table'];
11 13
 export class HttpInterceptorService implements HttpInterceptor {
12
-  constructor() {}
14
+  constructor(private router: Router, private message: NzMessageService) {}
13 15
   intercept(
14 16
     req: HttpRequest<any>,
15 17
     next: HttpHandler
@@ -32,6 +34,11 @@ export class HttpInterceptorService implements HttpInterceptor {
32 34
         (event) => {
33 35
           if (event instanceof HttpResponse) {
34 36
             // console.log(event);
37
+            if(event.body == 520){
38
+              this.message.info('登录失效,请重新登录!').onClose!.subscribe(() => {
39
+                this.router.navigate(['/login']);
40
+              })
41
+            }
35 42
           }
36 43
         },
37 44
         (error) => {

+ 7 - 3
upload/development.js

@@ -35,9 +35,13 @@ function connectSSh() {
35 35
 function runTask() {
36 36
   //打包完成
37 37
   if (shell.exec(`npm run build`).code == 0) {
38
-    console.log("-----打包成功-----");
39
-    //提交上传
40
-    connectSSh();
38
+    if (shell.exec(`find dist -name '*.js' -print0 | xargs -0 gzip -k`).code == 0) {
39
+      if (shell.exec(`find dist -name '*.css' -print0 | xargs -0 gzip -k`).code == 0) {
40
+        console.log("-----打包成功-----");
41
+        //提交上传
42
+        connectSSh();
43
+      }
44
+    }
41 45
   }
42 46
 }
43 47
 runTask()