<script setup lang='ts'>
const router = useRouter()
const LoginFormRef = $ref()
function handleLogin() {
  console.log('handleLogin', LoginFormRef)
  LoginFormRef.open()
}
function routerPush(path: string) {
  if (sessionStorage.getItem('userInfo'))
    router.push(path)

  else
    handleLogin()
}
function toTyyx() {
  location.href = window.GLOBAL_CONFIG.tyyx
}
</script>

<template>
  <div class="flex items-center divide-x-1 text-hex-707070 text-xl">
    <div
      class="px-4 py-5 hover:text-hex-1259A1 hover:bg-hex-1259A110 cursor-pointer"
      @click="routerPush('/home')"
    >
      首页
    </div>
    <el-popover
      placement="bottom"
      :width="150"
      trigger="hover"
      popper-style="--el-popover-padding:0px"
    >
      <template #reference>
        <div
          class="px-4 py-5 hover:text-hex-1259A1 hover:bg-hex-1259A110 cursor-pointer"
        >
          名师
        </div>
      </template>

      <div class="flex flex-col">
        <div
          class="px-2 py-3 text-center hover:bg-hex-1259A1 hover:text-white cursor-pointer"
          @click="routerPush('/home_mszx')"
        >
          名师在线
        </div>
        <div
          class="px-2 py-3 text-center hover:bg-hex-1259A1 hover:text-white cursor-pointer"
          @click="routerPush('/home_tjkc')"
        >
          推荐课程
        </div>
        <div
          class="px-2 py-3 text-center hover:bg-hex-1259A1 hover:text-white cursor-pointer"
          @click="routerPush('/home_msgzs')"
        >
          名师工作室
        </div>
      </div>
    </el-popover>

    <div
      class="px-4 py-5 hover:text-hex-1259A1 hover:bg-hex-1259A110 cursor-pointer"
    >
      同步课堂
    </div>
    <div
      class="px-4 py-5 hover:text-hex-1259A1 hover:bg-hex-1259A110 cursor-pointer"
      @click="routerPush('/home_tskc')"
    >
      特色课程
    </div>
    <div
      class="px-4 py-5 hover:text-hex-1259A1 hover:bg-hex-1259A110 cursor-pointer"
      @click="routerPush('/home_zbkc')"
    >
      直播课程
    </div>
    <div
      class="px-4 py-5 hover:text-hex-1259A1 hover:bg-hex-1259A110 cursor-pointer"
      @click="routerPush('/home_zyfd')"
    >
      作业辅导
    </div>
    <div
      class="px-4 py-5 hover:text-hex-1259A1 hover:bg-hex-1259A110 cursor-pointer"
      @click="routerPush('/home_jtjy')"
    >
      家庭教育
    </div>
    <div
      class="px-4 py-5 hover:text-hex-1259A1 hover:bg-hex-1259A110 cursor-pointer" @click="toTyyx"
    >
      桐艺云校
    </div>
  </div>
  <LoginForm ref="LoginFormRef" />
</template>
