Showing
2 changed files
with
8 additions
and
7 deletions
| 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' |
| ... | @@ -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,15 +59,16 @@ service.interceptors.response.use(res => { | ... | @@ -59,15 +59,16 @@ 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 | }) |
| 70 | - }); | 71 | + }) |
| 71 | } else if (code === 403) { | 72 | } else if (code === 403) { |
| 72 | //无权限页面 | 73 | //无权限页面 |
| 73 | location.href = '/401'; | 74 | location.href = '/401'; | ... | ... |
| ... | @@ -4,7 +4,7 @@ | ... | @@ -4,7 +4,7 @@ |
| 4 | ref="cargoForm" | 4 | ref="cargoForm" |
| 5 | size="small" | 5 | size="small" |
| 6 | :model="formData" | 6 | :model="formData" |
| 7 | - label-position="left" | 7 | + label-position="top" |
| 8 | label-width="auto" | 8 | label-width="auto" |
| 9 | style="margin: 10px; width: 100%" | 9 | style="margin: 10px; width: 100%" |
| 10 | > | 10 | > | ... | ... |
-
Please register or login to post a comment