jinhui.wang

弹框修正

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