功能:改造Salon小程序OpenID快捷登录
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
const SESSION_KEY = 'fingertip_manager_session'
|
||||
const LOGIN_PREFERENCE_KEY = 'jayucloud_salon_login_preference'
|
||||
const PHONE_BANNER_DISMISSED_KEY = 'jayucloud_salon_phone_banner_dismissed'
|
||||
const PROFILE_PROMPT_SKIPPED_KEY = 'jayucloud_salon_profile_prompt_skipped'
|
||||
|
||||
function getSession() {
|
||||
try {
|
||||
@@ -21,9 +24,34 @@ function getAccessToken() {
|
||||
return session.accessToken || session.token || ''
|
||||
}
|
||||
|
||||
function getLoginPreference() {
|
||||
try { return wx.getStorageSync(LOGIN_PREFERENCE_KEY) || {} } catch (error) { return {} }
|
||||
}
|
||||
|
||||
function setLoginPreference(preference) {
|
||||
wx.setStorageSync(LOGIN_PREFERENCE_KEY, preference || {})
|
||||
}
|
||||
|
||||
function clearLoginPreference() {
|
||||
wx.removeStorageSync(LOGIN_PREFERENCE_KEY)
|
||||
}
|
||||
|
||||
function clearDeviceLoginState() {
|
||||
clearSession()
|
||||
clearLoginPreference()
|
||||
wx.removeStorageSync(PHONE_BANNER_DISMISSED_KEY)
|
||||
wx.removeStorageSync(PROFILE_PROMPT_SKIPPED_KEY)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getSession,
|
||||
setSession,
|
||||
clearSession,
|
||||
getAccessToken
|
||||
getAccessToken,
|
||||
getLoginPreference,
|
||||
setLoginPreference,
|
||||
clearLoginPreference,
|
||||
clearDeviceLoginState,
|
||||
PHONE_BANNER_DISMISSED_KEY,
|
||||
PROFILE_PROMPT_SKIPPED_KEY
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user