import { LocalStorage } from "quasar"
const secondMilliseconds=1000;
const dayMilliseconds=1000 * 60 * 60 * 24;
const monthMilliseconds=dayMilliseconds * 31;
const expirationTime=1*dayMilliseconds;
//登录时间检测
class TimeDetection{
    setTime=()=>{
        LocalStorage.set('loginTime',Date.now());
    };
    removeTime=()=>{
        LocalStorage.remove('loginTime');
    };
    timeCompare=()=>{
        const lastLoginTime=LocalStorage.getItem('loginTime');
        if(Date.now()-(lastLoginTime as number)>expirationTime)
        {
            //超过时间为false
            return false;
        }
        else
        {
            return true;
        }
    }
    
}
export const timeDetection=new TimeDetection();