完成登录功能。

This commit is contained in:
2023-04-28 17:46:54 +08:00
parent 6869294c26
commit 0fb93d0ccd
10 changed files with 187 additions and 80 deletions

View File

@@ -23,6 +23,32 @@ interface LoginInfo
password: string;
}
interface LoginCallerInfo
{
telsaler_code: string;
}
interface RequestResult
{
success: boolean;
message: string;
}
interface LoginCallerResult extends RequestResult
{
tele_saler_code: string;
tele_saler_name: string;
team_code: string;
team_name: string;
department_code: string;
department_name: string;
}
/**
* 内勤员工登录
* @param data 内勤员工登录信息
* @returns 返回一个Promise对象用于给调用者添加链式处理。
*/
async function login( data: LoginInfo ): Promise<AxiosResponse<any, any>>
{
return await instance.request(
@@ -30,10 +56,27 @@ async function login( data: LoginInfo ): Promise<AxiosResponse<any, any>>
method: "post",
url: API_URL.URL_LOGIN,
data,
}
);
});
}
/**
* 坐席登录函数
* @param data 坐席登录信息
* @returns 返回一个Promise对象用于给调用者添加链式处理。
*/
async function loginCaller( data: LoginCallerInfo ): Promise<AxiosResponse<any, any>>
{
return await instance.request(
{
method: "post",
url: API_URL.URL_LOGIN_CALLER,
data,
});
}
/**
* 退出登录
*/
function logout(): void
{
cleanStaffInfo();
@@ -42,4 +85,11 @@ function logout(): void
void router.push( "/login" );
}
export { type LoginInfo, login, logout };
export {
type LoginInfo,
type LoginCallerInfo,
type LoginCallerResult,
login,
loginCaller,
logout
};