<template>
  <div class="engine flex h-full w-full flex-col">
    <div class="top-box flex shrink-0 justify-between">
      <div class="tab-box flex items-end gap-5">
        <router-link
          :class="['tab-item', 'top-radius']"
          to="/engine/queueupsystem"
        >
          排队取号系统
        </router-link>
        <router-link
          :class="['tab-item', 'top-radius']"
          to="/engine/evaluatesystem"
        >
          评价系统
        </router-link>
      </div>
      <div class="flex gap-5">
        <div class="search-box top-radius flex h-full items-center gap-5">
          <div class="text-[14px] text-[#395EBF]">
            统计时段：{{ time[0] }}~{{ time[1] }}
          </div>
          <y-date-picker
            v-model="time"
            align="right"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          >
          </y-date-picker>
          <el-button size="small" type="primary" @click="handleDate"
            >搜索</el-button
          >
        </div>
        <div
          class="engine-btn top-radius"
          @click="$router.push('/enginesearch')"
        >
          <img src="@/assets/img/engine.png" class="engine-img mr-2 w-[24px]" />
          数据搜索引擎
        </div>
      </div>
    </div>
    <div class="main w-full flex-1 overflow-auto">
      <router-view ref="Page"></router-view>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      time: [
        this.$moment().format("YYYY-MM-DD"),
        this.$moment().format("YYYY-MM-DD"),
      ],
    };
  },
  watch: {
    "$route.path"() {
      this.$nextTick(() => {
        this.handleDate();
      });
    },
  },
  methods: {
    handleDate() {
      this.$refs.Page.getDate(this.time);
    },
  },
};
</script>

<style lang="less" scoped>
@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }

  95% {
    transform: rotate(30turn);
  }

  100% {
    transform: rotate(30turn);
  }
}
.engine {
  position: relative;
}
.top-box {
  width: 100%;
  height: 48px;
  position: relative;
  z-index: 0;
  .top-radius {
    border-radius: 12px 12px 0px 0px;
  }
}
.tab-box {
  .tab-item {
    height: 70%;
    padding: 0px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
    cursor: pointer;
    transition: height 100ms;
  }
  .router-link-active {
    height: 100%;
    color: var(--primary);
    font-weight: 600;
  }
}
.search-box {
  background-color: #fff;

  padding: 0px 20px;
}
.engine-btn {
  width: 220px;
  color: #fff;
  background: linear-gradient(
    270deg,
    rgba(139, 87, 249, 1) 0%,
    rgba(5, 149, 253, 1) 100%
  );
  font-size: 18px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.main {
  padding: 20px;
  background: #fff;
  border-radius: 0px 0px 4px 4px;
  position: relative;
  box-shadow: 0 -0.25rem 0.25rem rgba(204, 204, 204, 0.3);
  z-index: 10;
}
.engine-img {
  // cubic-bezier(1, 0.05, 0.1, 1)
  animation: rotate 5s cubic-bezier(1, -0.01, 0, 0.97) infinite;
}
</style>
