完成登录功能。

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
};

View File

@@ -10,6 +10,7 @@
export const API_URL = {
// URL_LOGIN: import.meta.env.VITE_URL_LOGIN,
URL_LOGIN: "http://222.76.244.118:11101/admin-system/account/p13_account_check",
URL_LOGIN_CALLER: "http://localhost:8080/desktop_archievement_backend/account/query_telsaler_info.do",
// URL_DEPARTMENT_ARCHIEVEMENT: import.meta.env.VITE_URL_DEPARTMENT_ARCHIEVEMENT,
URL_DEPARTMENT_ARCHIEVEMENT: "http://222.76.244.118:11101/desktop_archievement_backend/archievement/query_department_archievement.do",

View File

@@ -7,7 +7,7 @@
*
* Copyright (c) ${2022} by Kane, All Rights Reserved.
*/
import { StaffInfo } from "@/data/cpicxim/StaffInfo.js";
import { StaffInfo } from "../../data/cpicxim/StaffInfo.js";
const STUFF_ITEM = "stuff_info";
const CALLER_ITEM = "call_info";