功能:新增微信小程序一键登录

This commit is contained in:
xiaowang
2026-04-02 13:20:28 +08:00
parent 8ac7deffca
commit 4f5ef4fedd
32 changed files with 1899 additions and 65 deletions
+15
View File
@@ -16,6 +16,10 @@ function getNeedSetPassword() {
return Boolean(getStorage(STORAGE_KEYS.NEED_SET_PASSWORD, false))
}
function getPreferredMiniLoginShopId() {
return getStorage(STORAGE_KEYS.PREFERRED_MINI_LOGIN_SHOP_ID, '')
}
function isLoggedIn() {
return Boolean(getAccessToken())
}
@@ -64,14 +68,25 @@ function clearSession() {
removeStorage(STORAGE_KEYS.NEED_SET_PASSWORD)
}
function setPreferredMiniLoginShopId(shopId) {
if (shopId === undefined || shopId === null || shopId === '') {
removeStorage(STORAGE_KEYS.PREFERRED_MINI_LOGIN_SHOP_ID)
return
}
setStorage(STORAGE_KEYS.PREFERRED_MINI_LOGIN_SHOP_ID, String(shopId))
}
module.exports = {
getAccessToken,
getRefreshToken,
getStoredUserInfo,
getNeedSetPassword,
getPreferredMiniLoginShopId,
isLoggedIn,
setSession,
updateStoredUserInfo,
setNeedSetPassword,
setPreferredMiniLoginShopId,
clearSession
}