<template>
  <div class="main">
    <el-row>
      <el-col :span="24" class="animate__animated animate__backInRight" v-loading="loading">
        <div class="head clearfix">
          <h1 class="pulll_left">产业孵化大脑</h1>
          <div class="menu menu2 pulll_left">
            <ul>
              <li><a @click="toChange" href="#">返回</a></li>
              <li><a @click="selectMenu('four')" href="#">信息检索</a></li>
              <li><a @click="selectMenu('five')" href="#">双创活动</a></li>
              <li><a @click="selectMenu('six')" href="#">中试平台</a></li>
              <li><a @click="selectMenu('seven')" href="#">服务支撑</a></li>
              <li><a @click="selectMenu('eight')" href="#">产业集群</a></li>
              <li><a @click="selectMenu('nine')" href="#">成果展示</a></li>
              <li><a @click="selectMenu('ten')" href="#">信息库</a></li>
              <li><a @click="selectMenu('eleven')" href="#">孵化器</a></li>
            </ul>
          </div>
          <div class="time">{{ formattedTime }}</div>
        </div>
        <div class="mainbox">
          <el-row :gutter="20">
            <el-col :span="6">
              <div class="center_1">
                <div class="box">
                  <div class="tit">各类用户人数</div>
                  <div class="boxnav" style="height: 340px">
                    <div class="yqlist">
                      <ul class="clearfix">
                        <li>
                          <div class="yq" id="yq">2634</div>
                          <span>正在线人数(1)</span>
                        </li>
                        <li>
                          <div class="yq">567</div>
                          <span>对接人数(2)</span>
                        </li>
                        <li>
                          <div class="yq">56345</div>
                          <span>浏览人数(3)</span>
                        </li>
                        <li>
                          <div class="yq">721</div>
                          <span>用户总数(4)</span>
                        </li>
                      </ul>
                    </div>
                  </div>
                </div>
                <div class="box">
                  <div class="tit">专家分布地区</div>
                  <div class="boxnav">
                    <echarts1></echarts1>
                  </div>
                </div>
              </div>
            </el-col>
            <el-col :span="12">
              <div class="center_1">
                <div class="box">
                  <div class="boxnav mapc" style="position: relative">
                    <map1 class="map"></map1>
                  </div>
                </div>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="center_1">
                <div class="box">
                  <div class="tit">赛事总数及各阶段数量</div>
                  <echarts3></echarts3>
                </div>
                <div class="box">
                  <div class="tit">数据统计</div>
                  <echarts4></echarts4>
                </div>
              </div>
            </el-col>
          </el-row>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script setup>
const toChange = inject('toChange')
const selectMenu = inject('selectMenu')
import echarts1 from './path/echarts1.vue'
// import echarts2 from './path/echarts2.vue'
import map1 from './path/map.vue'
import echarts3 from './path/echarts3.vue'
import echarts4 from './path/echarts4.vue'
// 加载中
const loading = ref(false)
// 时间
const formattedTime = ref('')
// 请求
onMounted(async () => {
  loading.value = true
  await updateTime()
  loading.value = false
})
// 创建一个函数来格式化时间并更新状态
const updateTime = () => {
  const now = new Date()
  const options = {
    year: 'numeric',
    month: '2-digit',
    day: '2-digit',
    hour: '2-digit',
    minute: '2-digit',
    second: '2-digit',
    hour12: false
  }
  formattedTime.value = now.toLocaleString('zh-CN', options)
}

const timer = setInterval(updateTime, 1000)

onMounted(() => {
  timer // 开始计时器
})

onBeforeUnmount(() => {
  clearInterval(timer) // 组件卸载前清除计时器
})
</script>
<style scoped lang="scss">
.main {
  height: 100vh;
  width: 100%;
  position: relative;
  background: url('./images/bg.png');
  background-size: 100% 100%;
  padding: 0px;
  margin: 0px;
  color: #fff;
  font-family: '微软雅黑';
  cursor: default; /* 将鼠标样式更改为箭头 */
  /* CSS Document */
  * {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
  }
  li {
    list-style-type: none;
  }
  i {
    margin: 0px;
    padding: 0px;
    text-indent: 0px;
  }
  img {
    border: none;
    max-width: 100%;
  }
  a {
    text-decoration: none;
    color: #fff;
  }
  a.active,
  a:focus {
    outline: none !important;
    text-decoration: none;
  }
  ol,
  ul,
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    padding: 0;
    margin: 0;
  }
  a:hover {
    color: #06c;
    text-decoration: none !important;
  }
  .clearfix:after,
  .clearfix:before {
    display: table;
    content: ' ';
  }
  .clearfix:after {
    clear: both;
  }
  .pulll_left {
    float: left;
  }
  .pulll_right {
    float: right;
  }
  i {
    font-style: normal;
  }
  .text-w {
    color: #ffe400;
  }
  .text-d {
    color: #ff6316;
  }
  .text-s {
    color: #14e144;
  }
  .text-b {
    color: #07e5ff;
  }

  .head {
    position: relative;
    height: 4rem;
    margin: 0 15px;
  }
  .head h1 {
    text-align: center;
    line-height: 4rem;
    padding-right: 35px;
    color: #daf9ff;
  }
  .head .menu ul {
    font-size: 0;
  }
  .head .menu {
    margin: 10px 0 0 0;
  }

  .head .menu li {
    display: inline-block;
    position: relative;
    margin: 10px 15px;
  }
  .head .menu li a {
    display: block;
    font-size: $global-font-size-20;
    color: #fff;
    line-height: 30px;
    padding: 0 10px;
  }
  .head .time {
    position: absolute;
    right: 0;
    line-height: 4rem;
    top: 0;
    color: #fff;
  }

  .menu li:before,
  .menu li:after {
    position: absolute;
    width: 10px;
    height: 5px;
    opacity: 0.4;
    content: '';
    border-top: 2px solid #02a6b5;
    top: -1px;
    border-radius: 2px;
  }
  .menu li:before,
  .menu li a:before {
    border-left: 2px solid #02a6b5;
    left: -1px;
  }
  .menu li:after,
  .menu li a:after {
    border-right: 2px solid #02a6b5;
    right: -1px;
  }
  .menu li a {
    position: relative;
  }
  .menu li a:before,
  .menu li a:after {
    position: absolute;
    width: 10px;
    height: 5px;
    opacity: 0.4;
    content: '';
    border-bottom: 2px solid #02a6b5;
    bottom: -1px;
    border-radius: 2px;
  }

  .head .menu li a:hover {
    color: #f4e925;
  }
  .menu li a:hover:before,
  .menu li a:hover:after,
  .menu li:hover:before,
  .menu li:hover:after {
    border-color: #f4e925;
    opacity: 1;
  }

  .mainbox {
    padding: 10px 10px 0 10px;
  }
  .nav1 {
    margin-left: -6px;
    margin-right: -6px;
  }
  .nav1 > li {
    padding: 0 6px;
    float: left;
  }

  .box {
    border: 1px solid rgba(7, 118, 181, 0.5);
    box-shadow: inset 0 0 10px rgba(7, 118, 181, 0.4);
    margin-bottom: 12px;
    position: relative;
  }
  .tit {
    padding: 10px 10px 10px 25px;
    border-bottom: 1px solid rgba(7, 118, 181, 0.7);
    font-size: $global-font-size-18;
    font-weight: 500;
    position: relative;
  }
  .tit:before,
  .tit01:before {
    position: absolute;
    content: '';
    width: 6px;
    height: 6px;
    background: rgba(22, 214, 255, 0.9);
    box-shadow: 0 0 5px rgba(22, 214, 255, 0.9);
    border-radius: 10px;
    left: 10px;
    top: 18px;
  }

  .tit:after,
  .box:before {
    width: 100%;
    height: 1px;
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    background: linear-gradient(to right, #076ead, #4ba6e0, #076ead);
    box-shadow: 0 0 5px rgba(131, 189, 227, 1);
    opacity: 0.6;
  }
  .box:before {
    top: -1px;
  }

  .boxnav {
    padding: 0 10px;
  }
  .tit01 {
    font-size: $global-font-size-18;
    font-weight: 500;
    position: relative;
    padding-left: 15px;
  }
  .tit01:before {
    left: 3px;
    top: 8px;
  }

  .mapc {
    background: url('./images/bg3.png') no-repeat center center;
    background-size: 100% 100%;
  }
  .map {
    position: relative;
    top: 0;
    left: -8%;
    width: 100%;
  }
  .mapnav {
    position: absolute;
    z-index: 10;
  }

  .yqlist li {
    float: left;
    width: 50%;
    padding: 10px 0;
    text-align: center;
    margin: 20px 0 0 0;
  }
  .yq {
    width: 80px;
    height: 80px;
    margin: 0 auto 5px auto;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: $global-font-size-25;
    font-family: electronicFont;
    color: #fff32b;
  }
  .yqlist li span {
    opacity: 0.6;
    font-size: $global-font-size-16;
  }

  .yq:before {
    position: absolute;
    width: 100%;
    height: 100%;
    content: '';
    background: url('./images/img1.png') center center;
    border-radius: 100px;
    background-size: 100% 100%;
    opacity: 0.3;
    left: 0;
    top: 0;
    animation: myfirst2 15s infinite linear;
  }

  .yq:after {
    position: absolute;
    width: 86%;
    background: url('./images/img2.png') center center;
    border-radius: 100px;
    background-size: 100% 100%;
    opacity: 0.3;
    height: 86%;
    content: '';
    left: 7%;
    top: 7%;
    animation: myfirst 15s infinite linear;
  }

  @keyframes myfirst {
    to {
      transform: rotate(-360deg);
    }
  }
  @keyframes myfirst2 {
    to {
      transform: rotate(360deg);
    }
  }
}
</style>
