diff --git a/pages/login/redirect-page.vue b/pages/login/redirect-page.vue index 6669a3c..472ae95 100644 --- a/pages/login/redirect-page.vue +++ b/pages/login/redirect-page.vue @@ -94,7 +94,7 @@ async function changeTeam({ teamId, corpId, corpUserId, externalUserId, qrid, re qrid, referenceCustomerId: referenceCustomerId || '' }); - await login() + await login('', { forceVerify: true }) if (account.value && account.value.mobile) { bindTeam({ corpUserId, externalUserId }) } else { diff --git a/store/account.js b/store/account.js index 0718bc5..34b5fdf 100644 --- a/store/account.js +++ b/store/account.js @@ -26,7 +26,7 @@ export default defineStore("accountStore", () => { async function login(phoneCode = '', options = {}) { if (loading.value) return; - if (account.value && account.value.mobile) { + if (account.value && account.value.mobile && !options.forceVerify) { return account.value } loading.value = true; @@ -54,6 +54,12 @@ export default defineStore("accountStore", () => { // initIMAfterLogin(openid.value) return normalizedAccount + } else { + account.value = null; + openid.value = ''; + uni.removeStorageSync('account'); + uni.removeStorageSync('openid'); + return } } if (!options.silent) toast('登录失败,请重新登录'); @@ -154,9 +160,9 @@ export default defineStore("accountStore", () => { const unionid = account.value?.unionid; const openid = account.value?.openid; if (!(normalizedCorpId && unionid && openid)) { - externalUserId.value = ''; - return - }; + externalUserId.value = ''; + return + }; const res = await api('getUnionidToExternalUserid', { unionid, openid, corpId: normalizedCorpId }, false); const id = res && res.success && typeof res.data === 'string' && res.data.trim() ? res.data.trim() : ''; externalUserId.value = id;