完成登录功能。
This commit is contained in:
parent
6869294c26
commit
0fb93d0ccd
26
code/web/task_schedule/package-lock.json
generated
26
code/web/task_schedule/package-lock.json
generated
@ -12,7 +12,7 @@
|
||||
"@element-plus/icons-vue": "^2.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.1",
|
||||
"@typescript-eslint/parser": "^5.59.1",
|
||||
"axios": "^1.3.6",
|
||||
"axios": "^1.4.0",
|
||||
"babel": "^6.23.0",
|
||||
"echarts": "^5.4.2",
|
||||
"element-plus": "^2.3.4",
|
||||
@ -31,7 +31,7 @@
|
||||
"eslint-plugin-vue": "^9.11.0",
|
||||
"sass": "^1.62.1",
|
||||
"typescript": "^5.0.4",
|
||||
"vite": "^4.3.2",
|
||||
"vite": "^4.3.3",
|
||||
"vue-eslint-parser": "^9.1.1"
|
||||
}
|
||||
},
|
||||
@ -2719,9 +2719,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.3.6.tgz",
|
||||
"integrity": "sha512-PEcdkk7JcdPiMDkvM4K6ZBRYq9keuVJsToxm2zQIM70Qqo2WHTdJZMXcG9X+RmRp2VPNUQC8W1RAGbgt6b1yMg==",
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.4.0.tgz",
|
||||
"integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.0",
|
||||
"form-data": "^4.0.0",
|
||||
@ -9748,11 +9748,11 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.21",
|
||||
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.21.tgz",
|
||||
"integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==",
|
||||
"version": "8.4.23",
|
||||
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.23.tgz",
|
||||
"integrity": "sha512-bQ3qMcpF6A/YjR55xtoTr0jGOlnPOKAIMdOWiv0EIT6HVPEaJiJB4NLljSbiHoC2RX7DN5Uvjtpbg1NPdwv1oA==",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.4",
|
||||
"nanoid": "^3.3.6",
|
||||
"picocolors": "^1.0.0",
|
||||
"source-map-js": "^1.0.2"
|
||||
},
|
||||
@ -12026,13 +12026,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "4.3.2",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-4.3.2.tgz",
|
||||
"integrity": "sha512-9R53Mf+TBoXCYejcL+qFbZde+eZveQLDYd9XgULILLC1a5ZwPaqgmdVpL8/uvw2BM/1TzetWjglwm+3RO+xTyw==",
|
||||
"version": "4.3.3",
|
||||
"resolved": "https://registry.npmmirror.com/vite/-/vite-4.3.3.tgz",
|
||||
"integrity": "sha512-MwFlLBO4udZXd+VBcezo3u8mC77YQk+ik+fbc0GZWGgzfbPP+8Kf0fldhARqvSYmtIWoAJ5BXPClUbMTlqFxrA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.17.5",
|
||||
"postcss": "^8.4.21",
|
||||
"postcss": "^8.4.23",
|
||||
"rollup": "^3.21.0"
|
||||
},
|
||||
"bin": {
|
||||
|
@ -13,7 +13,7 @@
|
||||
"@element-plus/icons-vue": "^2.1.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.1",
|
||||
"@typescript-eslint/parser": "^5.59.1",
|
||||
"axios": "^1.3.6",
|
||||
"axios": "^1.4.0",
|
||||
"babel": "^6.23.0",
|
||||
"echarts": "^5.4.2",
|
||||
"element-plus": "^2.3.4",
|
||||
@ -32,7 +32,7 @@
|
||||
"eslint-plugin-vue": "^9.11.0",
|
||||
"sass": "^1.62.1",
|
||||
"typescript": "^5.0.4",
|
||||
"vite": "^4.3.2",
|
||||
"vite": "^4.3.3",
|
||||
"vue-eslint-parser": "^9.1.1"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2023-03-02 15:48:44
|
||||
* @Date: 2023-04-27 15:29:10
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /task_schedule/src/test/test.ts
|
||||
* @Description:
|
||||
@ -8,33 +8,6 @@
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
|
||||
import { queryDepartmentArchievement } from "../utils/archievement.js";
|
||||
import { loginTestCaller } from "./requestTest.js";
|
||||
|
||||
interface Cat
|
||||
{
|
||||
name: string;
|
||||
purrs: boolean;
|
||||
}
|
||||
|
||||
interface Dog
|
||||
{
|
||||
// name: string;
|
||||
barks: true;
|
||||
wags: true;
|
||||
}
|
||||
|
||||
type CatOrDog = Cat | Dog;
|
||||
|
||||
const animal: CatOrDog =
|
||||
{
|
||||
name: "kaka",
|
||||
purrs: true,
|
||||
barks: true,
|
||||
wags: true,
|
||||
};
|
||||
|
||||
console.log( "test" );
|
||||
|
||||
const gainers: Array<string | number> = ["kane", 588,];
|
||||
|
||||
const kane = { a: 100, b: 200, };
|
||||
loginTestCaller();
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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",
|
||||
|
@ -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";
|
||||
|
@ -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 {
|
||||
|
@ -14,6 +14,7 @@
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<spring.version>5.3.24</spring.version>
|
||||
<!-- <spring.version>6.0.8</spring.version> -->
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -11,12 +11,14 @@ package com.cpic.xim.web.controllers.account;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.cpic.xim.utils.account.CpicXIMStaffInfo;
|
||||
import com.cpic.xim.utils.account.TeleSalerInfo;
|
||||
|
||||
|
||||
@Controller
|
||||
@RequestMapping( "/account" )
|
||||
public class StaffInfoQueryController
|
||||
@ -62,23 +64,34 @@ public class StaffInfoQueryController
|
||||
*/
|
||||
@RequestMapping( "/query_telsaler_info.do" )
|
||||
@ResponseBody
|
||||
public TeleSalerQueryResult queryTeleSalerInfo( @RequestParam("telesaler_code") String teleSalerCode )
|
||||
public TeleSalerQueryResult queryTeleSalerInfo(
|
||||
@RequestBody TelsalerQueryRequest telSaler )
|
||||
{
|
||||
TeleSalerQueryResult result = new TeleSalerQueryResult();
|
||||
TeleSalerInfo saler = null;
|
||||
|
||||
try
|
||||
{
|
||||
saler = TeleSalerInfo.queryTeleSalerInfo( teleSalerCode );
|
||||
saler = TeleSalerInfo.queryTeleSalerInfo( telSaler.getTelSalerCode() );
|
||||
|
||||
result.setTeleSalerCode( saler.getCode() );
|
||||
result.setTeleSalerName( saler.getName() );
|
||||
result.setTeamCode( saler.getTeamCode() );
|
||||
result.setTeamName( saler.getTeamName() );
|
||||
result.setDepartmentCode( saler.getDepartmentCode() );
|
||||
result.setDepartmentName( saler.getDepartmentName() );
|
||||
// 根据返回结果是否为 null,判断是否查询到坐席信息
|
||||
if ( saler != null )
|
||||
{
|
||||
// 不为 null,有查询到
|
||||
result.setTeleSalerCode( saler.getCode() );
|
||||
result.setTeleSalerName( saler.getName() );
|
||||
result.setTeamCode( saler.getTeamCode() );
|
||||
result.setTeamName( saler.getTeamName() );
|
||||
result.setDepartmentCode( saler.getDepartmentCode() );
|
||||
result.setDepartmentName( saler.getDepartmentName() );
|
||||
|
||||
result.setSuccess( true );
|
||||
result.setSuccess( true );
|
||||
} else
|
||||
{
|
||||
// 为 null 则没查询到
|
||||
result.setSuccess( false );
|
||||
result.setMessage( "未查询到坐席信息!" );
|
||||
}
|
||||
}
|
||||
catch ( SQLException error )
|
||||
{
|
||||
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2023-04-28 14:40:49
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/web/controllers/account/TelsalerQueryRequest.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.web.controllers.account;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class TelsalerQueryRequest
|
||||
{
|
||||
public TelsalerQueryRequest() {}
|
||||
|
||||
public TelsalerQueryRequest( String telSalerCode )
|
||||
{
|
||||
this.telSalerCode = telSalerCode;
|
||||
}
|
||||
|
||||
public String getTelSalerCode()
|
||||
{
|
||||
return telSalerCode;
|
||||
}
|
||||
|
||||
public void setTelSalerCode( String telSalerCode )
|
||||
{
|
||||
this.telSalerCode = telSalerCode;
|
||||
}
|
||||
|
||||
@JsonProperty("telsaler_code")
|
||||
private String telSalerCode;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user