Эх сурвалжийг харах

修改首页没登不调用接口

plg 1 сар өмнө
parent
commit
61ea7e028d
1 өөрчлөгдсөн 14 нэмэгдсэн , 9 устгасан
  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
+    }
   }
+
+
 }
 
 //界面销毁函数