const userInfoKey = 'SCORE_SAFE_LOGIN' // 本地用户数据的key

const getUserInfo = () => {
	var userInfo = uni.getStorageSync(userInfoKey)
	if (userInfo != '') {
		userInfo = JSON.parse(userInfo);
		return userInfo;
	} else {
		return null
	}
}

const setUserInfo = (userInfo) => {
	uni.setStorageSync(userInfoKey, JSON.stringify(userInfo));
}

// 获取胶囊距离顶部高度
const getTopHeight = () => {
	const systemInfo = uni.getSystemInfoSync();
	const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
	const statusBarHeight = systemInfo.statusBarHeight;
	const menuButtonHeight = menuButtonInfo.height;
	const calculatedTopHeight = statusBarHeight + menuButtonHeight + 20; // 20rpx 额外间距
	return `${calculatedTopHeight * (750 / systemInfo.windowWidth)}rpx`;
};
const StaticValue = {
	getTopHeight,
	userInfoKey,
	getUserInfo,
	setUserInfo
};

export default StaticValue;