jinhui.wang

弹框修正

1 import axios from 'axios' 1 import axios from 'axios'
2 -import { Message } from 'element-ui' 2 +import { Message,MessageBox } from 'element-ui'
3 import store from '@/store' 3 import store from '@/store'
4 import { getToken } from '@/utils/auth' 4 import { getToken } from '@/utils/auth'
5 import errorCode from '@/utils/errorCode' 5 import errorCode from '@/utils/errorCode'
...@@ -11,8 +11,8 @@ const service = axios.create({ ...@@ -11,8 +11,8 @@ const service = axios.create({
11 //baseURL: process.env.VUE_APP_BASE_API, 11 //baseURL: process.env.VUE_APP_BASE_API,
12 //baseURL: 'http://192.168.1.45:8080', 12 //baseURL: 'http://192.168.1.45:8080',
13 // baseURL: `http://47.103.140.98:9002`, 13 // baseURL: `http://47.103.140.98:9002`,
14 - // baseURL: 'https://imacuat.zmd.apac.fedex.com/IMAC2', 14 + baseURL: 'https://imacuat.zmd.apac.fedex.com/IMAC2',
15 - baseURL: 'http://192.168.1.134:18080', 15 + // baseURL: 'http://192.168.1.134:18080',
16 16
17 // 超时 17 // 超时
18 timeout: 30000 18 timeout: 30000
...@@ -30,7 +30,7 @@ service.interceptors.request.use(config => { ...@@ -30,7 +30,7 @@ service.interceptors.request.use(config => {
30 for (const propName of Object.keys(config.params)) { 30 for (const propName of Object.keys(config.params)) {
31 const value = config.params[propName]; 31 const value = config.params[propName];
32 var part = encodeURIComponent(propName) + "="; 32 var part = encodeURIComponent(propName) + "=";
33 - if (value !== null && typeof(value) !== "undefined") { 33 + if (value !== null && typeof (value) !== "undefined") {
34 if (typeof value === 'object') { 34 if (typeof value === 'object') {
35 for (const key of Object.keys(value)) { 35 for (const key of Object.keys(value)) {
36 let params = propName + '[' + key + ']'; 36 let params = propName + '[' + key + ']';
...@@ -59,11 +59,12 @@ service.interceptors.response.use(res => { ...@@ -59,11 +59,12 @@ service.interceptors.response.use(res => {
59 // 获取错误信息 59 // 获取错误信息
60 const msg = errorCode[code] || res.data.msg || errorCode['default'] 60 const msg = errorCode[code] || res.data.msg || errorCode['default']
61 if (code === 301) { 61 if (code === 301) {
62 - this.$alert('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { 62 + MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
63 confirmButtonText: '重新登录', 63 confirmButtonText: '重新登录',
64 cancelButtonText: '取消', 64 cancelButtonText: '取消',
65 - type: 'warning', 65 + type: 'warning'
66 - }).then(() => { 66 + }
67 + ).then(() => {
67 store.dispatch('FedLogOut').then(() => { 68 store.dispatch('FedLogOut').then(() => {
68 location.href = '/index'; 69 location.href = '/index';
69 }) 70 })
......