46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
|
/*
|
||
|
* @Author: Kane
|
||
|
* @Date: 2022-12-22 09:10:20
|
||
|
* @LastEditors: Kane
|
||
|
* @LastEditTime: 2023-01-25 00:29:54
|
||
|
* @FilePath: \admin_system\src\utils\api\info\account.js
|
||
|
* @Description:
|
||
|
*
|
||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||
|
*/
|
||
|
import instance from "@/utils/api/request";
|
||
|
import { API_URL } from "@/utils/api/config"; //所有API的地址
|
||
|
import router from "../../../router/index";
|
||
|
import store from "../../../store/index";
|
||
|
|
||
|
/**
|
||
|
* 登录请求函数
|
||
|
* @param {*} userInfo
|
||
|
* @returns 返回promise对象
|
||
|
*/
|
||
|
export function Login(userInfo)
|
||
|
{
|
||
|
//console.log("登录请求地址:", API_URL.URL_LOGIN);
|
||
|
//const url = "http://localhost:8080/admin-system/account/p13_account_check";
|
||
|
return instance.request(
|
||
|
{
|
||
|
method: "post",
|
||
|
url: API_URL.URL_LOGIN,
|
||
|
data: userInfo,
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 退出登录
|
||
|
*/
|
||
|
export function Logout()
|
||
|
{
|
||
|
console.log(store);
|
||
|
|
||
|
window.localStorage.removeItem("token");
|
||
|
window.localStorage.removeItem("user_info");
|
||
|
|
||
|
router.replace("/login");
|
||
|
}
|