<template>
  <div id="homeOut" class="homeOut">
    <TopBox id="topBox"></TopBox>

    <div class="home-router-view">
      <router-view></router-view>
    </div>
    <!--    footer-->
    <div class="footer">
      <div class="left-box">

        <div class="footer-brand">
          <img v-if="JSON.stringify(logoInfoNew)!=='{}'"
               :src="logoInfoNew.home.logoImg" alt=""
               class="img">
          <div class="content-main">
            <ul class="info">
              <li>地址：<span v-if="JSON.stringify(logoInfoNew)!=='{}'">{{ logoInfoNew.home.adress }}</span>
              </li>
              <li v-if="JSON.stringify(logoInfoNew)!=='{}'"> 邮箱：{{logoInfoNew.home.email}}</li>
              <!-- <li v-if="JSON.stringify(logoInfoNew)!=='{}'">电话： <span class="tel">{{logoInfoNew.home.mobile}}</span> -->
                <!-- </li> -->

              <li>
                <!-- <a href="" rel="noreferrer" target="_blank"></a> -->
              </li>
            </ul>

          </div>
        </div>
        <ul class="bigUl">
          <li class="bigLi footer-service">
            <span class="title">产品服务</span>
            <ul class="smallUl footer-service-list">
              <li
                v-for="item in footerProductServices"
                :key="item.label"
                class="smallLi"
                @click="goFooterService(item.path)"
              >
                {{ item.label }}
              </li>
            </ul>
          </li>
        </ul>
        <div v-if="JSON.stringify(logoInfoNew)!=='{}'&&logoInfoNew.home.bannerTitle!=='开元数智'" class="right-box">
          <div class="qr-box">
            <div class="qr-code">
              <img src="./img/img.png" alt="">

            </div>
            <span class="qr-content">微信客服</span>
          </div>
          <div class="qr-box">
            <div class="qr-code">
              <img src="./img/kefu.jpg" style="padding: 0.08rem" alt="">

            </div>
            <span class="qr-content">关注公众号</span>
          </div>
        </div>
      </div>
      <div class="footer-record">
        <span v-if="JSON.stringify(logoInfoNew)!=='{}'"
              class="footer-record__text"><span
          class="goStyle"
        @click="goOut('https://beian.miit.gov.cn/#/Integrated/index')">
           京ICP备{{
            logoInfoNew.home.license
          }}&nbsp;
       <span style="padding: 4px;"></span>
        </span> &nbsp;&nbsp;{{
            logoInfoNew.home.footerTitle
          }}&nbsp;{{
            logoInfoNew.home.copyright
          }}&nbsp; </span>
        <!--        IPC备案号:{{ ICP }} <span style="margin-left: 0.267rem">版权所有 @kaiyuanyun 2023</span>-->
        <!--        <img src="../../image/login/policeInsignia/policeInsignia.png" alt=""-->
        <!--             style="width:0.227rem;height:0.227rem;margin-right: 0.027rem;">-->
        <!--        <a href="https://beian.mps.gov.cn/#/query/webSearch?code=11010502054007" rel="noreferrer"-->
        <!--           target="_blank"-->
        <!--           style="margin-right:0.4rem;">京公网安备11010502054007</a>-->
        <!--        <span>-->
        <!--                  <router-link tag="a" target="_blank"-->
        <!--                               :to="{ name: 'homePageImage' }">经营许可证:京B2-20232313</router-link>-->
        <!--                </span>-->
      </div>
    </div>
  </div>
</template>
<script>
import Vue from 'vue'
import TopBox from "@/views/homePage/components/topBox/index.vue";
import {reqNewHomeFestival} from "@/api/newHome";
import {mapGetters, mapState} from "vuex";

export default Vue.extend({
  name: "indexLast",
  components: {TopBox},
  data() {
    return {
      currentBaseMenu: "hot", // 默认选中热门推荐
      baseMenu: [
        {
          id: "hot",
          name: "热门推荐",
          icon: require("./newImg/niu.png"),
          activeIcon: require("./newImg/niuActive.png")
        },
        {
          id: "computing",
          name: "计算",
          icon: require("./newImg/computing.png"),
          activeIcon: require("./newImg/computingActive.png")
        },
        {
          id: "cun",
          name: "存储",
          icon: require("./newImg/cun.png"),
          activeIcon: require("./newImg/cunActive.png") // 注意路径修正
        },
        {
          id: "database",
          name: "数据库",
          icon: require("./newImg/database.png"),
          activeIcon: require("./newImg/databaseActive.png")
        },
        {
          id: "container",
          name: "容器",
          icon: require("./newImg/container.png"),
          activeIcon: require("./newImg/containerActive.png")
        }
      ],
      footerProductServices: [
        { label: 'Token市集', path: '/homePage/tokenMarket' },
        { label: '算力市场', path: '/homePage/computeMarket' },
        { label: 'OPC公共服务平台', path: '/homePage/opc' },
        { label: '训推平台', path: '/homePage/trainPlatform' },
        { label: '智能体商店', path: '/homePage/agentStore' },
        { label: '供需广场', path: '/ncmatchHome/supplyAndDemandSquare' },
        { label: '文档中心', path: '/homePage/new' },
      ]
    }
  },
  computed: {
    ...mapGetters(["sidebar", "avatar", "device"]),
    ...mapState({
      isShowPanel: (state) => state.product.showHomeNav,
      navIndex: (state) => state.product.navIndex,
      gridObj: state => state.operationAnalysis.gridObj,
      mybalance: state => state.user.mybalance,
      logoutUrl: state => state.login.logoutUrl,
      loginState: state => state.login.loginState,
      logoInfoNew: state => state.product.logoInfoNew,
    }),
    showRegisterButton() {
      const orgType = window.sessionStorage.getItem('org_type');
      const userId = window.sessionStorage.getItem('userId');
      console.log("此时是:", orgType !== '2' && orgType !== '3' && userId !== null)
      return orgType !== '2' && orgType !== '3' && userId === null;
    },
    username() {
      return sessionStorage.getItem('username') || '';
    },

  },
  methods: {
    goOut(url){
      window.open(url)
    },
    goFooterService(path) {
      if (!path || this.$route.path === path) return
      this.$router.push(path)
    },
    scrollToElement(id) {
      const element = document.getElementById(id);
      if (element) {
        element.scrollIntoView({
          behavior: 'smooth', // 平滑滚动
          block: 'start',     // 滚动到顶部对齐（可选：'start', 'center', 'end', 'nearest'）
        });
      }
    },
    clickBaseMenu(menu) {
      console.log("emnu", menu)
      this.currentBaseMenu = menu.id;
    },
    async goBaidu() {
      this.scrollToElement('topBox')
      await this.$store.commit('setShowHomeNav', true)
      await this.$store.commit('setNavIndex', 0)

      // const orgType = window.sessionStorage.getItem('org_type');
      // let isKehu = orgType === '2' || orgType === '3';
      // if (isKehu) {
      //   this.$router.push({path: '/product/baiduProduct',})
      // } else {
      //   this.$router.push({
      //     path: "/login",
      //     query: {
      //       type: 'homePage',
      //     }
      //   })
      // }
    },
    async goAliyun() {

      this.scrollToElement('topBox')
      await this.$store.commit('setShowHomeNav', true)
      await this.$store.commit('setNavIndex', 1)

      // const orgType = window.sessionStorage.getItem('org_type');
      // let isKehu = orgType === '2' || orgType === '3';
      // if (isKehu) {
      //   reqNewHomeFestival().then(res => {
      //     if (res.status) {
      //       window.open(res.data)
      //     } else {
      //       this.$message.warning(res.msg)
      //     }
      //   })
      //
      // } else {
      //   this.$router.push({
      //     path: "/login",
      //     query: {
      //       type: 'homePage',
      //     }
      //   })
      // }
    },
  }
})
</script>


<style scoped lang="scss">
.homeOut {
  //padding-top: 60px;
  height: 100%;
  overflow: auto !important;
  min-width: 1500px;
  // background: linear-gradient(180deg, #f0f7ff 0%, #ffffff 60%, #f5f8ff 100%);
}
#topBox{
  // height: 82px;  
  background: transparent!important;
  background-color: transparent!important;
  box-shadow: none!important;
  border: 0!important;
}

.home-router-view {
  width: 100%;
  padding-top: 0;
  box-sizing: border-box;
}

.footer {
  padding: 42px 0 22px;
  width: 100%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  background-color: #fff;
}

.left-box {
  width: 1400px;
  min-height: 180px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0 0 30px;
  border-bottom: 1px solid rgba(122, 130, 160, 0.28);
  box-sizing: border-box;
}

.footer-brand {
  width: 420px;
  display: flex;
  flex-direction: column;

  .img {
    width: 168px;
    height: 54px;
    object-fit: contain;
    object-position: left center;
    margin-bottom: 14px;
  }
}

.right-box {
  min-width: 260px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 34px;
}

.content-main {
  mix-blend-mode: normal;
  color: #7A82A0;
  font-size: 14px;
  line-height: 1.8;
}

.qr-code {
  width: 112px;
  height: 112px;
  padding: 6px;
  border: 1px solid #edf1f7;
  border-radius: 12px;
  box-sizing: border-box;
  background: #fff;

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.qr-content {
  mix-blend-mode: normal;
  color: #4b5563;
  font-family: PingFang SC, serif;
  font-weight: 600;
  font-size: 14px;
  margin-top: 10px;
}

.qr-box {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

.logo {
  background-color: #32abfc;

  img {
    width: 100%;
    height: 100%;
  }
}

.bigUl {
  margin: 0 80px 0 40px;
  width: 260px;
  display: flex;
  justify-content: flex-start;
  padding: 0;
  list-style: none;

  .bigLi {
    margin: 0;
  }

  height: 100%;

  .title {
    color: #111827;
    font-size: 18px;
    line-height: 1.4;
    font-weight: 700;
  }

  .smallUl {
    padding: 0;
    list-style: none;
    font-size: 15px;
    color: #7A82A0;

    li {
      margin: 10px 0;
    }
  }
}

.footer-service {
  display: flex;
  flex-direction: column;
}

.footer-service-list {
  margin-top: 16px;

  .smallLi {
    line-height: 1.5;
    white-space: nowrap;
  }
}

.info {
  font-size: 14px;
  color: #7A82A0;
  padding: 0;
  margin: 0;
  list-style: none;

  li {
    margin: 6px 0;
  }
}

.tel {
  color: #222F60;
  font-size: 20px;
}

.smallLi {
  transition: color .2s ease, transform .2s ease;

  &:hover {
    color: #1b5bff;
    cursor: pointer;
    transform: translateX(4px);
  }
}

.footer-record {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-record__text {
  width: 1400px;
  margin: 18px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #7A82A0;
  font-size: 14px;
}

.goStyle {
  cursor: pointer;
  transition: all .3s ease-in-out;

  &:hover {
    transition: all .3s ease-in-out;
    color: #1b5bff;
  }
}
</style>
