完成登录功能。
This commit is contained in:
@@ -68,7 +68,7 @@
|
||||
import { reactive, onBeforeMount } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { saveStaffInfo, getUserType, saveUserType, getCallerInfo, saveCallerInfo } from "@/utils/api/localStorage";
|
||||
import { login } from "@/utils/account";
|
||||
import { login, loginCaller, type LoginCallerInfo, type LoginCallerResult } from "@/utils/account";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { StaffInfo } from "@/data/cpicxim/StaffInfo";
|
||||
|
||||
@@ -120,7 +120,7 @@ export default {
|
||||
|
||||
if ( data.success === true )
|
||||
{
|
||||
// 提示登录成功,并保存到localStorage,然后路由跳转
|
||||
// 提示登录成功,并保存到localStorage,然后路由跳转
|
||||
ElMessage({
|
||||
message: data.message,
|
||||
type: "success",
|
||||
@@ -161,11 +161,45 @@ export default {
|
||||
}
|
||||
else if ( ui.currentMenu === "tele_saler" )
|
||||
{
|
||||
// 是坐席,将坐席工号保存到本地,然后跳转
|
||||
saveCallerInfo( ui.account );
|
||||
// 是坐席
|
||||
const loginInfo: LoginCallerInfo = {
|
||||
telsaler_code: ui.account,
|
||||
};
|
||||
|
||||
// 跳转路由
|
||||
router.push( "/desktop_archievement" );
|
||||
// 登录
|
||||
loginCaller( loginInfo )
|
||||
// 调用接口成功
|
||||
.then(( response ) =>
|
||||
{
|
||||
const data:LoginCallerResult = response.data ?? { success: false, };
|
||||
|
||||
// 查看標志位
|
||||
if ( data.success === true )
|
||||
{
|
||||
// 查询成功,显示一个提示,保存工号,并跳转路由
|
||||
ElMessage({
|
||||
message: `验证成功,登录用户 ${data.tele_saler_name}`,
|
||||
type: "success",
|
||||
});
|
||||
|
||||
saveCallerInfo( ui.account );
|
||||
|
||||
router.push( "/desktop_archievement" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// 查詢失敗
|
||||
ElMessage({
|
||||
message: "验证失败,请检查输入的工号。",
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
})
|
||||
// 调用接口失败
|
||||
.catch(( error ) =>
|
||||
{
|
||||
console.log( `登录失败,返回信息:${error}` );
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -268,25 +302,25 @@ export default {
|
||||
}
|
||||
|
||||
.menu-tab {
|
||||
text-align: center;
|
||||
margin-bottom: 15px;
|
||||
margin-top: 25px;
|
||||
text-align: center;
|
||||
margin-bottom: 15px;
|
||||
margin-top: 25px;
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
padding: 10px 24px;
|
||||
margin: 0 10px;
|
||||
// background-color: #fff;
|
||||
color: #1d6ddc;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
li {
|
||||
display: inline-block;
|
||||
padding: 10px 24px;
|
||||
margin: 0 10px;
|
||||
// background-color: #fff;
|
||||
color: #1d6ddc;
|
||||
font-size: 16px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
|
||||
&.current {
|
||||
background-color: #1d6ddc;
|
||||
color: #fff;
|
||||
&.current {
|
||||
background-color: #1d6ddc;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-label {
|
||||
|
Reference in New Issue
Block a user