2023-02-28 01:16:49 +08:00
|
|
|
|
<!--
|
|
|
|
|
* @Author: Kane
|
|
|
|
|
* @Date: 2023-02-28 00:57:21
|
|
|
|
|
* @LastEditors: Kane
|
2023-03-02 19:48:08 +08:00
|
|
|
|
* @FilePath: /task_schedule/src/views/Login.vue
|
2023-03-17 14:40:04 +08:00
|
|
|
|
* @Description:
|
2023-02-28 19:58:03 +08:00
|
|
|
|
* 登录页面,路由默认指向这个页面
|
|
|
|
|
* 1、判断url中的参数,取得用户信息,根据用户的部门改变路由
|
2023-03-17 14:40:04 +08:00
|
|
|
|
*
|
|
|
|
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
2023-02-28 01:16:49 +08:00
|
|
|
|
-->
|
|
|
|
|
<template>
|
2023-03-02 16:59:48 +08:00
|
|
|
|
<div class="page-wrapper">
|
|
|
|
|
<div class="login-wrapper">
|
2023-03-03 00:33:30 +08:00
|
|
|
|
<h1>登 录</h1>
|
2023-03-22 01:06:11 +08:00
|
|
|
|
<ul class="menu-tab">
|
|
|
|
|
<li
|
|
|
|
|
v-for="item in ui.tabMenu"
|
|
|
|
|
:key="item.type"
|
|
|
|
|
:class="{ 'current': ui.currentMenu === item.type }"
|
|
|
|
|
@click="onToggleMenu(item.type)"
|
|
|
|
|
>
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2023-03-02 16:59:48 +08:00
|
|
|
|
<el-form ref="loginForm">
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<label class="form-label">用户名</label>
|
2023-03-17 14:40:04 +08:00
|
|
|
|
<el-input
|
2023-03-22 01:06:11 +08:00
|
|
|
|
v-if="ui.currentMenu === ui.tabMenu[0].type"
|
2023-03-17 14:40:04 +08:00
|
|
|
|
v-model.trim.lazy="ui.account"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="请输入P13账号或P09工号"
|
|
|
|
|
/>
|
2023-03-22 01:06:11 +08:00
|
|
|
|
<el-input
|
|
|
|
|
v-else
|
|
|
|
|
v-model.trim.lazy="ui.account"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="请输入坐席工号"
|
|
|
|
|
/>
|
2023-03-02 16:59:48 +08:00
|
|
|
|
</el-form-item>
|
2023-03-22 01:06:11 +08:00
|
|
|
|
<el-form-item v-show="ui.currentMenu === ui.tabMenu[0].type">
|
2023-03-02 16:59:48 +08:00
|
|
|
|
<label class="form-label">密码</label>
|
2023-03-17 14:40:04 +08:00
|
|
|
|
<el-input
|
|
|
|
|
v-model.trim.lazy="ui.password"
|
|
|
|
|
type="password"
|
|
|
|
|
placeholder="请输入P13密码"
|
|
|
|
|
/>
|
2023-03-02 16:59:48 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
2023-03-17 14:40:04 +08:00
|
|
|
|
<el-button
|
|
|
|
|
type="primary"
|
|
|
|
|
class="el-button-block"
|
|
|
|
|
@click="onLogin"
|
|
|
|
|
>
|
2023-03-02 16:59:48 +08:00
|
|
|
|
登录
|
|
|
|
|
</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
|
|
|
|
</div>
|
2023-03-22 01:06:11 +08:00
|
|
|
|
<!-- <div>
|
2023-03-02 19:48:08 +08:00
|
|
|
|
<span>{{ ui.tips }}</span>
|
2023-03-22 01:06:11 +08:00
|
|
|
|
</div> -->
|
2023-03-01 17:31:20 +08:00
|
|
|
|
</div>
|
2023-02-28 01:16:49 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
2023-03-04 18:05:47 +08:00
|
|
|
|
import { reactive, onBeforeMount } from "vue";
|
2023-03-03 16:08:27 +08:00
|
|
|
|
import { useRouter } from "vue-router";
|
2023-03-24 15:11:47 +08:00
|
|
|
|
import { loadStaffInfo, saveStaffInfo, getUserType, saveUserType, getCallerInfo, saveCallerInfo } from "@/utils/api/localStorage";
|
2023-03-02 19:48:08 +08:00
|
|
|
|
import { login } from "@/utils/account";
|
|
|
|
|
import { ElMessage } from "element-plus";
|
|
|
|
|
import { StaffInfo } from "@/data/cpicxim/StaffInfo";
|
2023-02-28 09:30:02 +08:00
|
|
|
|
|
2023-02-28 01:16:49 +08:00
|
|
|
|
export default {
|
2023-02-28 09:30:02 +08:00
|
|
|
|
name: "LoginPage",
|
|
|
|
|
setup()
|
2023-02-28 01:16:49 +08:00
|
|
|
|
{
|
2023-03-03 16:08:27 +08:00
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
2023-02-28 09:30:02 +08:00
|
|
|
|
const ui = reactive({
|
2023-03-02 16:59:48 +08:00
|
|
|
|
account: "",
|
2023-03-02 19:48:08 +08:00
|
|
|
|
password: "",
|
|
|
|
|
tips: "",
|
2023-03-01 17:31:20 +08:00
|
|
|
|
showNeedAccountTip: false,
|
2023-03-02 00:35:21 +08:00
|
|
|
|
showAccountErrorTip: false,
|
2023-03-22 01:06:11 +08:00
|
|
|
|
tabMenu: [
|
|
|
|
|
{ type: "cpicxim_staff", label: "内勤", },
|
|
|
|
|
{ type: "tele_saler", label: "坐席", },
|
|
|
|
|
],
|
|
|
|
|
currentMenu: "",
|
2023-02-28 09:30:02 +08:00
|
|
|
|
});
|
|
|
|
|
|
2023-03-02 16:59:48 +08:00
|
|
|
|
const savedP13uid = () =>
|
2023-03-01 17:31:20 +08:00
|
|
|
|
{
|
2023-03-24 15:11:47 +08:00
|
|
|
|
window.localStorage.setItem( "stuff_account", ui.account );
|
2023-03-02 19:48:08 +08:00
|
|
|
|
};
|
2023-03-02 16:59:48 +08:00
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
2023-03-02 19:48:08 +08:00
|
|
|
|
const onLogin = () =>
|
|
|
|
|
{
|
2023-03-23 18:39:15 +08:00
|
|
|
|
// 保存用户类型
|
2023-03-24 15:11:47 +08:00
|
|
|
|
saveUserType( ui.currentMenu );
|
2023-03-23 18:39:15 +08:00
|
|
|
|
|
|
|
|
|
// 判断是坐席还是内勤
|
2023-03-24 15:11:47 +08:00
|
|
|
|
if ( ui.currentMenu === "cpicxim_staff" )
|
2023-03-23 18:39:15 +08:00
|
|
|
|
{
|
|
|
|
|
// 是内勤员工
|
|
|
|
|
const info = {
|
|
|
|
|
p13account: ui.account,
|
|
|
|
|
password: ui.password,
|
|
|
|
|
};
|
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
login( info )
|
|
|
|
|
.then(( response ) =>
|
2023-03-02 19:48:08 +08:00
|
|
|
|
{
|
2023-03-23 18:39:15 +08:00
|
|
|
|
const data = response.data ?? { success: false, };
|
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
if ( data.success === true )
|
2023-03-23 18:39:15 +08:00
|
|
|
|
{
|
2023-03-17 14:40:04 +08:00
|
|
|
|
// 提示登录成功,并保存到localStorage,然后路由跳转
|
2023-03-23 18:39:15 +08:00
|
|
|
|
ElMessage({
|
|
|
|
|
message: data.message,
|
|
|
|
|
type: "success",
|
|
|
|
|
center: true,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const staffInfo = new StaffInfo(
|
|
|
|
|
data.staff_info.p13uid ?? "",
|
|
|
|
|
data.staff_info.code ?? "",
|
|
|
|
|
data.staff_info.name ?? "",
|
|
|
|
|
data.staff_info.department_code ?? "",
|
|
|
|
|
data.staff_info.department_name ?? "",
|
|
|
|
|
data.staff_info.section_office_code ?? "",
|
|
|
|
|
data.staff_info.p13section_office_nameuid ?? ""
|
|
|
|
|
);
|
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
saveStaffInfo( staffInfo );
|
2023-03-23 18:39:15 +08:00
|
|
|
|
|
|
|
|
|
// 跳转路由
|
2023-03-24 15:11:47 +08:00
|
|
|
|
router.push( "/desktop" );
|
2023-03-23 18:39:15 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
ElMessage({
|
|
|
|
|
message: data.message,
|
|
|
|
|
type: "error",
|
|
|
|
|
center: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
console.log( data );
|
2023-03-23 18:39:15 +08:00
|
|
|
|
})
|
2023-03-24 15:11:47 +08:00
|
|
|
|
.catch(( error ) =>
|
2023-03-02 19:48:08 +08:00
|
|
|
|
{
|
2023-03-23 18:39:15 +08:00
|
|
|
|
debugger;
|
2023-03-24 15:11:47 +08:00
|
|
|
|
console.log( `登录失败,返回信息:${error}` );
|
2023-03-23 18:39:15 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
2023-03-24 15:11:47 +08:00
|
|
|
|
else if ( ui.currentMenu === "tele_saler" )
|
2023-03-23 18:39:15 +08:00
|
|
|
|
{
|
|
|
|
|
// 坐席
|
2023-03-24 15:11:47 +08:00
|
|
|
|
saveCallerInfo( ui.account );
|
2023-03-23 18:39:15 +08:00
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
// 跳转路由
|
|
|
|
|
router.push( "/desktop_archievement" );
|
2023-03-23 18:39:15 +08:00
|
|
|
|
}
|
2023-03-02 16:59:48 +08:00
|
|
|
|
};
|
2023-02-28 01:16:49 +08:00
|
|
|
|
|
2023-03-02 19:48:08 +08:00
|
|
|
|
onBeforeMount(() =>
|
|
|
|
|
{
|
2023-03-24 15:11:47 +08:00
|
|
|
|
const staffType = getUserType();
|
2023-03-02 19:48:08 +08:00
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
// 判断已登录的信息是坐席还是内勤
|
|
|
|
|
if ( staffType === "tele_saler" )
|
2023-03-02 19:48:08 +08:00
|
|
|
|
{
|
2023-03-24 15:11:47 +08:00
|
|
|
|
const callInfo = getCallerInfo();
|
|
|
|
|
|
|
|
|
|
// 判断是否已经记录了P13账号,有则提示已登录,然后跳转路由
|
|
|
|
|
if ( callInfo !== "" )
|
|
|
|
|
{
|
|
|
|
|
ElMessage({
|
|
|
|
|
message: `已登录账号:${callInfo}`,
|
|
|
|
|
type: "success",
|
|
|
|
|
center: true,
|
|
|
|
|
});
|
2023-03-03 16:08:27 +08:00
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
// 跳转路由
|
|
|
|
|
router.push( "/desktop_archievement" );
|
|
|
|
|
}
|
2023-03-02 19:48:08 +08:00
|
|
|
|
}
|
|
|
|
|
});
|
2023-03-02 16:59:48 +08:00
|
|
|
|
|
2023-03-24 15:11:47 +08:00
|
|
|
|
const onToggleMenu = ( type: string ) =>
|
2023-03-22 01:06:11 +08:00
|
|
|
|
{
|
|
|
|
|
ui.currentMenu = type;
|
|
|
|
|
};
|
2023-03-02 16:59:48 +08:00
|
|
|
|
|
2023-03-22 01:06:11 +08:00
|
|
|
|
// 初始化界面
|
|
|
|
|
ui.currentMenu = ui.tabMenu[1].type;
|
|
|
|
|
|
|
|
|
|
return { ui, savedP13uid, onLogin, onToggleMenu, };
|
2023-02-28 01:16:49 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
2023-03-02 16:59:48 +08:00
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.page-wrapper {
|
2023-03-01 17:31:20 +08:00
|
|
|
|
box-sizing: border-box;
|
2023-03-22 01:06:11 +08:00
|
|
|
|
// height: calc(100vh - 10mm);
|
|
|
|
|
// width: calc(100vw - 10mm);
|
|
|
|
|
height: 100vh;
|
|
|
|
|
width: 100vw;
|
2023-03-02 19:48:08 +08:00
|
|
|
|
// border: 1px solid red;
|
2023-03-01 17:31:20 +08:00
|
|
|
|
display: flex;
|
2023-03-02 19:48:08 +08:00
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: start;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
2023-03-22 17:07:33 +08:00
|
|
|
|
background-image: url("@/assets/img/bg/bg_01.jpg");
|
|
|
|
|
background-attachment: fixed;
|
|
|
|
|
background-size: contain;
|
|
|
|
|
|
2023-03-02 16:59:48 +08:00
|
|
|
|
span {
|
|
|
|
|
font-size: 30px;
|
|
|
|
|
color: red;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.login-wrapper {
|
2023-03-02 19:48:08 +08:00
|
|
|
|
box-sizing: border-box;
|
2023-03-02 16:59:48 +08:00
|
|
|
|
width: 320px;
|
|
|
|
|
// margin-top: 5cm auto auto auto;
|
2023-03-03 16:08:27 +08:00
|
|
|
|
margin-top: calc(100vh * 0.075);
|
2023-03-02 19:48:08 +08:00
|
|
|
|
padding: 10mm;
|
2023-03-02 16:59:48 +08:00
|
|
|
|
background-color: #cac2c27f;
|
|
|
|
|
backdrop-filter: blur(10px);
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
// backdrop-filter: ;
|
2023-03-03 00:33:30 +08:00
|
|
|
|
|
|
|
|
|
h1 {
|
|
|
|
|
font-family: "FZ-ZHUOHEI";
|
|
|
|
|
font-size: 70px;
|
|
|
|
|
font-weight: 100;
|
|
|
|
|
color: #fff;
|
|
|
|
|
margin: 5mm 0;
|
|
|
|
|
display: block;
|
|
|
|
|
text-align: center;
|
2023-03-03 17:28:49 +08:00
|
|
|
|
text-shadow: #1d6ddc 2px 10px 2px,
|
|
|
|
|
#1d6ddc 2px 0px 2px,
|
|
|
|
|
#1d6ddc -2px -0px 2px,
|
|
|
|
|
#1d6ddc -0px -2px 2px,
|
|
|
|
|
#1d6ddc -1.4px -1.4px 2px,
|
|
|
|
|
#1d6ddc 1.4px 1.4px 2px,
|
|
|
|
|
#1d6ddc 1.4px -1.4px 2px,
|
|
|
|
|
#1d6ddc -1.4px 1.4px 2px;
|
2023-03-03 00:33:30 +08:00
|
|
|
|
|
|
|
|
|
}
|
2023-03-02 16:59:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-22 01:06:11 +08:00
|
|
|
|
.menu-tab {
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
&.current {
|
|
|
|
|
background-color: #1d6ddc;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-02 16:59:48 +08:00
|
|
|
|
.form-label {
|
|
|
|
|
display: block;
|
|
|
|
|
/* color: #fff; */
|
|
|
|
|
color: #344a5fef;
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
// border: 1px solid red;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-input {
|
|
|
|
|
color: #344a5fef;
|
2023-03-01 17:31:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-02 16:59:48 +08:00
|
|
|
|
.el-button-block {
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-top: 20px;
|
2023-03-01 17:31:20 +08:00
|
|
|
|
}
|
2023-03-03 16:08:27 +08:00
|
|
|
|
</style>
|