<template>
  <div id="homeOut" class="homeOut">
    <TopBox id="topBox"></TopBox>
    <div class="search-box">
      <search></search>
    </div>
    <div style="width: 90%;max-width: 1600px;border:1px solid red;">
      <router-view></router-view>
    </div>
    <el-dialog :title="productDetailInfo.publish_type==='1'? '商品详情' :'需求详情'" top="5vh" :visible.sync="showProductDetail" width="80%" @open="scrollToTop">
      <ProductDetail></ProductDetail>
      <span slot="footer" class="dialog-footer">
        <!-- <el-button @click="closeProductDetail">取 消</el-button> -->
        <el-button type="primary" @click="closeProductDetail">关 闭</el-button>
      </span>
    </el-dialog>
    <!--    footer-->
    <div class="footer">
      <div class="left-box" style="border-bottom: 1px solid  #7A82A0">

        <div style="display: flex;flex-direction: column">
          <img v-if="JSON.stringify(logoInfoNew) !== '{}'" style="width: 148px;height: 48px;"
            :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">
        </ul>
        <div v-if="JSON.stringify(logoInfoNew) !== '{}' && logoInfoNew.home.bannerTitle !== '开元数智'" class="right-box">
          <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 class="qr-box" style="margin-left: 0.667rem">
            <div class="qr-code">
              <img src="../img/img.png" alt="">
            </div>
            <span class="qr-content">关注公众号</span>
          </div>
        </div>
      </div>
      <div style="display: flex;justify-content: center;align-items: center;width: 100%; ">
        <span v-if="JSON.stringify(logoInfoNew) !== '{}'"
          style="margin:15px 0 ;width: 1400px;display:flex;justify-content:center;align-items:center;color: #7A82A0;"><span
            class="goStyle" @click="goOut('https://beian.miit.gov.cn/#/Integrated/index')">
            京ICP备{{
              logoInfoNew.home.license
            }}&nbsp;
          </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 { mapGetters, mapState } from "vuex";
import search from "./search/index.vue";
import productDetail from "./proDetail/index.vue";
export default Vue.extend({
  name: "indexLast",
  components: { TopBox, search, ProductDetail: productDetail },
  data() {
    return {
      currentBaseMenu: "hot", // 默认选中热门推荐
    }
  },
  computed: {
    ...mapGetters(["sidebar", "avatar", "device"]),
    ...mapState({
      isShowPanel: (state) => state.product.showHomeNav,
      productDetailInfo: state => state.ncmatch.productDetail,
      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,
    }),
    showProductDetail: {
      get() {
        return this.$store.state.ncmatch.showProductDetail;
      },
      set(value) {
        this.$store.commit('SHOWPRODUCTDETAIL', value);
      }
    },
    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: {
    closeProductDetail() {
      this.$store.commit('SHOWPRODUCTDETAIL', false)
    },
    scrollToTop() {
      // 使用nextTick确保DOM更新完成后再滚动
      this.$nextTick(() => {
        const dialogBody = document.querySelector('.el-dialog__body');
        if (dialogBody) {
          dialogBody.scrollTop = 0;
        }
      });
    },
    goOut(url) {
      window.open(url)
    },
    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)
    },
    async goAliyun() {

      this.scrollToElement('topBox')
      await this.$store.commit('setShowHomeNav', true)
      await this.$store.commit('setNavIndex', 1)
    },
  }
})
</script>


<style scoped lang="scss">
.search-box {
  width: 100%;
  margin-top: 55px;
  border: 1px solid red;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.homeOut {
  //padding-top: 60px;
  height: 100%;
  overflow: auto !important;
  min-width: 1500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;


}

.footer {

  padding: 35px 0;
  width: 100%;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
}

.left-box {
  width: 1400px;
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
}

.right-box {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.content-main {
  mix-blend-mode: normal;
  color: rgba(0, 0, 0, 1);
  font-size: 0.187rem;
}


.qr-code {
  img {
    width: 100%;
    height: 100%;
  }

  width: 1.853rem;
  height: 1.853rem;
}

.qr-content {
  mix-blend-mode: normal;
  color: rgba(24, 24, 24, 1);
  font-family: PingFang SC, serif;
  font-weight: 600;
  font-size: 0.187rem;
}

.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 15px;
  margin-left: -250px;
  //padding-top: 15px;
  width: fit-content;
  display: flex;
  justify-content: flex-start;

  .bigLi {
    margin: 0 25px;
  }

  height: 100%;

  .title {
    color: #222F60;
    font-size: 18px;
    font-weight: bold;
  }

  .smallUl {

    font-size: 16px;
    color: #7A82A0;

    li {
      margin: 10px 0;
    }
  }
}

.info {
  font-size: 14px;
  color: #7A82A0;

  li {
    margin: 10px 0;
  }
}

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

.smallLi {
  &:hover {
    color: #1b5bff;
    cursor: pointer;
  }
}

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

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