<template>
  <div class="header">
    <div class="header-left">
      <!-- <div class="header-logo"></div> -->
      <div class="time_date">
        {{ currentDate }} <span>{{ currentTime }}</span>
      </div>
    </div>
    <div class="header-main">
      <div class="textTile">
        <!-- <img src="@/assets/img/title.svg" alt="" /> -->
      </div>
    </div>
    <div class="header-menu">
      <span>{{ leftText }}</span>
      <span style="width: 20px"> | </span>
      <span>{{ rightText }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "header-top",
  components: {},
  props: {
    homeData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      currentTime: "",
      currentDate: "",
      currentDialog: "",
      fromItem: {},
      isAdmins: false,
      leftText: "平台已连接",
      rightText: "定位正常"
    };
  },
  created() {},
  watch: {
    homeData: {
      handler(newVal) {},
      deep: true
    }
  },
  mounted() {
    this.isAdmins = JSON.parse(localStorage.getItem("isAdmin"));
    this.updateTime();
    setInterval(this.updateTime, 1000); // 每秒更新一次时间
  },
  methods: {
    updateTime() {
      const now = new Date();
      this.currentTime = now.toLocaleTimeString(); // 获取当前时间，格式为本地时间格式
      this.currentDate = now.toLocaleDateString(); // 获取当前日期，格式为本地日期格式
    }
  }
};
</script>

<style scoped>
.logo {
  font-size: 20px;
  font-weight: bold;
}

.time {
  font-size: 14px;
}

.actions span {
  margin-left: 10px;
  cursor: pointer;
}
</style>
