refactor(user): 重构用户信息获

This commit is contained in:
rd
2025-09-19 09:40:06 +08:00
parent 55b4ed1e83
commit 192a125d01
6 changed files with 21 additions and 12 deletions

View File

@ -105,7 +105,7 @@
import { Button, Checkbox, Form, FormItem, Input, message, Tabs, Typography } from 'ant-design-vue';
import PuzzleVerification from '../PuzzleVerification.vue';
import SelectAccountModal from '../select-account-modal/index.vue';
import { fetchAuthorizationsCaptcha, fetchLoginCaptCha, fetchProfileInfo, postLoginPassword } from '@/api/all/login';
import { fetchAuthorizationsCaptcha, fetchLoginCaptCha, fetchUserInfo, postLoginPassword } from '@/api/all/login';
import { postClearRateLimiter } from '@/api/all/common';
import { joinEnterpriseByInviteCode } from '@/api/all';
import { computed, onUnmounted, reactive, ref } from 'vue';
@ -268,7 +268,7 @@ const onTabChange = () => {
// 获取用户信息
const getProfileInfo = async () => {
const { code, data } = await fetchProfileInfo();
const { code, data } = await fetchUserInfo();
if (code === 200) {
const enterprises = data['enterprises'];
mobileNumber.value = data['mobile'];
@ -283,6 +283,7 @@ const getProfileInfo = async () => {
selectAccountModalRef.value.open();
}
} else {
userStore.setUserInfo(data);
router.push({ name: 'Trial' });
}
}

View File

@ -92,7 +92,7 @@ import PuzzleVerification from '../PuzzleVerification.vue';
import SelectAccountModal from '../select-account-modal/index.vue';
import { postClearRateLimiter } from '@/api/all/common';
import {
fetchProfileInfo,
fetchUserInfo,
postForgetPassword,
postForgetPasswordCaptcha,
postRegister,
@ -295,8 +295,9 @@ const handleVerificationSubmit = async () => {
// 获取用户信息
const getProfileInfo = async () => {
const { code, data } = await fetchProfileInfo();
const { code, data } = await fetchUserInfo();
if (code === 200) {
const enterprises = data['enterprises'];
mobileNumber.value = data['mobile'];
accounts.value = enterprises;
@ -311,6 +312,7 @@ const getProfileInfo = async () => {
selectAccountModalRef.value.open();
}
} else {
userStore.setUserInfo(data);
router.push({ name: 'Trial' });
}
}
@ -348,7 +350,7 @@ const handleSubmit = async () => {
}, 1500);
return;
}
;
userStore.setToken(data.access_token);