import {Global} from "../common/Global.js"; class Store { static login = 'isLogin' static save(key, value) { uni.setStorageSync(key,value) } static saveUserInfo (value) { uni.setStorageSync(Global.userKey,value); } static saveToken( value) { this.setIsLogin(true) uni.setStorageSync(Global.tokenKey,value) } static saveType( value) { // this.setIsLogin(true) uni.setStorageSync(Global.typeKey,value) } static removeType( value) { // this.setIsLogin(false) uni.removeStorageSync(Global.typeKey) } static removeUser( value) { // this.setIsLogin(false) uni.removeStorageSync(Global.userKey) } static removeToken( value) { // this.setIsLogin(false) uni.removeStorageSync(Global.tokenKey) } static isLogin() { return this.get(this.login) } static get(key) { return uni.getStorageSync(key) } static getToken() { return this.get(Global.tokenKey) } static getUser() { return this.get(Global.userKey) } static getType() { return this.get(Global.typeKey) } static setIsLogin(isLogin) { uni.$emit('isLogin',{ isLogin:isLogin }) Store.save(Store.login, isLogin) } static isExist (key) { const value = this.get(key) return value !== null && value !==undefined && value !=='' } } export { Store }