<template>
    <div id="app">
        <router-view/>
    </div>
</template>

<script>
import {Logout} from "@/api/permission";
export default {
  methods: {
    logout() {
      Logout().then(res => {
        this.$keycloak.logout();
        this.$message({
          message: res.msg,
          type: 'success',
          showClose: true,
          duration: 24 * 60 * 1000
        });
      });
    }
  },
  mounted() {
    // 添加 beforeunload 事件监听器
    window.addEventListener('beforeunload', this.logout);
    const userAgent = navigator.userAgent;
    console.log('User Agent:', userAgent);
  }
}
</script>

<style lang="scss">
#app {
  height: 100%;
}
</style>
