mirror of
https://gitee.com/dromara/go-view.git
synced 2026-04-23 00:00:12 +08:00
fix: 新增mock数据请求功能
This commit is contained in:
+2
-1
@@ -26,11 +26,12 @@ axiosInstance.interceptors.response.use(
|
||||
if (code === ResultEnum.DATA_SUCCESS) return Promise.resolve(res.data)
|
||||
// 重定向
|
||||
if (ErrorPageNameMap.get(code)) redirectErrorPage(code)
|
||||
return Promise.reject(res.data)
|
||||
return Promise.resolve(res.data)
|
||||
},
|
||||
(err: AxiosResponse) => {
|
||||
const { code } = err.data as { code: number }
|
||||
if (ErrorPageNameMap.get(code)) redirectErrorPage(code)
|
||||
window['$message'].error('接口异常,请检查!')
|
||||
Promise.reject(err)
|
||||
}
|
||||
)
|
||||
|
||||
+1
-2
@@ -1,11 +1,10 @@
|
||||
import axiosInstance from './axios'
|
||||
import { RequestHttpEnum, ContentTypeEnum } from '@/enums/httpEnum'
|
||||
|
||||
export const get = (url: string, params: object) => {
|
||||
export const get = (url: string) => {
|
||||
return axiosInstance({
|
||||
url: url,
|
||||
method: RequestHttpEnum.GET,
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
+13
-13
@@ -4,37 +4,37 @@ export default {
|
||||
status: 200,
|
||||
msg: "请求成功",
|
||||
data: {
|
||||
dimensions: ["product", "data1", "data2"],
|
||||
dimensions: ["product", "dataOne", "dataTwo"],
|
||||
source: [
|
||||
{
|
||||
'product': '@name',
|
||||
'data1|100-900': 3,
|
||||
'data2|100-900': 3,
|
||||
'dataOne|100-900': 3,
|
||||
'dataTwo|100-900': 3,
|
||||
},
|
||||
{
|
||||
'product': '@name',
|
||||
'data1|100-900': 3,
|
||||
'data2|100-900': 3,
|
||||
'dataOne|100-900': 3,
|
||||
'dataTwo|100-900': 3,
|
||||
},
|
||||
{
|
||||
'product': '@name',
|
||||
'data1|100-900': 3,
|
||||
'data2|100-900': 3,
|
||||
'dataOne1|100-900': 3,
|
||||
'dataTwo|100-900': 3,
|
||||
},
|
||||
{
|
||||
'product': '@name',
|
||||
'data1|100-900': 3,
|
||||
'data2|100-900': 3,
|
||||
'dataOne|100-900': 3,
|
||||
'dataTwo|100-900': 3,
|
||||
},
|
||||
{
|
||||
'product': '@name',
|
||||
'data1|100-900': 3,
|
||||
'data2|100-900': 3,
|
||||
'dataOne|100-900': 3,
|
||||
'dataTwo|100-900': 3,
|
||||
},
|
||||
{
|
||||
'product': '@name',
|
||||
'data1|100-900': 3,
|
||||
'data2|100-900': 3,
|
||||
'dataOne|100-900': 3,
|
||||
'dataTwo|100-900': 3,
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user