XIGUASSR
2022-11-12 cf0d36bbe155ecdfd8bca429666405e830d0dc7a
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>