2
0

index.ts 718 B

12345678910111213141516171819202122232425
  1. import axios from 'axios';
  2. // 基础配置
  3. const API_BASE_URL = '/api';
  4. // 全局axios配置
  5. axios.defaults.baseURL = API_BASE_URL;
  6. // 获取OSS完整URL
  7. export const getOssUrl = (path: string): string => {
  8. // 获取全局配置中的OSS_HOST,如果不存在使用默认值
  9. const ossHost = (window.CONFIG?.OSS_BASE_URL) || '';
  10. // 确保path不以/开头
  11. const ossPath = path.startsWith('/') ? path.substring(1) : path;
  12. return `${ossHost}/${ossPath}`;
  13. };
  14. export * from './auth.ts';
  15. export * from './user.ts';
  16. export * from './file.ts';
  17. export * from './theme.ts';
  18. export * from './chart.ts';
  19. export * from './home.ts';
  20. export * from './map.ts';
  21. export * from './system.ts';
  22. export * from './message.ts';