<template>
  <div>Home</div>
</template>

<script setup>
  import { ref, inject, onMounted } from 'vue';
  const $http = inject('$http')
  // 注入方法
  const checkLoginStatus = inject('checkLoginStatus');
  checkLoginStatus();


  onMounted(() => {
    getUserInfo();
  })

  // 获取用户登录信息并保存日志
  const getUserInfo = async () => {

    let requestBody = {
      "UserName": localStorage.getItem('username'),
      "Database": localStorage.getItem('selectdb'),
    }
    $http.post('Login/LogRecord', requestBody)
      .then(rs => {
        //console.log(rs)
        if (rs.data.isok) {

        } else {
          console.log(rs.data.message)
        }
      })
      .catch(error => {
        // 处理错误情况
        console.error(error);
      })
  }
</script>

<style scoped>
</style>
