This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/src/utils/api.js

30 lines
795 B
JavaScript
Raw Normal View History

2021-06-11 23:00:33 +08:00
/**
* @author 陈劲松
* @date 2021/6/11
* @description 1.定义api2.定义通用查询函数函数名应为 获取详情getItem获取列表getItemList例如getUsergetUserList
*/
import { get } from '@/utils/http'
2021-06-15 09:25:10 +08:00
export const api = {
panel: '/visual/panel',
chart: '/visual/chart'
}
2021-06-11 23:00:33 +08:00
export async function getPanelList (params) {
2021-06-15 09:25:10 +08:00
return await getData(api.panel, params, true)
2021-06-11 23:00:33 +08:00
}
export async function getPanel (url, params) {
2021-06-15 09:25:10 +08:00
return await getData(api.panel, params)
2021-06-11 23:00:33 +08:00
}
export async function getData (url, params, isQueryList) {
const request = new Promise((resolve, reject) => {
get(url, params).then(response => {
if (response.code === 200) {
resolve(isQueryList ? response.data.list : response.data)
}
})
})
return await request
}