Compare commits

..

2 Commits

Author SHA1 Message Date
joylink_fanyuhong
b8d08b40bb Merge branch 'develop' of https://gitea.joylink.club/joylink/xian-ncc-da-client into develop 2024-10-21 14:56:07 +08:00
joylink_fanyuhong
2676d4d1d8 登录流程调整 2024-10-21 14:56:05 +08:00

View File

@ -55,13 +55,16 @@
<script setup lang="ts">
import { useQuasar } from 'quasar';
import { ApiError } from 'src/boot/axios';
import { login } from 'src/api/UserApi';
import { getUserInfo, login } from 'src/api/UserApi';
import { clearJwtToken, saveJwtToken } from 'src/configs/TokenManage';
import { reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
import { useUserStore } from 'src/stores/user-store';
import { handleRefreshToken } from 'src/utils/refreshToken';
const $q = useQuasar();
const router = useRouter();
const userStore = useUserStore();
const loginInfo = reactive({
account: '',
@ -74,6 +77,14 @@ async function doLogin() {
clearJwtToken();
const token = await login(loginInfo);
saveJwtToken(token);
const userInfo = await getUserInfo();
userStore.roles = userInfo.roles;
userStore.defaultRole = userInfo.defaultRole;
userStore.remainingSecond = userInfo.remainingSecond;
setTimeout(
() => handleRefreshToken(),
userInfo.remainingSecond * 1000 - 10000
);
router.push({ name: 'home' });
} catch (err) {
visible.value = false;