perf: 登录逻辑调整

This commit is contained in:
rd
2025-09-11 12:04:54 +08:00
parent 44e1ea9a06
commit 7e6e086098
11 changed files with 103 additions and 104 deletions

View File

@ -108,7 +108,6 @@ import { computed, onUnmounted, reactive, ref } from 'vue';
import { useUserStore } from '@/stores';
import { useEnterpriseStore } from '@/stores/modules/enterprise';
import { handleUserLogin } from '@/utils/user';
import router from '@/router';
import { useRoute } from 'vue-router';
import icon1 from '@/assets/img/login/icon-close.png';
@ -265,24 +264,18 @@ const onTabChange = () => {
const getProfileInfo = async () => {
const { code, data } = await fetchProfileInfo();
if (code === 200) {
userStore.setUserInfo(data);
// 已开通
if (userStore.isOpenEnterprise) {
const enterprises = data['enterprises'];
mobileNumber.value = data['mobile'];
accounts.value = enterprises;
const enterprises = data['enterprises'];
mobileNumber.value = data['mobile'];
accounts.value = enterprises;
if (enterprises.length > 0) {
enterpriseStore.setEnterpriseInfo(data.enterprises[0]);
if (enterprises.length === 1) {
handleUserLogin();
} else {
// 多个企业时候需要弹窗让用户选择企业
selectAccountModalRef.value.open();
}
if (enterprises.length > 0) {
enterpriseStore.setEnterpriseInfo(data.enterprises[0]);
if (enterprises.length === 1) {
handleUserLogin();
} else {
// 多个企业时候需要弹窗让用户选择企业
selectAccountModalRef.value.open();
}
} else {
router.push({ name: 'Trial' });
}
}
};