api.ts
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import request from "./../utils/request";
// Res是返回的参数,T是泛型,需要自己定义,返回对数统一管理***
type Res<T> = Promise<ItypeAPI<T>>;
// 一般情况下响应数据返回的这三个参数,
// 但不排除后端返回其它的可能性,
interface ItypeAPI<T> {
data: T,//请求的数据,用泛型
msg: string | null // 返回状态码的信息,如请求成功等
code: number //返回后端自定义的200,404,500这种状态码
}
// 获取产品列表
export const getProductList = (): Res<null> => request.get("/web/purchase/product/getList");
// 获取产品详情
export const getProductDetail = (params: {id: string}): Res<null> => request.get("/web/productInfoFinance/getFinanceInfo",{ params });
// 发送邮件
export const sendAuthLetterEmail = (params: {email: string}): Res<null> => request.get("/web/purchase/user/sendAuthLetterEmail",{ params });
// post请求,有参数,如传用户名和密码 实名认证
export const realNameAuth = (data: any): Res<string> => request.post("/web/purchase/user/realNameAuth", data);
// 获取审核状态
export const getAuthStatus = (): Res<null> => request.get("/web/purchase/user/getAuthStatus");
// 获取消息
export const getNotice = (params: {pageNum: 1}): Res<null> => request.get("/web/mesageList/getList",{ params });
// 我的授信列表
export const getMyCreditList = (): Res<null> => request.get("/web/purchase/credit/getMyCreditList" );
// 待还账单
export const getWaitStatementList = (): Res<null> => request.get("/web/purchase/statement/getWaitStatementList" );
// 历史账单
export const getHistoryStatementList = (): Res<null> => request.get("/web/purchase/statement/getHistoryStatementList" );