Files
schisandra-cloud-storage-fr…/src/api/user/index.ts
2024-07-23 10:17:28 +08:00

198 lines
3.5 KiB
TypeScript

/** @format */
import web from "@/utils/axios/web.ts";
/**
* 第三方登录
* @param type
*/
export const oauthLogin = (type: string) => {
return web.request({
url: "/auth/oauth/render/" + type,
method: "get",
});
};
/**
* 获取短信验证码
* @param data
*/
export const getSms = (data: any) => {
return web.request({
url: "/auth/sms/sendByTemplate/",
method: "post",
headers: {
"Content-Type": "application/json;charset=UTF-8",
},
data: data,
});
};
/**
* 注册
* @param data
*/
export const register = (data: API.PhoneRegisterRequest) => {
return web.request({
url: "/auth/auth/user/register",
method: "post",
data: data,
});
};
/**
* 登录
* @param data
*/
export const login = (data: API.LoginRequest) => {
return web.request({
url: "/auth/auth/user/login",
method: "post",
data: data,
});
};
/**
* 手机号登录
* @param data
*/
export const loginByPhone = (data: API.LoginByPhoneRequest) => {
return web.request({
url: "/auth/auth/user/loginByPhone",
method: "post",
data: data,
});
};
/**
* 找回密码
* @param data
*/
export const findPassword = (data: API.findPasswordRequest) => {
return web.request({
url: "/auth/auth/user/findPassword",
method: "post",
data: data,
});
};
/**
* 生成客户端id
*/
export const createClientId = () => {
return web.request({
url: "/auth/auth/user/createClientId",
method: "get",
});
};
/**
* 获取客户端id
* @param clientId
*/
export const getClientId = (clientId: string) => {
return web.request({
url: "/auth/auth/user/getClientId",
method: "post",
data: {
clientId: clientId,
},
});
};
/**
* 获取客户端token
* @param clientId
*/
export const getClientToken = (clientId: string) => {
return web.request({
url: "/auth/auth/user/getClientToken",
method: "post",
params: {
clientId: clientId,
},
});
};
/**
* 生成微信登录二维码
* @param clientId
*/
export const generateQRCode = (clientId: string) => {
return web.request({
url: "/wechat/wx/generateQRCode",
method: "get",
params: {
clientId: clientId,
},
});
};
/**
* 获取用户菜单权限
* @param userId
*/
export const getUserMenuPermission = (userId: string): any => {
return web.request({
url: "/auth/auth/permission/selectUserPermission",
method: "get",
params: {
userId: userId,
},
});
};
/**
* 获取用户信息
* @param userId
*/
export const getUserInfoApi = (userId: string): any => {
return web.request({
url: "/auth/auth/user/getUserInfo",
method: "get",
params: {
userId: userId,
},
});
};
/**
* 更新用户信息
* @param data
*/
export const updateUserInfo = (data: any): any => {
return web.request({
url: "/auth/auth/user/update",
method: "get",
data: data,
});
};
/**
* 新增用户收藏
* @param data
*/
export const addFavorites = (data: any): any => {
return web.request({
url: "/share/share/user/favorites/add",
method: "post",
data: data,
});
};
/**
* 取消用户收藏
* @param data
*/
export const deleteFavorites = (data: any): any => {
return web.request({
url: "/share/share/user/favorites/delete",
method: "post",
data: data,
});
};
/**
* 退出登录
* @param userId
*/
export const logout = (userId: any): any => {
return web.request({
url: "/auth/auth/user/logout",
method: "post",
params: {
userId: userId,
},
});
};