Files
xian_vue_new/src/api/api.ts
T

56 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-04-11 10:09:40 +08:00
import type { DisasterType } from '@/types/common/DisasterType'
2026-04-07 20:01:06 +08:00
import { getSm2PublicKey } from './crypto'
2026-04-11 18:58:43 +08:00
import { getBasePoins as getHiddenDangerBasePoints, getPointDetailById as getHiddenDangerPointDetailById} from './hidden-danger-spots'
import { getBasePoins as getRiskBasePoints, getPointDetailById as getRiskPointDetailById} from './risk-spots'
2026-04-11 10:09:40 +08:00
import type { ApiResponse } from '@/types/ApiResponse'
import type { XianHiddenDangerSpots } from '@/types/base/XianHiddenDangerSpots'
2026-04-11 18:58:43 +08:00
import type { XianRiskSpots } from '@/types/base/XianRiskSpots'
2026-04-07 20:01:06 +08:00
/**
* API接口统一导出对象
*/
2026-04-07 20:01:06 +08:00
export const $api = {
// 加密模块
crypto: {
/**
* 获取SM2公钥
* @returns SM2公钥响应
*/
2026-04-07 20:01:06 +08:00
getSm2PublicKey: () => getSm2PublicKey(),
},
2026-04-11 10:09:40 +08:00
// 隐患点信息
hiddenDangerSpots: {
/**
* 获取所有基础隐患点
* @param disasterType - 灾害类型
* @returns 隐患点数据数组
*/
2026-04-11 18:58:43 +08:00
getBasePoins: (disasterType: DisasterType): Promise<ApiResponse<XianHiddenDangerSpots[]>> => getHiddenDangerBasePoints(disasterType),
2026-04-11 10:09:40 +08:00
/**
* 根据id获取隐患点详情
* @param id - 隐患点id
* @returns 隐患点详情
*/
2026-04-11 18:58:43 +08:00
getPointDetailById: (id: number): Promise<ApiResponse<XianHiddenDangerSpots>> => getHiddenDangerPointDetailById(id),
},
// 风险点信息
riskSpots: {
/**
* 获取所有基础风险点
* @returns 风险点数据数组
*/
2026-04-11 18:58:43 +08:00
getBasePoins: (): Promise<ApiResponse<XianRiskSpots[]>> => getRiskBasePoints(),
/**
* 根据id获取风险点详情
* @param id - 风险点id
* @returns 风险点详情
*/
2026-04-11 18:58:43 +08:00
getPointDetailById: (id: number): Promise<ApiResponse<XianRiskSpots>> => getRiskPointDetailById(id),
2026-04-11 10:09:40 +08:00
},
2026-04-07 20:01:06 +08:00
}