import { QINIU_URL } from '@/common/constant' import i18n from '../locale/index.js' // 存储 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'; const FUNCTIONTAG = 'FUNCTIONTAG' const ICONS = { lock: `${QINIU_URL}FgMCTZCySvEgLYgkzU65BUR4f4Ls`, edit: `${QINIU_URL}Fq3V1Zi5tKH7ibTwG1nO7N96CU8m`, add: `${QINIU_URL}FqLEWbMe8DcnQtNz6GdDDD87ObZK`, placeholder: `${QINIU_URL}FpKvfFNSDbx0d9RDwyGAQdFb7Kt6` } // { // name: i18n.t('开机'), // type:'turnOnOrOff', // iconUrl: `${QINIU_URL}Fp5T9lSNakoiioji6S7W4DmFQ_ys`, // offUrl: `${QINIU_URL}FqxGx0H169EOJN0__Ym2Ls8x2i03`, // isLock: true, // isTurnOn:1 // }, const activeTabs = [ { name: i18n.t('闪灯鸣笛'), type:'findCar', iconUrl: `${QINIU_URL}FpeQsDh2dbeTullNLI-HhWj4WAQS` }, { name: i18n.t('打开座桶'), type:'openSeatBag', iconUrl: `${QINIU_URL}FppwhbFzrEmDeJQgZJtDTu6WOoMZ` }, { name: i18n.t('打开尾箱'), type:'openTailBox', iconUrl: `${QINIU_URL}Fv3KLuYWEeV5IM4_2sMbmur7yZtz` }, { name:i18n.t('胎压'), type:'tirePressure', url:'', iconUrl: `${QINIU_URL}FmbcjmvoB4J3CT1hrbjNX4kxv9Zq` } ] const toBeSelectTabs = [{ name: i18n.t('电池信息'), type:'batteryInfo', url:'/pages/batteryDetail/batteryDetail', iconUrl: `${QINIU_URL}Fnx_4tLoq1ytvVA0UemepWisI73A` }, { name: i18n.t('导航'), type:'navigation', url:'', iconUrl: `${QINIU_URL}FrA_ouJtDp-39g7rMBI0EYr2czVE` } ] function setFunctionTag(tag = {}) { uni.setStorageSync(FUNCTIONTAG, tag); } function getFunctionTag() { let list = uni.getStorageSync(FUNCTIONTAG) || { activeTag:activeTabs, tag:toBeSelectTabs, } return list } 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 removeUserToken() { uni.removeStorageSync(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) || { longitude: "115.853024", latitude: "28.686280" }; } 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 = { removeUserToken, setFunctionTag, getFunctionTag, 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 };