From cf0d36bbe155ecdfd8bca429666405e830d0dc7a Mon Sep 17 00:00:00 2001
From: XIGUASSR <623844246@qq.com>
Date: Sat, 12 Nov 2022 04:22:49 +0800
Subject: [PATCH] 最新
---
src/components/loginDialog.vue | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/components/loginDialog.vue b/src/components/loginDialog.vue
index f521f0a..730711c 100644
--- a/src/components/loginDialog.vue
+++ b/src/components/loginDialog.vue
@@ -30,6 +30,8 @@
</template>
<script>
+import * as api from "@/axios/api";
+
export default {
name: "dialogVisible",
data() {
@@ -40,9 +42,7 @@
},
mounted() {
if (!this.routeShowPathArr.includes(this.$route.path)) { // 查找不弹出的path
- setTimeout(() => {
- this.dialogVisible = true;
- }, 1000);
+ this.getUserInfo();
}
},
methods: {
@@ -53,7 +53,19 @@
goToReg() {
this.dialogVisible = false;
this.$router.push('/register');
- }
+ },
+ async getUserInfo() {
+ // 获取用户信息
+ let data = await api.getUserInfo();
+ if (data.status === 0) {
+ // 判断是否登录
+ this.dialogVisible = false;
+ } else {
+ setTimeout(() => {
+ this.dialogVisible = true;
+ }, 1000);
+ }
+ },
}
};
</script>
--
Gitblit v1.9.3