<template>
  <div class="header">
    <div class="left">

    </div>
    <div class="right">
      <div class="author">
        <i class="icon el-icon-s-custom" />
        {{ props.name || '' }}
        <el-tag size="small" effect="dark" class="logout" @click="logout">退出</el-tag>
      </div>
    </div>
  </div>
</template>

<script>
import { getCurrentInstance,onMounted } from 'vue'
import { useRouter } from 'vue-router'
export default {
  name: 'Header',
    props:['name'],
  setup (props) {
    const router = useRouter()
     const internalInstance = getCurrentInstance()
    const logout = () => {
      let apiUrl = internalInstance.appContext.config.globalProperties.apiUrl
      localStorage.clear()
      location.href=`http://10.238.0.183/base/ssologin/logout?redirect_uri=${apiUrl}`//新昌内网
      // location.href=`http://61.175.247.164:9366/base/ssologin/logout?redirect_uri=${apiUrl}`//21公司的服务器
    }
    // console.log(props.name)
    return {
      logout,
      props
    }
  }
}
</script>

<style scoped>
.header {
  height: 85px;
  /* border-bottom: 1px solid #e9e9e9; */
  box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
}

.right > div > .icon {
  font-size: 18px;
  margin-right: 6px;
}
.logout {
  cursor: pointer;
  margin-left: 10px;
  line-height: 24px;
}
.author{
  display: flex;
  align-items: center;
}
</style>