<script setup lang='ts'>
import { user } from '~/store/user'

const router = useRouter()

const NavList = [
  {
    id: '/',
    label: '直播课程',
  },
  {
    id: '/jchf',
    label: '精彩回放',
  },
  {
    id: '/xbkc',
    label: '小班课程',
  },
  {
    id: '/xlkc',
    label: '系列课程',
  },
  {
    id: `${location.origin}/page/task.html`,
    label: '精准教学',
  },
  {
    id: `https://qqyxt.bozedu.net/transfer.html?from=jlt&js_code=ycxckt&url_to=/page/teacherStudio.html&mode=group&appname=%E5%90%8D%E5%B8%88%E5%B7%A5%E4%BD%9C%E5%AE%A4&token=${user.token}`,
    label: '名师工作室'
  }
]

function browserOpen(path: string, flag?: boolean) {
  if (path.startsWith('http') || flag)
    window.open(path, '_self')
  else
    router.push(path)
}
// @click="browserOpen(`https://openapi.bozedu.net/login.html?token=${user.token}`)"
function openBlank(path: string) {
  window.open(path, '_blank')
}
</script>

<template>
  <div class="h-100px flex items-center justify-center">
    <div class="w-1200px flex justify-between">
      <div class="flex items-center text-3xl space-x-3">
        <img src="/logo.png" alt="" class="h-36px w-36px">
        <div>宜昌市乡村教育振兴网络扶智课堂</div>
      </div>

      <div>
        <el-dropdown trigger="click">
          <div class="cursor-pointer">
            <img class="inline-block h-20px w-20px rounded-1/2 align-middle hover:bg-hex-1259A110 hover:text-hex-1259A1"
              :src="user?.user_avatar?.small || undefined" alt="">
            <div class="ml-10px inline-block align-middle">
              {{ user.user_realname }}
            </div>
          </div>
          <template #dropdown>
            <el-dropdown-menu v-if="user.user_role_id !== '76'">
              <el-dropdown-item
                @click="browserOpen('https://ycxcktapi.bozedu.net/index.php?mod=index&action=index&do=index')">
                后台管理
              </el-dropdown-item>
              <el-dropdown-item
                @click="browserOpen(`https://uc.bozedu.net/webapps/page/glzx.html?type=xuexiao&token=${user.token}`)">
                个人中心
              </el-dropdown-item>
              <el-dropdown-item @click="browserOpen(`https://stat.bozedu.net?token=${user.token}`)">
                数据分析
              </el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
        <div class="text-xs">
          扶智平台账号： {{ user.user_name }}
        </div>
      </div>
    </div>
  </div>
  <div class="flex items-center justify-center bg-blue-600 text-lg text-light-50">
    <div class="w-1200px flex">
      <div v-for="item in NavList" :key="item.id"
        class="h-64px w-120px cursor-pointer text-center leading-64px hover:bg-blue-500" @click="browserOpen(item.id)">
        {{ item.label }}
      </div>

    </div>
  </div>
  <div class="flex justify-center bg-hex-f4f4f5">
    <el-alert type="info" show-icon :closable="false" class="w-1200px">
      <template #title>
        <div class="space-x-36">
          <el-link
            @click='openBlank("https://ossdownload.bozedu.net/data/ycxckt/%E5%85%B3%E4%BA%8E%E5%BC%80%E5%B1%952023%E5%B9%B4%E5%85%A8%E5%B8%82%E5%9C%A8%E7%BA%BF%E6%95%99%E8%82%B2%E6%89%B6%E6%99%BA%E8%AF%BE%E5%A0%82%EF%BC%88%E7%AC%AC%E4%B8%80%E6%9C%9F%EF%BC%89%E6%B4%BB%E5%8A%A8%E7%9A%84%E9%80%9A%E7%9F%A5.pdf")'>关于开展2023年全市在线教育扶智课堂（第一期）活动的通知</el-link>
          <el-link
            @click='openBlank("https://ossdownload.bozedu.net/data/ycxckt/%E5%85%B3%E4%BA%8E%E5%BC%80%E5%B1%952023%E5%B9%B4%E5%85%A8%E5%B8%82%E5%9C%A8%E7%BA%BF%E6%95%99%E8%82%B2%E6%89%B6%E6%99%BA%E8%AF%BE%E5%A0%82%EF%BC%88%E7%AC%AC%E4%BA%8C%E6%9C%9F%EF%BC%89%E6%B4%BB%E5%8A%A8%E7%9A%84%E9%80%9A%E7%9F%A5.pdf")'>关于开展2023年全市在线教育扶智课堂（第二期）活动的通知</el-link>
        </div>
        <!-- <el-carousel indicator-position="none" arrow="never" height="20px" class="w-1200px" autoplay>
          <el-carousel-item>
            <el-link
              href="https://ossdownload.bozedu.net/data/ycxckt/%E5%85%B3%E4%BA%8E%E5%BC%80%E5%B1%952023%E5%B9%B4%E5%85%A8%E5%B8%82%E5%9C%A8%E7%BA%BF%E6%95%99%E8%82%B2%E6%89%B6%E6%99%BA%E8%AF%BE%E5%A0%82%EF%BC%88%E7%AC%AC%E4%B8%80%E6%9C%9F%EF%BC%89%E6%B4%BB%E5%8A%A8%E7%9A%84%E9%80%9A%E7%9F%A5.pdf">关于开展2023年全市在线教育扶智课堂（第一期）活动的通知</el-link>
          </el-carousel-item>
          <el-carousel-item>
            <el-link
              href="https://ossdownload.bozedu.net/data/ycxckt/%E5%85%B3%E4%BA%8E%E5%BC%80%E5%B1%952023%E5%B9%B4%E5%85%A8%E5%B8%82%E5%9C%A8%E7%BA%BF%E6%95%99%E8%82%B2%E6%89%B6%E6%99%BA%E8%AF%BE%E5%A0%82%EF%BC%88%E7%AC%AC%E4%BA%8C%E6%9C%9F%EF%BC%89%E6%B4%BB%E5%8A%A8%E7%9A%84%E9%80%9A%E7%9F%A5.pdf">关于开展2023年全市在线教育扶智课堂（第二期）活动的通知</el-link>
          </el-carousel-item>
          <el-carousel-item>
            <el-link
              href="https://ossdownload.bozedu.net/data/ycxckt/%E5%85%B3%E4%BA%8E%E5%BC%80%E5%B1%952023%E5%B9%B4%E5%85%A8%E5%B8%82%E5%9C%A8%E7%BA%BF%E6%95%99%E8%82%B2%E6%89%B6%E6%99%BA%E8%AF%BE%E5%A0%82%EF%BC%88%E7%AC%AC%E4%B8%80%E6%9C%9F%EF%BC%89%E6%B4%BB%E5%8A%A8%E7%9A%84%E9%80%9A%E7%9F%A5.pdf">关于开展2023年全市在线教育扶智课堂（第一期）活动的通知</el-link>
          </el-carousel-item>
          <el-carousel-item>
            <el-link
              href="https://ossdownload.bozedu.net/data/ycxckt/%E5%85%B3%E4%BA%8E%E5%BC%80%E5%B1%952023%E5%B9%B4%E5%85%A8%E5%B8%82%E5%9C%A8%E7%BA%BF%E6%95%99%E8%82%B2%E6%89%B6%E6%99%BA%E8%AF%BE%E5%A0%82%EF%BC%88%E7%AC%AC%E4%BA%8C%E6%9C%9F%EF%BC%89%E6%B4%BB%E5%8A%A8%E7%9A%84%E9%80%9A%E7%9F%A5.pdf">关于开展2023年全市在线教育扶智课堂（第二期）活动的通知</el-link>
          </el-carousel-item>
        </el-carousel> -->
      </template>
    </el-alert>
  </div>
</template>
