45 lines
1.8 KiB
TypeScript
45 lines
1.8 KiB
TypeScript
/**
|
|
* 用户信息相关接口
|
|
*/
|
|
import type { LoginParams, LoginResult, RegisterParams } from './types';
|
|
import { get, post } from '@/utils/request';
|
|
import type { UserState } from '@/store/modules/user/types';
|
|
|
|
enum URL {
|
|
// login = '/member/login',
|
|
login = '/wc/wechat/LoginByMa',
|
|
loginByCode = '/wc/wechat/LoginByMaCode',
|
|
register = '/wc/wechat/register',
|
|
uploadAvatar = '/wc/wechat/uploadImage',
|
|
logout = '/user/logout',
|
|
profile = '/user/profile',
|
|
addressList = '/ext/addr/list',
|
|
addressDetail = '/ext/addr/find',
|
|
addressCreate = '/ext/addr/create',
|
|
addressUpdate = '/ext/addr/update',
|
|
addressDelete = '/ext/addr/delete',
|
|
dynamicCode = '/member/dynccode',
|
|
rechargeList = '/ext/recharge/rule_config'
|
|
}
|
|
|
|
export const getUserProfile = () => get<UserState>({ url: URL.profile });
|
|
export const login = (data: LoginParams) => post<LoginResult>({ url: URL.login, data });
|
|
export const loginByCode = (code: string, companyId: string) => post<any>({ url: URL.loginByCode + `?code=${code}` });
|
|
|
|
export const register = (data: RegisterParams) => post<LoginResult>({ url: URL.register, data });
|
|
|
|
export const logout = () => post<any>({ url: URL.logout });
|
|
|
|
export const getAddressList = () => get<any>({ url: URL.addressList });
|
|
export const getAddressDetail = (id: string) => get<any>({ url: URL.addressDetail + `?id=${id}` });
|
|
|
|
export const addressCreate = (data: any) => post<any>({ url: URL.addressCreate, data });
|
|
export const addressUpdate = (data: any) => post<any>({ url: URL.addressUpdate, data });
|
|
export const addressDelete = (id: string) => post<any>({ url: URL.addressDelete + `?id=${id}` });
|
|
|
|
export const getDynamicCode = () => post<any>({ url: URL.dynamicCode });
|
|
|
|
export const getRechargeList = () => get<any>({ url: URL.rechargeList });
|
|
|
|
export const getCouponList = (data: any) => post<any>({ url: '/couponseUse/pageList', data });
|