整理代码!

This commit is contained in:
2023-03-24 15:11:47 +08:00
parent bee1061e20
commit 7dbd48152f
14 changed files with 119 additions and 80 deletions

View File

@@ -10,6 +10,7 @@
import { StaffInfo } from "@/data/cpicxim/StaffInfo.js";
const STUFF_ITEM = "stuff_info";
const CALLER_ITEM = "call_info";
const USER_TYPE_ITEM = "user_type";
function loadStaffInfo(): StaffInfo
@@ -61,10 +62,28 @@ function getUserType(): string
return userType;
}
function saveCallerInfo( callerCode: string ): void
{
window.localStorage.setItem( CALLER_ITEM, callerCode );
}
function getCallerInfo(): string
{
return window.localStorage.getItem( CALLER_ITEM ) ?? "";
}
function clearCallerInfo(): void
{
window.localStorage.removeItem( CALLER_ITEM );
}
export {
loadStaffInfo,
saveStaffInfo,
cleanStaffInfo,
saveUserType,
getUserType
getUserType,
saveCallerInfo,
getCallerInfo,
clearCallerInfo
};

View File

@@ -66,7 +66,7 @@ function getParamsFromURL( url: string ): stringkey
// 拆分属性
const paramArray: string[] = paramString.split( "&" );
paramArray.forEach( ( item ) =>
paramArray.forEach(( item ) =>
{
if ( item.length === 0 )
{
@@ -76,7 +76,7 @@ function getParamsFromURL( url: string ): stringkey
const param = item.split( "=" );
paramObj[param[0]] = param[1] ?? "";
} );
});
return paramObj;
}