hookehuyr

fix

1 /* 1 /*
2 * @Date: 2023-10-27 11:12:24 2 * @Date: 2023-10-27 11:12:24
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-11-21 15:23:46 4 + * @LastEditTime: 2023-11-30 18:12:27
5 * @FilePath: /vue-flow-editor/doc/axios.js 5 * @FilePath: /vue-flow-editor/doc/axios.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 import axios from 'axios'; 8 import axios from 'axios';
9 +import { ElMessageBox } from 'element-plus'
9 10
10 axios.defaults.params = { 11 axios.defaults.params = {
11 m: 'mod', 12 m: 'mod',
...@@ -38,6 +39,19 @@ axios.interceptors.request.use( ...@@ -38,6 +39,19 @@ axios.interceptors.request.use(
38 */ 39 */
39 axios.interceptors.response.use( 40 axios.interceptors.response.use(
40 response => { 41 response => {
42 + // 默认显示错误提示
43 + response.data.show = true;
44 + if (response.data.msg === '登录失效') {
45 + ElMessageBox.alert('登录失效!将跳转到登录页面。', '温馨提示', {
46 + confirmButtonText: '确定',
47 + callback: action => {
48 + // session 失效需要重新登录
49 + if (action === 'confirm') {
50 + window.parent.location.href = location.origin + '/admin/' + window.parent.location.search;
51 + }
52 + }
53 + });
54 + }
41 return response; 55 return response;
42 }, 56 },
43 error => { 57 error => {
......