国外MOSE官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.2 KiB

  1. import request from '@/utils/http/request';
  2. import type { ApiResponse } from '@/utils/http/types';
  3. // Banner 接口
  4. export interface BannerItem {
  5. id: string;
  6. title: string;
  7. image: string;
  8. orderNo: number;
  9. createBy?: string;
  10. createTime?: string;
  11. updateBy?: string;
  12. updateTime?: string;
  13. }
  14. // 核心价值主张接口
  15. export interface ValueItem {
  16. id: string;
  17. image: string;
  18. description: string;
  19. createBy?: string;
  20. createTime?: string;
  21. updateBy?: string;
  22. updateTime?: string;
  23. }
  24. // 投资方接口
  25. export interface InvestorItem {
  26. id: string;
  27. title: string;
  28. image: string;
  29. description: string;
  30. createBy?: string;
  31. createTime?: string;
  32. updateBy?: string;
  33. updateTime?: string;
  34. }
  35. // 媒体logo接口
  36. export interface MediaItem {
  37. id: string;
  38. title: string;
  39. image: string;
  40. description: string;
  41. createBy?: string;
  42. createTime?: string;
  43. updateBy?: string;
  44. updateTime?: string;
  45. }
  46. // 动态接口
  47. export interface PostItem {
  48. id: string;
  49. title: string;
  50. image: string;
  51. description: string;
  52. createBy?: string;
  53. createTime?: string;
  54. updateBy?: string;
  55. updateTime?: string;
  56. }
  57. // 分页参数
  58. export interface PageParams {
  59. pageNo?: number;
  60. pageSize?: number;
  61. }
  62. // 处理API响应
  63. function handleResponse<T>(response: any): T[] {
  64. if (!response) return [];
  65. // 检查响应结构
  66. if (response.result && response.result.records) {
  67. return response.result.records as T[];
  68. } else if (response.records) {
  69. return response.records as T[];
  70. } else if (Array.isArray(response.result)) {
  71. return response.result as T[];
  72. } else if (Array.isArray(response)) {
  73. return response as T[];
  74. }
  75. return [];
  76. }
  77. /**
  78. * banner图列表
  79. * @param params
  80. * @returns banner图列表
  81. */
  82. export function queryBannerList(params?: PageParams & Partial<BannerItem>) {
  83. return request.get<any>('/mose-admin/mose/index/queryBannerList', params)
  84. .then(response => handleResponse<BannerItem>(response));
  85. }
  86. /**
  87. *
  88. * @param params
  89. * @returns
  90. */
  91. export function queryValueList(params?: PageParams & Partial<ValueItem>) {
  92. return request.get<any>('/mose-admin/mose/index/queryValueList', params)
  93. .then(response => handleResponse<ValueItem>(response));
  94. }
  95. /**
  96. *
  97. * @param params
  98. * @returns
  99. */
  100. export function queryInvestorList(params?: PageParams & Partial<InvestorItem>) {
  101. return request.get<any>('/mose-admin/mose/index/queryInvestorList', params)
  102. .then(response => handleResponse<InvestorItem>(response));
  103. }
  104. /**
  105. * logo列表
  106. * @param params
  107. * @returns logo列表
  108. */
  109. export function queryMediaList(params?: PageParams & Partial<MediaItem>) {
  110. return request.get<any>('/mose-admin/mose/index/queryMediaList', params)
  111. .then(response => handleResponse<MediaItem>(response));
  112. }
  113. /**
  114. *
  115. * @param params
  116. * @returns
  117. */
  118. export function queryPostList(params?: PageParams & Partial<PostItem>) {
  119. return request.get<any>('/mose-admin/mose/index/queryPostList', params)
  120. .then(response => handleResponse<PostItem>(response));
  121. }