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
2021-06-15 09:25:10 +08:00

30 lines
795 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* @author 陈劲松
* @date 2021/6/11
* @description 1.定义api2.定义通用查询函数,函数名应为 获取详情getItem、获取列表getItemList。例如getUser、getUserList
*/
import { get } from '@/utils/http'
export const api = {
panel: '/visual/panel',
chart: '/visual/chart'
}
export async function getPanelList (params) {
return await getData(api.panel, params, true)
}
export async function getPanel (url, params) {
return await getData(api.panel, params)
}
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
}