测试
This commit is contained in:
43
code/web/task_schedule/src/utils/api/localStorage.ts
Normal file
43
code/web/task_schedule/src/utils/api/localStorage.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2023-02-28 09:26:45
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/utils/localStorage/localStorage.ts
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
import { StuffInfo } from "@/data/cpicxim/StuffInfo";
|
||||
|
||||
const STUFF_ITEM = "STUFF_INFO";
|
||||
|
||||
function loadStaffInfo(): StuffInfo
|
||||
{
|
||||
const stuff = new StuffInfo();
|
||||
|
||||
let obj = null;
|
||||
|
||||
try
|
||||
{
|
||||
obj = JSON.parse(window.localStorage.getItem(STUFF_ITEM));
|
||||
}
|
||||
catch (error)
|
||||
{
|
||||
obj = {};
|
||||
}
|
||||
|
||||
stuff.StuffCode = obj._stuffCode || "";
|
||||
stuff.StuffName = obj._stuffName || "";
|
||||
stuff.P13UID = obj._p13uid || "";
|
||||
|
||||
return stuff;
|
||||
}
|
||||
|
||||
function saveStuffInfo(stuff: StuffInfo)
|
||||
{
|
||||
const json = JSON.stringify(stuff);
|
||||
|
||||
window.localStorage.setItem(STUFF_ITEM, json);
|
||||
};
|
||||
|
||||
export { loadStaffInfo, saveStuffInfo };
|
37
code/web/task_schedule/src/utils/api/request.ts
Normal file
37
code/web/task_schedule/src/utils/api/request.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
import axios from "axios";
|
||||
|
||||
const service = axios.create(
|
||||
{
|
||||
baseURL: "",
|
||||
timeout: 10000,
|
||||
}
|
||||
);
|
||||
|
||||
//请求拦截
|
||||
service.interceptors.request.use(
|
||||
(config) =>
|
||||
{
|
||||
return config;
|
||||
},
|
||||
(error) =>
|
||||
{
|
||||
console.log(error);
|
||||
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
//响应拦截
|
||||
service.interceptors.response.use(
|
||||
(response) =>
|
||||
{
|
||||
return response;
|
||||
},
|
||||
(error) =>
|
||||
{
|
||||
return Promise.reject(error);
|
||||
}
|
||||
);
|
||||
|
||||
export { service };
|
@@ -1,13 +0,0 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
* @Date: 2023-02-28 09:26:45
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /deskop_task_schedule/code/web/task_schedule/src/utils/localStorage/localStorage.js
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
*/
|
||||
function loadStaffInfo()
|
||||
{
|
||||
// const staffInfo:string = "";
|
||||
}
|
Reference in New Issue
Block a user