style:request判断的完成
Showing
2 changed files
with
14 additions
and
2 deletions
1 | /* | 1 | /* |
2 | * @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 | 2 | * @Description: 此文件主要创建 axios 实例,然后添加请求拦截器和响应拦截器 |
3 | * @Autor: renchao | 3 | * @Autor: renchao |
4 | * @LastEditTime: 2023-03-21 15:03:37 | 4 | * @LastEditTime: 2023-03-29 10:14:34 |
5 | */ | 5 | */ |
6 | import Vue from 'vue' | ||
6 | import axios from "axios"; | 7 | import axios from "axios"; |
7 | import { Message } from "element-ui"; | 8 | import { Message } from "element-ui"; |
8 | import { endLoadingSubCount } from "./requestLoading"; | 9 | import { endLoadingSubCount } from "./requestLoading"; |
... | @@ -68,6 +69,15 @@ function handleErrorData (status) { | ... | @@ -68,6 +69,15 @@ function handleErrorData (status) { |
68 | window.tokenValid = false; | 69 | window.tokenValid = false; |
69 | Message.error("由于长时间未操作,请重新登录!"); | 70 | Message.error("由于长时间未操作,请重新登录!"); |
70 | localStorage.removeItem("token"); | 71 | localStorage.removeItem("token"); |
72 | let code = Vue.prototype.BASE_API.CODE | ||
73 | if (code == 'BDCSBPT') { | ||
74 | router.replace({ | ||
75 | path: "/sb", | ||
76 | query: { | ||
77 | redirect: router.history.current.fullPath, | ||
78 | }, | ||
79 | }); | ||
80 | } else { | ||
71 | router.replace({ | 81 | router.replace({ |
72 | path: "/jg", | 82 | path: "/jg", |
73 | query: { | 83 | query: { |
... | @@ -75,6 +85,8 @@ function handleErrorData (status) { | ... | @@ -75,6 +85,8 @@ function handleErrorData (status) { |
75 | }, | 85 | }, |
76 | }); | 86 | }); |
77 | } | 87 | } |
88 | |||
89 | } | ||
78 | break; | 90 | break; |
79 | case 403: | 91 | case 403: |
80 | Message.error("拒绝访问"); | 92 | Message.error("拒绝访问"); | ... | ... |
-
Please register or sign in to post a comment