From d8f6c671a613b841566c8d7b1f36eb2bb9640ea9 Mon Sep 17 00:00:00 2001
From: DESKTOP-CVS3R96\我恁爹 <11>
Date: Tue, 15 Nov 2022 04:15:27 +0800
Subject: [PATCH] 多于元

---
 src/components/loginDialog.vue |   48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)

diff --git a/src/components/loginDialog.vue b/src/components/loginDialog.vue
index f521f0a..dd714e7 100644
--- a/src/components/loginDialog.vue
+++ b/src/components/loginDialog.vue
@@ -1,9 +1,9 @@
 <template>
   <div class="login_dialog_pag">
-    <van-popup v-model="dialogVisible" position="bottom" :style="{ height: '50%' }">
+    <van-popup v-model="$store.state.dialogVisible" position="bottom" :close-on-click-overlay="clickOverlay" @click-overlay="overlay" :style="{ height: '50%' }">
       <div class="dialog_content">
         <div class="top_close">
-          <div class="close" @click="dialogVisible = false">
+          <div class="close" @click="close">
             <img src="@/assets/img/close3.png" alt="">
           </div>
         </div>
@@ -30,30 +30,58 @@
 </template>
 
 <script>
+import * as api from "@/axios/api";
+
 export default {
   name: "dialogVisible",
+  props: {
+    // dialogVisible: {
+    //   type: Boolean,
+    //   default: false
+    // }
+  },
   data() {
     return {
-      dialogVisible: false,
-      routeShowPathArr: ['/home']
+      //dialogVisible: false,
+      routeShowPathArr: ['/home'],
+      clickOverlay: false
     };
   },
   mounted() {
     if (!this.routeShowPathArr.includes(this.$route.path)) { // 查找不弹出的path
-      setTimeout(() => {
-        this.dialogVisible = true;
-      }, 1000);
+      this.getUserInfo();
     }
   },
   methods: {
+    close() {
+      this.$emit("close");
+      //dialogVisible = false
+    },
     goToLogin() {
-      this.dialogVisible = false;
+      this.$emit("close");
+      //this.dialogVisible = false;
       this.$router.push('/login')
     },
+    overlay(){
+      this.$emit("close");
+    },
     goToReg() {
-      this.dialogVisible = false;
+      this.$emit("close");
+      //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