class Storage { // token static getToken() { let token = uni.getStorageSync('access_token') return token || ''; } static setCache(key, value) { return uni.setStorageSync(key, value) } static getCache(key) { return uni.getStorageSync(key) } static setToken(token = null) { uni.setStorageSync('access_token', token) } static removeCache(key) { uni.removeStorageSync(key) } static removeToken() { uni.removeStorageSync('access_token') } // 清除 static clear() { uni.clearStorageSync() uni.clearStorage() } static isLogin() { const token = uni.getStorageSync('access_token') const user = uni.getStorageSync('userInfo') if (token && user) { return true; } else { return false; } } static resetToken() { // const token = this.getToken() // const str = cryptojs.Decrypt(token); // const tokens = str.split(','); // const tokenStr = tokens[0] + ',' + ((new Date()).valueOf()); // // const res = cryptojs.Encrypt(tokenStr) return this.getToken(); } } export default Storage