// 存储 const STORAGE_USER_TOKEN = 'storage_user_token'; const PRODUCTS_TO_ORDER = 'products_to_order'; const USER_BASE_INFO = 'user_base_info'; const POSITION_MACID = 'position_macid'; // 暂存macid 用于页面跳转 const APP_CONFIG = 'app_config'; const CAR_IMAGES = 'car_images'; // 现场拍摄车辆照片 const SELECTED_DEVICE_INFO = 'selected_device_info'; const CB_BLUETOOTH_INFO = 'cb_bluetooth_info'; const USER_CURRENT_LOCATION = 'user_current_location'; // 用户当前位置 const IS_SCAN = 'is_scan'; const SHARE_CODE = 'share_code'; const IS_AGREEMENT = 'agreement' const IS_LOCATION_AUTH = 'is_location_auth' const USER_INFO_DATA = 'USER_INFO_DATA'; const IS_BUY_MODEL = 'IS_BUY_MODEL'; function setIsLocationAuth(location_auth) { uni.setStorageSync(IS_LOCATION_AUTH, location_auth); } function getIsLocationAuth() { return uni.getStorageSync(IS_LOCATION_AUTH); } function setUserToken(user_token) { uni.setStorageSync(STORAGE_USER_TOKEN, user_token); } function getUserToken() { return uni.getStorageSync(STORAGE_USER_TOKEN); } function clearStorage() { const appConfig = getAppConfig(); uni.clearStorageSync(); setAppConfig(appConfig); } function productsToOrder(productArr) { uni.setStorageSync(PRODUCTS_TO_ORDER, productArr); } function getProductsToOrder() { return uni.getStorageSync(PRODUCTS_TO_ORDER); } function setBaseUserInfo(baseUserInfo) { uni.setStorageSync(USER_BASE_INFO, baseUserInfo); } function getBaseUserInfo() { return uni.getStorageSync(USER_BASE_INFO); } function cleanBaseUserInfo() { uni.removeStorageSync(USER_BASE_INFO); } function setUserInfoData(baseUserInfo) { uni.setStorageSync(USER_INFO_DATA, baseUserInfo); } function getUserInfoData() { return uni.getStorageSync(USER_INFO_DATA); } function cleanUserInfoData() { uni.removeStorageSync(USER_INFO_DATA); } function setMacid(macid) { uni.setStorageSync(POSITION_MACID, macid); } function getMacid() { return uni.getStorageSync(POSITION_MACID); } function setAppConfig(app_config) { uni.setStorageSync(APP_CONFIG, app_config); } function getAppConfig() { return uni.getStorageSync(APP_CONFIG); } function setCarImages(car_imgs) { uni.setStorageSync(CAR_IMAGES, car_imgs); } function getCarImages() { return uni.getStorageSync(CAR_IMAGES); } function setSelectedDeviceInfo(device_info) { uni.setStorageSync(SELECTED_DEVICE_INFO, device_info); } function getSelectedDeviceInfo() { return uni.getStorageSync(SELECTED_DEVICE_INFO); } function setCabinetInfo(cb_info) { uni.setStorageSync(CB_BLUETOOTH_INFO, cb_info); } function getCabinetInfo() { return uni.getStorageSync(CB_BLUETOOTH_INFO); } function setUserCurrentLocation( location_info = { longitude: '', latitude: '' } ) { uni.setStorageSync(USER_CURRENT_LOCATION, location_info); } function getUserCurrentLocation() { return uni.getStorageSync(USER_CURRENT_LOCATION); } function setIsScan(isScan) { uni.setStorageSync(IS_SCAN, isScan); } function getIsScan() { return uni.getStorageSync(IS_SCAN); } function setIsAgreement(isAgree) { uni.setStorageSync(IS_AGREEMENT, isAgree); } function getIsAgreement() { return uni.getStorageSync(IS_AGREEMENT); } function setShareCode(shareCode) { uni.setStorageSync(SHARE_CODE, shareCode); } function getShareCode() { return uni.getStorageSync(SHARE_CODE); } function setIsBuyModel(check = false) { uni.setStorageSync(IS_BUY_MODEL, check); } function getIsBuyModel() { return uni.getStorageSync(IS_BUY_MODEL); } module.exports = { setUserToken: setUserToken, getUserToken: getUserToken, clearStorage: clearStorage, productsToOrder: productsToOrder, getProductsToOrder: getProductsToOrder, setUserInfo: setBaseUserInfo, getUserInfo: getBaseUserInfo, cleanUserInfo: cleanBaseUserInfo, setUserInfoData: setUserInfoData, getUserInfoData: getUserInfoData, cleanUserInfoData: cleanUserInfoData, setIsScan: setIsScan, getIsScan: getIsScan, setIsAgreement: setIsAgreement, getIsAgreement: getIsAgreement, setMacid: setMacid, getMacid: getMacid, setAppConfig: setAppConfig, getAppConfig: getAppConfig, setCarImages: setCarImages, getCarImages: getCarImages, setSelectedDeviceInfo: setSelectedDeviceInfo, getSelectedDeviceInfo: getSelectedDeviceInfo, setCabinetInfo: setCabinetInfo, getCabinetInfo: getCabinetInfo, setUserCurrentLocation: setUserCurrentLocation, getUserCurrentLocation: getUserCurrentLocation, setShareCode: setShareCode, getShareCode: getShareCode, setIsLocationAuth: setIsLocationAuth, getIsLocationAuth: getIsLocationAuth, getIsBuyModel:getIsBuyModel, setIsBuyModel:setIsBuyModel };