index.ts 731 B

12345678910111213141516171819202122232425
  1. import axios from 'axios';
  2. // 基础配置
  3. export 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 './users.ts';
  16. export * from './files.ts';
  17. export * from './theme.ts';
  18. export * from './charts.ts';
  19. export * from './messages.ts';
  20. export * from './sys.ts';
  21. export * from './know_info.ts';
  22. export * from './maps.ts';