Browse Source

修改首页没登不调用接口

plg 1 month ago
parent
commit
61ea7e028d
1 changed files with 14 additions and 9 deletions
  1. 14 9
      src/views/HomeView.vue

+ 14 - 9
src/views/HomeView.vue

@@ -80,16 +80,21 @@ onMounted(() => {
 
 //
 const queryIsQuestion = async () => {
-  let res: any = await queryIsQuestionApi()
-  console.log("res")
-  planId.value = res.data;
-  if (planId.value == null) {
-    //设置标识不显示
-    isNeed.value = false
-  } else {
-    //设置标志显示
-    isNeed.value = true
+  //判断用户是否登录
+  if (userInfo.token) {
+    let res: any = await queryIsQuestionApi()
+    console.log("res")
+    planId.value = res.data;
+    if (planId.value == null) {
+      //设置标识不显示
+      isNeed.value = false
+    } else {
+      //设置标志显示
+      isNeed.value = true
+    }
   }
+
+
 }
 
 //界面销毁函数