完成登录功能。
This commit is contained in:
		
							
								
								
									
										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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user