
function useBase64() {
    function encrypt(props: { key: string, value: string }) {
        console.log(props.key)
        sessionStorage.setItem(
            btoa(props.key),
            btoa(
                props.value.search(/[\u4e00-\u9fa5]/ig) !== -1 ?
                    props.value.replace(/([\u4e00-\u9fa5])*/, escape((props.value.match(/[\u4e00-\u9fa5]/ig) as string[]).join(''))) : props.value
            )
        )
        localStorage.setItem(btoa(props.key),
        btoa(props?.value)?.replace(/=/g, '')?.split('')?.reverse()?.join('')
        )
    }
    function decode(key: string) {
        let str = sessionStorage.getItem(btoa(key)) || ''
        str = unescape(atob(str))
        return str
    }
    return { encrypt, decode }
}
function jm() {
    let t = new Date().getTime()
    let d = new Date().getDate()
    let b = btoa(String(t / d)).replace(/=/g, '').split('').reverse().join('')
    return b
    // let a = atob(b.split('').reverse().join(''))*d
}
export { useBase64, jm }