<script setup lang="ts">
import { useRouter } from 'vue-router'
import { websiteConfig } from '@/config/website.config'
import { storage } from '@/utils/Storage'
import { CURRENT_USER } from '@/store/mutation-types'

defineOptions({ name: 'Index' })

const router = useRouter()

function clickHandler() {
  const userInfo = storage.get(CURRENT_USER)
  if (userInfo && userInfo.frontmenuTList) {
    if (userInfo.frontmenuTList.find(item => item.resUrl == '/home'))
      router.push({ path: '/home' })
  }
}
</script>

<template>
  <div class="logo">
    <img :src="websiteConfig.logo" alt="" @click="clickHandler">
  </div>
</template>

<style lang="less" scoped>
.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  line-height: 64px;
  overflow: hidden;
  white-space: nowrap;

  img {
    width: auto;
    height: 32px;
    cursor: pointer;
  }

  .title {
    margin: 0;
  }
}
</style>
