功能:重建指尖管理师规划系统
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Purpose: STORAGE_KEYS supports storage.js by holding or executing the storage keys page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const STORAGE_KEYS = {
|
||||
ACCESS_TOKEN: 'adminAccessToken',
|
||||
REFRESH_TOKEN: 'adminRefreshToken',
|
||||
USER_INFO: 'adminUserInfo',
|
||||
PERMISSIONS: 'adminPermissions',
|
||||
CURRENT_SHOP: 'adminCurrentShop',
|
||||
DEVICE_ID: 'adminMiniDeviceId'
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: TEMP_RECORD_PREFIX supports storage.js by holding or executing the temp record prefix page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const TEMP_RECORD_PREFIX = 'adminTempRecord:'
|
||||
|
||||
/**
|
||||
* Purpose: getStorage supports storage.js by holding or executing the get storage page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function getStorage(key, defaultValue) {
|
||||
try {
|
||||
const value = wx.getStorageSync(key)
|
||||
return value === '' || value === undefined ? defaultValue : value
|
||||
} catch (error) {
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: setStorage supports storage.js by holding or executing the set storage page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function setStorage(key, value) {
|
||||
wx.setStorageSync(key, value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: removeStorage supports storage.js by holding or executing the remove storage page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function removeStorage(key) {
|
||||
wx.removeStorageSync(key)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: setTempRecord supports storage.js by holding or executing the set temp record page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function setTempRecord(name, value) {
|
||||
setStorage(`${TEMP_RECORD_PREFIX}${name}`, value)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: getTempRecord supports storage.js by holding or executing the get temp record page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function getTempRecord(name, defaultValue) {
|
||||
return getStorage(`${TEMP_RECORD_PREFIX}${name}`, defaultValue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: clearTempRecord supports storage.js by holding or executing the clear temp record page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function clearTempRecord(name) {
|
||||
removeStorage(`${TEMP_RECORD_PREFIX}${name}`)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
STORAGE_KEYS,
|
||||
getStorage,
|
||||
setStorage,
|
||||
removeStorage,
|
||||
setTempRecord,
|
||||
getTempRecord,
|
||||
clearTempRecord
|
||||
}
|
||||
Reference in New Issue
Block a user