<template>
  <div class="sksjgl container">
    <div class="server_title">
      <el-image
        style="width: 50%; height: calc(100vh - 120px)"
        src="static/images/sksjgl/sksjgl_title.png"
        fit="cover"
      />
      <div class="server_title_text">
        <div class="server_title_text_title">时空数据管理</div>
        <div class="server_title_text_content">
          二维数据服务是围绕二维地理信息数据展开的综合服务体系。它涵盖以像元阵列形式存储的栅格服务，广泛应用于影像地图展示、地形分析等;通过将地图切割成小图片进行快速加载的瓦片服务，提升地图浏览流畅度;能够精确表达地理要素几何形状和属性的矢量时空数据服务，记录地理对象随时间的变化;以及包含特定主题数据集合的专题库服务，如交通专题库、土地利用专题库等，满足不同行业对特定地理信息的深度挖掘与分析需求，为城市规划、资源管理、环境监测等领域提供有力的数据支撑。
        </div>
      </div>
    </div>
    <div class="checkModule">
      <!-- 流程步骤 -->
      <div class="process-bar">
        <div
          :class="{ 'process-item': true, active: activePanel == 'sjzljc' }"
          @click="changePanel('sjzljc')"
        >
          <div class="icon-box"></div>
          <div class="label">数据质量检查</div>
        </div>
        <div class="divider"></div>
        <div
          :class="{ 'process-item': true, active: activePanel == 'sksjjg' }"
          @click="changePanel('sksjjg')"
        >
          <div class="icon-box"></div>
          <div class="label">时空数据加工</div>
        </div>
        <div class="divider"></div>
        <div
          :class="{ 'process-item': true, active: activePanel == 'sksjgl' }"
          @click="changePanel('sksjgl')"
        >
          <div class="icon-box"></div>
          <div class="label">时空数据管理</div>
        </div>
        <div class="divider"></div>
        <div
          :class="{ 'process-item': true, active: activePanel == 'sksjfb' }"
          @click="changePanel('sksjfb')"
        >
          <div class="icon-box"></div>
          <div class="label">时空数据发布</div>
        </div>
      </div>
      <!-- 流程内容 -->
      <div class="process-content">
        <div
          class="process-content-item"
          v-for="(item, index) in nowFuncContent"
          :key="index"
        >
          <a :href="item.url" target="_blank" rel="noopener noreferrer">
            <div
              class="pictrue"
              :style="{
                background: 'url(' + item.image + ') no-repeat center center/100% 100%',
              }"
            ></div>
            <div class="label">{{ item.label }}</div>
          </a>
        </div>
      </div>
    </div>
    <div class="time-space-operator-lib">
      <!-- 标题区域 -->
      <div class="title-section">
        <h1>时空算子库</h1>
      </div>
      <!-- 描述区域 -->
      <div class="desc-section">
        <p>
          时空算子库具备丰富且强大的功能能力，在空间计算方面，涵盖量托轮廓下的宽度和面积计算，可利用投影坐标系结合既定定理与比例尺换算公式计算宽度，将多边形分割成三角形计算面积；还能判断点线面体的相互状态，通过计算点到线距离、射线法等方式判断点与线、面关系，利用计算几何方法判断线与线、线与面、体与点线面的关系；可进行缓冲区计算，以点、线、面为基础按给定距离生成缓冲区，支持线面体分割，依据指定规则对其进行分割并重新构建边和拓扑关系。在时空分析方面，能够对个面进行时空差异分析，判断空间重叠部分并通过求差来得到不相交面，同时考虑时间因素分析不同时间点面的状态变化。
        </p>
      </div>
      <!-- 业务专区区域 -->
      <div class="business-section">
        <div class="business-header">
          <span>业务专属时空数据</span>
          <!-- <button class="more-btn">查看更多</button> -->
        </div>
        <!-- 功能卡片列表 -->
        <!-- 单个功能卡片 -->
        <div class="card-list">
          <div
            class="card-item"
            v-for="(item, index) in cardList"
            :key="index"
            @click.stop="handleOnlineDemo(item)"
          >
            <div class="card-title">{{ item.title.split("/")[1] }}</div>
            <div class="card-bg">
              <el-image
                style="width: 100%; height: 100%"
                :src="dmsDataProxy + item.c_picture"
                fit="cover"
              />
            </div>
            <div class="card-desc">{{ item.content }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import wgn from "@/api/wgn";
export default {
  data() {
    return {
      dmsDataProxy: "",
      activePanel: "sjzljc",
      funcList: systemConfig.sksjgl.funcList,
      nowFuncContent: [],
      cardList: [],
    };
  },
  mounted() {
    this.dmsDataProxy = systemConfig.dmsDataProxy;
    this.changePanel(this.activePanel);
    this.searchServerList();
  },
  methods: {
    changePanel(active) {
      this.activePanel = active;
      this.nowFuncContent = this.funcList[this.activePanel];
    },
    // 搜索微功能服务
    searchServerList() {
      let requestParams = {
        columnId: 1651,
        states: 0,
        pageSize: 999,
        page: 0,
      };
      requestParams.search = JSON.stringify([
        {
          field: "title",
          searchType: 2,
          content: { value: "%时空算子库%" },
        },
      ]);
      // 获取微功能服务列表
      wgn
        .getDmsData(requestParams)
        .then((res) => {
          if (res.code === 200) {
            this.cardList = res.content.data;
          } else {
            this.$message({
              message: "搜索到0条微功能服务",
              type: "warning",
            });
          }
        })
        .catch((e) => {
          this.$message({
            message: "搜索微功能服务失败" + e,
            type: "error",
          });
        });
    },
    // 在线演示微功能服务
    handleOnlineDemo(item) {
      let routerPath = {};
      // 1. 解析目标路由（支持传参、命名路由等）
      if (item.c_scene_name == "view") {
        routerPath = {
          path: item.c_url,
        };
      } else {
        routerPath = {
          path: "/wgnSingle", // 微功能
          query: { sceneId: item.c_scene_name },
        };
      }
      const routeData = this.$router.resolve(routerPath);
      // 2. 打开新窗口（_blank 表示新窗口）
      window.open(routeData.href, "_blank");
    },
  },
};
</script>

<style lang="less" scoped>
.container {
  width: 100%;
  margin: 0 auto;

  .server_title {
    display: flex;
    justify-content: center;
    align-items: center;

    .server_title_text {
      width: calc(100vw - 824px);
      height: calc(100vh - 120px);
      background-color: #1c2631;
      color: #fff;
      padding: 0 160px 0 60px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      overflow: hidden;

      &_title {
        font-size: 64px;
        font-weight: bold;
        letter-spacing: 0.5rem;
      }

      &_content {
        margin-top: 77px;
        font-size: 22px;
      }
    }
  }

  .checkModule {
    width: 100%;
    background-color: #0f2545;

    /* 流程步骤样式 */
    .process-bar {
      width: fit-content;
      margin: 0 auto;
      padding-top: 100px;
      padding-bottom: 100px;

      .process-item {
        width: 250px;
        height: 200px;
        display: inline-block;
        color: #ffffff;
        cursor: pointer;
        border-radius: 10px;
        padding: 10px 15px;

        .icon-box {
          width: 90px;
          height: 90px;
          text-align: center;
          margin: 30px 80px 30px 80px;
        }

        .label {
          height: 50px;
          line-height: 50px;
          font-size: 24px;
          text-align: center;
          letter-spacing: 5px;
        }

        &.active {
          background-color: rgba(64, 149, 229, 0.69);
        }

        &:hover {
          background-color: rgba(64, 149, 229, 0.69);
        }

        &:nth-child(1) .icon-box {
          background: url("~@/assets/images/sksjgl/sjzljc.png") no-repeat center
            center/100% 100%;
        }

        &:nth-child(3) .icon-box {
          background: url("~@/assets/images/sksjgl/sksjjg.png") no-repeat center
            center/100% 100%;
        }

        &:nth-child(5) .icon-box {
          background: url("~@/assets/images/sksjgl/sksjgl.png") no-repeat center
            center/100% 100%;
        }

        &:nth-child(7) .icon-box {
          background: url("~@/assets/images/sksjgl/sksjfb.png") no-repeat center
            center/100% 100%;
        }
      }

      .divider {
        width: 60px;
        height: 200px;
        vertical-align: top;
        display: inline-block;
        background: url("~@/assets/images/sksjgl/jiantou.png") no-repeat center
          center/100%;
      }
    }

    /* 流程内容样式 */
    .process-content {
      width: 100%;
      padding: 50px 150px;
      box-sizing: border-box;
      display: flex;
      /* 允许换行 */
      flex-wrap: wrap;
      /* 元素之间的间距（可选） */
      gap: 75px;

      .process-content-item {
        /* 核心：每行2个，扣除gap间距 */
        width: calc(50% - 38px);
        // height: 400px;
        // background: #f0f8ff;
        // border: 1px solid #409eff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        color: #333;

        a {
          width: 100%;
          height: 100%;

          .pictrue {
            width: 100%;
            aspect-ratio: 1920 / 900;
            border-radius: 8px;
            transition: all 0.3s ease;
          }

          .label {
            color: #ffffff;
            text-align: center;
            height: 70px;
            line-height: 70px;
            font-size: 24px;
          }
        }

        &:hover .pictrue {
          transform: scale(1.05) translateY(-5px);
          box-shadow: 0 10px 30px rgba(24, 144, 255, 0.3);
          border-color: rgba(24, 144, 255, 0.6);
        }
      }
    }
  }

  .time-space-operator-lib {
    background-color: #1e407c;
    color: #fff;
    padding: 100px 150px;
    box-sizing: border-box;

    /* 标题区域 */
    .title-section {
      text-align: center;
      margin-bottom: 50px;

      h1 {
        font-size: 50px;
        font-weight: bold;
      }
    }

    /* 描述区域 */
    .desc-section {
      margin-bottom: 30px;
      line-height: 2;
      font-size: 20px;
      text-indent: 2em;
    }

    /* 业务专区区域 */
    .business-section {
      margin-top: 20px;
      border-radius: 16px 16px 16px 16px;
      background-color: rgba(31, 41, 55, 0.16);
      border: 1px solid #374151;
      padding: 20px 20px;
      box-sizing: border-box;

      .business-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        font-size: 16px;

        span {
          font-size: 20px;
        }

        .more-btn {
          background-color: transparent;
          border: 1px solid #fff;
          color: #fff;
          padding: 4px 12px;
          border-radius: 4px;
          cursor: pointer;
        }
      }
    }

    /* 卡片列表 */
    .card-list {
      display: flex;
      grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
      justify-content: space-between;

      .card-item {
        background-color: rgba(255, 255, 255, 0.1);
        padding: 15px;
        border-radius: 8px;
        height: 240px;
        display: flex;
        width: 10vw;
        flex-direction: column;

        &:hover {
          cursor: pointer;
          box-shadow: 0 10px 30px rgba(24, 144, 255, 0.3);
          border-color: rgba(24, 144, 255, 0.6);
        }

        .card-title {
          font-size: 15px;
          font-weight: 500;
          margin-bottom: 10px;
        }

        .card-bg {
          flex: 1;
          border-radius: 4px;
          margin: 8px 0;
        }

        .card-desc {
          font-size: 12px;
          opacity: 0.8;
          line-height: 1.4;
          /* 文字最多显示两行，超出部分省略号 */
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          -webkit-box-orient: vertical;
        }
      }
    }
  }
}
</style>
