<template>
  <div class="right-section">
    <div class="task-header">
      <div class="task-item">
        <div class="icon">
          <div class="icon1"></div>
        </div>
        <div class="task-text gradient-text">任务下达</div>
      </div>
      <div class="task-item">
        <div class="icon">
          <div class="icon2"></div>
        </div>
        <div class="task-text gradient-text">粤政伊群聊</div>
      </div>
      <div class="task-item">
        <div class="icon">
          <div class="icon3"></div>
        </div>
        <div class="task-text gradient-text">通讯录</div>
      </div>
      <div class="task-item">
        <div class="icon">
          <div class="icon4"></div>
        </div>
        <div class="task-text gradient-text">启动预警</div>
      </div>
      <div class="task-item">
        <div class="icon">
          <div class="icon5"></div>
        </div>
        <div class="task-text gradient-text">知识库</div>
      </div>
      <div class="back-btn">
        <div class="btn-text">返回上级</div>
      </div>
    </div>
    <div class="video-card">
      <div class="title gradient-text">视频监控</div>
      <div class="card-content video-list">
        <div v-for="(item, index) in videoMonitorState.listData" :key="index" class="video-box" @click="showVideoDialog(item)">
          <div class="video-content">
            <div style="width: 550px; height: 300px; position: relative">
              <HKVideo :dot_data="item" :width="550" :height="300" />
              <div class="video-label">
                <span class="label">{{ item.name }}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <JointDuty />
<!--    <div class="message-card">-->
<!--      <div class="title gradient-text">动态消息</div>-->
<!--      <div class="message-menu">-->
<!--        <div :class="menuState.activeIndex === 0 ? 'menu-item menu-active' : 'menu-item'" @click="menuState.activeIndex = 0">消息动态</div>-->
<!--        <div :class="menuState.activeIndex === 1 ? 'menu-item menu-active' : 'menu-item'" @click="menuState.activeIndex = 1">任务跟踪</div>-->
<!--        <div :class="menuState.activeIndex === 2 ? 'menu-item menu-active' : 'menu-item'" @click="menuState.activeIndex = 2">资源调度</div>-->
<!--      </div>-->
<!--      <div v-show="menuState.activeIndex === 0" class="message-content">-->
<!--        <div v-for="(item, index) in menuState.messageData" :key="index" class="message-item">-->
<!--          <i :class="getIconClass(item.type)"></i>-->
<!--          <div class="message-box">-->
<!--            <div :class="getTagClass(item.type)">{{ item.text }}</div>-->
<!--            <div class="message-time">{{ item.time }}</div>-->
<!--          </div>-->
<!--        </div>-->
<!--      </div>-->
<!--    </div>-->
  </div>
  <Dialog v-model="videoMonitorState.showListDialog" title="视频监控">
    <videoList />
  </Dialog>
</template>

<script lang="ts" setup>
import router from '@/router';
import { getEmergencyVideoCata} from '@/api/routineCommandMap';
import JointDuty from '@/views/emergencyCommandMap/RightSection/JointDuty.vue';

const goToHome = () => {
  router.push({ path: '/' });
};
// 视频监控
const videoMonitorState = reactive({
  listData: [],
  showListDialog: false,
  showDetailDialog: false,
  detailData: { name: '', url: '' }
});
// 显示视频列表
const showVideoMonitorList = () => {
  videoMonitorState.showListDialog = true;
};
// 显示视频弹窗
const showVideoDialog = (item) => {
  videoMonitorState.detailData = item;
  videoMonitorState.showDetailDialog = true;
};

// 动态消息
const menuState = reactive({
  activeIndex: 0,
  // type 1success 2 primary 3 warning 4danger
  messageData: []
});
// 获取消息动态图标
const getIconClass = (type) => {
  let className = 'message-primary';
  if (type === '1') {
    className = 'message-success';
  } else if (type === '2') {
    className = 'message-primary';
  } else if (type === '3') {
    className = 'message-warning';
  } else if (type === '4') {
    className = 'message-danger';
  }
  return className;
};
// 获取消息动态tag
const getTagClass = (type) => {
  let className = 'tag-primary';
  if (type === '1') {
    className = 'tag-success';
  } else if (type === '2') {
    className = 'tag-primary';
  } else if (type === '3') {
    className = 'tag-warning';
  } else if (type === '4') {
    className = 'tag-danger';
  }
  return className
};

// 初始化数据
const initData = () => {
  // 预案管理数据
  getEmergencyVideoCata({
    current: 1,
    size: 8
  }).then((res) => {
    videoMonitorState.listData = res.rows;
  });
  // 动态消息
  menuState.messageData = [
    { type: '1', text: '结束处置', time: '2024-07-04 13:25:49' },
    { type: '2', text: '发起粤政易群聊', time: '2024-07-04 13:25:49' },
    { type: '3', text: '发起视频会商', time: '2024-07-04 13:25:49' },
    { type: '4', text: '启动二级响应预案', time: '2024-07-04 13:25:49' },
    { type: '4', text: '事件接报，详情：广东省茂名市茂南区东荟城发生洪涝灾害', time: '2024-07-04 13:25:49' }
  ];
};


onMounted(() => {
  initData();
});
</script>

<style lang="scss" scoped>
.right-section {
  width: 2668px;
  height: 100%;
  display: flex;
  flex-direction: column;
  font-size: 74px;
  padding-top: 57px;
  .task-header {
    display: flex;
    justify-content: space-around; /* 使按钮在div内均匀分布 */
    align-items: center; /* 使按钮垂直居中 */
    width: 100%;
    margin-bottom: 62px;
    .task-item {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      .icon {
        position: relative;
        width: 170px;
        height: 170px;
        //padding-left: 60px;
      }
      .icon1,
      .icon2,
      .icon3,
      .icon4,
      .icon5 {
        position: absolute;
        width: 224px;
        height: 238px;
      }
      .icon1 {
        background: url('@/assets/images/emergencyCommandMap/icon1.png') no-repeat 100% 100%;
      }
      .icon2 {
        background: url('@/assets/images/emergencyCommandMap/icon2.png') no-repeat 100% 100%;
      }
      .icon3 {
        background: url('@/assets/images/emergencyCommandMap/icon3.png') no-repeat 100% 100%;
      }
      .icon4 {
        background: url('@/assets/images/emergencyCommandMap/icon4.png') no-repeat 100% 100%;
      }
      .icon5 {
        background: url('@/assets/images/emergencyCommandMap/icon5.png') no-repeat 100% 100%;
      }
      .task-text gradient-text {
        font-size: 60px !important;
      }
    }
    .back-btn {
      width: 521px;
      height: 194px;
      line-height: 175px;
      padding-left: 175px;
      background: url('@/assets/images/emergencyCommandMap/backBtn.png') no-repeat 100% 100%;
      .btn-text {
        font-family: 'SourceHanSansCN';
        font-size: 48px;
        /* 设置字体透明 */
        color: transparent;
        /* 设置线性渐变，从红色渐变到蓝色 */
        background-image: linear-gradient(to right, #fff 40%, #b7ddfd 50%, #82c5fd 100%);
        /* 使用 -webkit-background-clip 属性将背景剪裁至文本形状 */
        -webkit-background-clip: text;
        /* 非Webkit内核浏览器需要使用标准前缀 */
        background-clip: text;
        /* 把当前元素设置为行内块，以便能够应用背景 */
        display: inline-block;
      }
    }
  }
  .video-card {
    width: 2601px;
    height: 879px;
    background: url('@/assets/images/emergencyCommandMap/videoBox1.png') no-repeat 100% 100%;
    position: relative;
    .video-list {
      display: flex;
      flex-wrap: wrap;
      padding-top: 100px;
      padding-left: 60px;
      .video-box {
        width: 600px;
        height: 356px;
        margin-right: 35.06px;
        cursor: pointer;

        background: url('@/assets/images/emergencyCommandMap/videoBg.png') no-repeat 100% 100%;
        padding: 14.5px 9px;
        &:nth-child(1),
        &:nth-child(2),
        &:nth-child(3),
        &:nth-child(4) {
          margin-bottom: 3.5px;
        }
        &:nth-child(4),
        &:nth-child(8) {
          margin-right: 0;
        }
        .video-content {
          width: 582px;
          height: 327px;
          background: url('@/assets/images/emergencyCommandMap/videoBox2.png') no-repeat 100% 100%;
          display: flex;
          justify-content: center;
          align-items: center;
          position: relative;
        }
        .video-label {
          position: absolute;
          bottom: 0;
          right: 0;

          display: flex;
          .label {
            width: 410px;
            height: 50px;
            line-height: 50px;
            font-size: 32px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            padding-left: 10px;
            color: #fff;
            background-color: rgba(0, 0, 0, 0.4);
          }
          &::before {
            content: '';
            width: 0;
            height: 0;
            border-bottom: 50px solid rgba(0, 0, 0, 0.4);
            border-left: 50px solid transparent;
          }
        }
      }
    }
  }
  .message-card {
    width: 2668px;
    height: 884px;
    background: url('@/assets/images/emergencyCommandMap/messageBox.png') no-repeat 100% 100%;
    position: relative;
    padding-bottom: 40px;
  }
  .title {
    position: absolute;
    top: 6px;
    left: 141px;
    font-size: 60px;
  }
  .message-menu {
    display: flex;
    margin-top: 95px;
    margin-left: 50px;
    .menu-item {
      width: 349px;
      height: 118px;
      padding-left: 68px;
      line-height: 145px;
      background: url('@/assets/images/emergencyCommandMap/tab.png');
      opacity: 0.7;
      font-size: 44px;
      color: #fff;
      font-family: 'YouSheBiaoTiHei';
      cursor: pointer;
      margin-left: -40px;
      &:first-child {
        margin-left: 0;
      }
      &:hover {
        width: 349px;
        height: 122px;
        background: url('@/assets/images/emergencyCommandMap/tabActive.png');
        opacity: 1;
      }
    }
    .menu-active {
      width: 349px;
      height: 122px;
      background: url('@/assets/images/emergencyCommandMap/tabActive.png');
      opacity: 1;
    }
  }
  .message-content {
    margin-left: 155px;
    overflow: auto;
    height: 625px;
    .message-item {
      display: flex;
      align-items: center;
      margin-top: 11.5px;
      .message-success {
        width: 115px;
        height: 114px;
        background: url('@/assets/images/emergencyCommandMap/message_success.png') no-repeat;
      }
      .message-primary {
        width: 115px;
        height: 114px;
        background: url('@/assets/images/emergencyCommandMap/message_primary.png') no-repeat;
      }
      .message-warning {
        width: 115px;
        height: 114px;
        background: url('@/assets/images/emergencyCommandMap/message_warning.png') no-repeat;
      }
      .message-danger {
        width: 111px;
        height: 112px;
        background: url('@/assets/images/emergencyCommandMap/message_danger.png') no-repeat;
      }
      .message-box {
        width: 2136px;
        min-height: 114px;
        background: url('@/assets/images/emergencyCommandMap/messagBox2.png') no-repeat;
        margin-left: -30px;
        color: #fff;
        font-size: 38px;
        font-family: 'PingFang SC', sans-serif;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 320px 0 78px;
        .tag-success {
          border-radius: 15px;
          background: #104f72;
          padding: 10px 15px;
        }
        .tag-primary {
          border-radius: 15px;
          background: #0c3d90;
          padding: 10px 15px;
        }
        .tag-warning {
          border-radius: 15px;
          background: #3a495c;
          padding: 10px 15px;
        }
        .tag-danger {
          border-radius: 15px;
          background: #3b2d65;
          padding: 10px 20px;
        }
        .message-time {
          color: #00e8ff;
          font-family: 'BEBAS-1';
          font-size: 32px;
        }
      }
    }
  }
}

.card {
  width: 100%;
  background-color: #ffffff;
  border-radius: 26px;
  padding: 46px 69px;
  margin-bottom: 69px;
  animation-name: slide;

  .header-container {
    width: 100%;
    display: flex;
    //justify-content: space-between;
    align-items: center;
    padding: 10px;
  }

  .custom-button {
    width: 100px;
    height: 80px;
    font-size: 14px;
  }

  .card-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  &:last-child {
    margin-bottom: 0;
  }

  &:nth-child(1) {
    animation-duration: 0.5s;
  }

  &:nth-child(2) {
    height: 667.5px;
    animation-duration: 1s;
  }

  &:nth-child(3) {
    height: 667.5px;
    animation-duration: 1.5s;
  }
}

@keyframes slide {
  0% {
    transform: translateX(100%);
  }
  80% {
    transform: translateX(-92px);
  }
  100% {
    transform: translateX(0);
  }
}

.more {
  color: #1890ff;
  cursor: pointer;
}


</style>
