jinhui.wang

bug修正

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'
......@@ -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,15 +59,16 @@ 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';
})
});
})
} else if (code === 403) {
//无权限页面
location.href = '/401';
......
......@@ -4,7 +4,7 @@
ref="cargoForm"
size="small"
:model="formData"
label-position="left"
label-position="top"
label-width="auto"
style="margin: 10px; width: 100%"
>
......