65 lines
1.5 KiB
TypeScript
65 lines
1.5 KiB
TypeScript
import { httpRequest } from "../../utils/request";
|
|
const baseUrl = require("../base").allBaseUrl.GDEnvs.host;
|
|
|
|
// 获取图形验证码
|
|
export const apiGetCaptchaImage = () => {
|
|
return httpRequest.post<{
|
|
data: {
|
|
uuid: string;
|
|
img: string;
|
|
};
|
|
}>(`${baseUrl}/lt-web/xs/xcx/common/captchaImage`, {});
|
|
};
|
|
|
|
// 获取短信验证码
|
|
export const apiSendSms = (data: {
|
|
userName: string;
|
|
imageCode: string;
|
|
uuid: string;
|
|
}) => {
|
|
return httpRequest.post<{
|
|
code: string;
|
|
msg: string;
|
|
}>(`${baseUrl}/lt-web/xs/xcx/common/sendSms`, data);
|
|
};
|
|
|
|
// 获取微信唯一编码
|
|
export const apiGetWxUserCode = (data: { code: string }) => {
|
|
return httpRequest.post<{
|
|
code: string;
|
|
msg: string;
|
|
data: {
|
|
buyer: { buyerId: number; flag: number; token: string };
|
|
};
|
|
}>(`${baseUrl}/api-interface/app/user/login`, data);
|
|
};
|
|
|
|
// 登录
|
|
type ManualLoginType = {
|
|
loginType: number;
|
|
userName: string;
|
|
smsCode: string;
|
|
openId: string;
|
|
};
|
|
type LoginTypeData = { loginType: number; openId: string; code: string };
|
|
export const apiLogin = <T extends LoginTypeData | ManualLoginType>(
|
|
data: T
|
|
) => {
|
|
return httpRequest.post<{
|
|
code: string;
|
|
msg: string;
|
|
data: {
|
|
userId: string;
|
|
uniqueCode: string;
|
|
userName: string;
|
|
phone: string;
|
|
authorizeToken: string;
|
|
};
|
|
}>(`${baseUrl}/lt-web/xs/xcx/common/login`, data);
|
|
};
|
|
|
|
// 退出登录
|
|
export const apiLogout = () => {
|
|
return httpRequest.post(`${baseUrl}/lt-web/xs/xcx/common/logout`, {});
|
|
};
|