import request from '@/utils/http/request';
|
|
import type { ApiResponse } from '@/utils/http/types';
|
|
|
|
// Banner 接口
|
|
export interface BannerItem {
|
|
id: string;
|
|
title: string;
|
|
image: string;
|
|
orderNo: number;
|
|
createBy?: string;
|
|
createTime?: string;
|
|
updateBy?: string;
|
|
updateTime?: string;
|
|
}
|
|
|
|
// 核心价值主张接口
|
|
export interface ValueItem {
|
|
id: string;
|
|
image: string;
|
|
description: string;
|
|
createBy?: string;
|
|
createTime?: string;
|
|
updateBy?: string;
|
|
updateTime?: string;
|
|
}
|
|
|
|
// 投资方接口
|
|
export interface InvestorItem {
|
|
id: string;
|
|
title: string;
|
|
image: string;
|
|
description: string;
|
|
createBy?: string;
|
|
createTime?: string;
|
|
updateBy?: string;
|
|
updateTime?: string;
|
|
}
|
|
|
|
// 媒体logo接口
|
|
export interface MediaItem {
|
|
id: string;
|
|
title: string;
|
|
image: string;
|
|
description: string;
|
|
createBy?: string;
|
|
createTime?: string;
|
|
updateBy?: string;
|
|
updateTime?: string;
|
|
}
|
|
|
|
// 动态接口
|
|
export interface PostItem {
|
|
id: string;
|
|
title: string;
|
|
image: string;
|
|
description: string;
|
|
createBy?: string;
|
|
createTime?: string;
|
|
updateBy?: string;
|
|
updateTime?: string;
|
|
}
|
|
|
|
// 分页参数
|
|
export interface PageParams {
|
|
pageNo?: number;
|
|
pageSize?: number;
|
|
}
|
|
|
|
// 处理API响应
|
|
function handleResponse<T>(response: any): T[] {
|
|
if (!response) return [];
|
|
|
|
// 检查响应结构
|
|
if (response.result && response.result.records) {
|
|
return response.result.records as T[];
|
|
} else if (response.records) {
|
|
return response.records as T[];
|
|
} else if (Array.isArray(response.result)) {
|
|
return response.result as T[];
|
|
} else if (Array.isArray(response)) {
|
|
return response as T[];
|
|
}
|
|
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* 获取banner图列表
|
|
* @param params 查询参数
|
|
* @returns banner图列表
|
|
*/
|
|
export function queryBannerList(params?: PageParams & Partial<BannerItem>) {
|
|
return request.get<any>('/mose-admin/mose/index/queryBannerList', params)
|
|
.then(response => handleResponse<BannerItem>(response));
|
|
}
|
|
|
|
/**
|
|
* 获取核心价值主张列表
|
|
* @param params 查询参数
|
|
* @returns 核心价值主张列表
|
|
*/
|
|
export function queryValueList(params?: PageParams & Partial<ValueItem>) {
|
|
return request.get<any>('/mose-admin/mose/index/queryValueList', params)
|
|
.then(response => handleResponse<ValueItem>(response));
|
|
}
|
|
|
|
/**
|
|
* 获取投资方列表
|
|
* @param params 查询参数
|
|
* @returns 投资方列表
|
|
*/
|
|
export function queryInvestorList(params?: PageParams & Partial<InvestorItem>) {
|
|
return request.get<any>('/mose-admin/mose/index/queryInvestorList', params)
|
|
.then(response => handleResponse<InvestorItem>(response));
|
|
}
|
|
|
|
/**
|
|
* 获取媒体logo列表
|
|
* @param params 查询参数
|
|
* @returns 媒体logo列表
|
|
*/
|
|
export function queryMediaList(params?: PageParams & Partial<MediaItem>) {
|
|
return request.get<any>('/mose-admin/mose/index/queryMediaList', params)
|
|
.then(response => handleResponse<MediaItem>(response));
|
|
}
|
|
|
|
/**
|
|
* 获取动态列表
|
|
* @param params 查询参数
|
|
* @returns 动态列表
|
|
*/
|
|
export function queryPostList(params?: PageParams & Partial<PostItem>) {
|
|
return request.get<any>('/mose-admin/mose/index/queryPostList', params)
|
|
.then(response => handleResponse<PostItem>(response));
|
|
}
|