This commit is contained in:
@@ -27,7 +27,7 @@ namespace Dilon.Core
|
|||||||
/// 机构Id
|
/// 机构Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Comment("机构Id")]
|
[Comment("机构Id")]
|
||||||
[Column("SysUserId", TypeName = "varchar(36)")]
|
[Column("SysOrgId", TypeName = "varchar(36)")]
|
||||||
public string SysOrgId { get; set; }
|
public string SysOrgId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { token } from '@/common/token'
|
import { token } from '@/common/token'
|
||||||
import status from './status'
|
import status from './status'
|
||||||
|
const STATUS = status
|
||||||
import app from '@/main'
|
import app from '@/main'
|
||||||
|
|
||||||
axios.defaults.baseURL = '/api'
|
axios.defaults.baseURL = '/api'
|
||||||
@@ -28,7 +29,7 @@ const initInstance = (options) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
instance.interceptors.response.use((res) => {
|
instance.interceptors.response.use((res) => {
|
||||||
if (res.data.status === status.Unauthorized) {
|
if (res.data.status === STATUS.Unauthorized) {
|
||||||
handlerUnauthorized()
|
handlerUnauthorized()
|
||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
@@ -38,7 +39,7 @@ const initInstance = (options) => {
|
|||||||
return instance
|
return instance
|
||||||
}
|
}
|
||||||
|
|
||||||
const errerCodes = [status.BadRequest, status.InternalServerError, status.Forbidden]
|
const errerCodes = [STATUS.BadRequest, STATUS.InternalServerError, STATUS.Forbidden]
|
||||||
|
|
||||||
const errorNotification = ({ code, message }) => {
|
const errorNotification = ({ code, message }) => {
|
||||||
switch (message.constructor) {
|
switch (message.constructor) {
|
||||||
@@ -111,7 +112,7 @@ for (let key in urls) {
|
|||||||
if (errerCodes.indexOf(data.code) >= 0) {
|
if (errerCodes.indexOf(data.code) >= 0) {
|
||||||
errorNotification(data)
|
errorNotification(data)
|
||||||
reject([ArrayBuffer, Blob].indexOf(data.constructor) > -1 ? res : data)
|
reject([ArrayBuffer, Blob].indexOf(data.constructor) > -1 ? res : data)
|
||||||
} else if (data.code === status.Unauthorized) {
|
} else if (data.code === STATUS.Unauthorized) {
|
||||||
handlerUnauthorized()
|
handlerUnauthorized()
|
||||||
} else {
|
} else {
|
||||||
reslove([ArrayBuffer, Blob].indexOf(data.constructor) > -1 ? res : data)
|
reslove([ArrayBuffer, Blob].indexOf(data.constructor) > -1 ? res : data)
|
||||||
@@ -128,10 +129,10 @@ for (let key in urls) {
|
|||||||
} else {
|
} else {
|
||||||
errorNotification(data)
|
errorNotification(data)
|
||||||
}
|
}
|
||||||
reject(data)
|
if (data.code === STATUS.Unauthorized) {
|
||||||
if (data.code === status.Unauthorized) {
|
|
||||||
handlerUnauthorized()
|
handlerUnauthorized()
|
||||||
}
|
}
|
||||||
|
reject(data)
|
||||||
} else {
|
} else {
|
||||||
errorNotification({
|
errorNotification({
|
||||||
message: '系统发生错误,请联系管理员'
|
message: '系统发生错误,请联系管理员'
|
||||||
@@ -160,5 +161,5 @@ api.$queue = function (queue) {
|
|||||||
export {
|
export {
|
||||||
axios,
|
axios,
|
||||||
api,
|
api,
|
||||||
status
|
STATUS
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user