Feat: login ok

This commit is contained in:
unitwk 2023-08-23 11:04:39 +08:00
parent c3dc5ce0de
commit 21a6ba64ea
2 changed files with 16 additions and 5 deletions

View File

@ -10,9 +10,11 @@ import { onMounted, ref, unref } from "vue";
import { useAppConfigStore } from "@/stores/useAppConfigStore";
import { useAppStateStore } from "@/stores/useAppStateStore";
import { theme } from "ant-design-vue";
import { message } from "ant-design-vue";
import InputDialogProvider from "./components/InputDialogProvider.vue";
import { userInfoApi } from "./services/apis";
import { t } from "./lang/i18n";
import { router } from "./config/router";
const { getCurrentLanguage, isDarkTheme } = useAppConfigStore();
const { state } = useAppStateStore();
@ -40,11 +42,19 @@ if (isDarkUI) {
const { execute: reqUserInfo, isLoading } = userInfoApi();
onMounted(async () => {
const info = await reqUserInfo();
if (info.value) {
state.userInfo = info.value;
try {
const info = await reqUserInfo();
if (info.value) {
state.userInfo = info.value;
} else {
throw new Error();
}
console.log("用户信息:", state.userInfo);
} catch (error) {
router.push({
path: "/login"
});
}
console.log("用户信息:", state.userInfo);
});
</script>

View File

@ -153,6 +153,7 @@ const loginSuccess = () => {
<a-input
v-model:value="formData.password"
class="mt-20"
type="password"
:placeholder="t('密码')"
size="large"
>