<template>
  <div class="container">
    <div class="top-box">
      <headers :msg='msg'></headers>

      <div class="ny-banner">
        <img src="../../assets/gw/tlee.jpg" alt="">
      </div>
    </div>
    <!-- new -->
    <div class="navigation">
      <div class="content">
        <div></div>
        <!--        <div class="left"><img src="../../assets/gw/home.png" alt="">-->
        <!--          <p><a href="/gw">首页</a><i class="el-icon-arrow-right"></i> <span href="">中心概况</span></p>-->
        <!--        </div>-->
        <div class="right">
          <div class="nav-item" v-for="(item, index) in nav" v-bind:class="[index === currentActive ? 'active' : '']"
            @click="getCurrentActive(index)">
            {{ item.categoryName }}
          </div>
        </div>
      </div>
    </div>
<!--    <div class="committee-cont" v-show="currentActive == 0">-->
<!--      <div >-->


<!--      </div>-->
<!--    v-if="currentActive !== 0"-->
<!--    </div>-->

    <div class="committee-cont"  >
      <div class="left_img" ref="leftImg">
        <img src="../../assets/images/l_img.png" alt="">
      </div>
      <div class="right_img" ref="rightImg">
        <img src="../../assets/images/l_img.png" alt="">
      </div>
      <!-- main -->
      <div v-if="currentActive == 0" style="width: 75%;background: #fff;">
        <div class="n-box"   v-for="(item,index) in onelist" @click="goDeatail(item)" >
          <div>
            <div class="v-time" >{{item.publishDate}}111</div>
            <div class="v-title">{{item.contentTitle}}111</div>
            <div class="v-size">{{item.summary || '' }}11</div>
          </div>
          <div>
            <img :src=" imgurl + item.contentImg"  style="width: 420px; height: 263px; ">
          </div>
        </div>
        <page-util style="background: #fff;z-index: 999;position:relative" :category-id="categoryId" @event-message="handleDataFromPage" />
      </div>
      <div v-else>
        <div class="about-conts-item1" v-if="currentActive == 2">
          <div class="noticeRsr" v-html="twolist" >
          </div>
        </div>
        <div class="about-conts-item1" v-if="currentActive == 1">
          <div class="dataClass">
            <div v-for="(item, index) in dataList">
              {{item.contentTitle}}
            </div>
          </div>
        </div>
      </div>

    </div>
    <div class="bottom_img"  ref="bottomImg">
    </div>
    <footers style="position: relative;"></footers>
  </div>
</template>

<script>
import { Swiper, SwiperSlide } from "vue-awesome-swiper";
import "swiper/css/swiper.min.css";
import {getPageData, getCategoryByParentId, getListById} from "@/api/officialWebsite/getPageData";
import footers from '@/views/officialWebsite/Components/footer.vue'
import headers from '@/views/officialWebsite/Components/header.vue'
import PageUtil from '@/views/officialWebsite/Components/page/index.vue'
export default {
  components: {
    headers,
    footers,
    Swiper,
    SwiperSlide,
    "page-util": PageUtil
  },
  name: 'HelloWorld',

  data() {
    return {
      msg:5,
      onelist:[],
      twolist:[],
      dataList: [],
      categoryId:'',
      pageContextList: [],
      imgurl: process.env.VUE_APP_BASE_API,
      nav: [
        // { name: '工作动态' },
        // { name: '组织架构' },
        // { name: '成员信息' },
      ],
      currentActive: 0,
      isMounted: false,
      input4: "",
      routeParam : {
        "categoryId": this.$route.query.id,
        "pageNum": 1,
        "pageSize": 10
      }
    }
  },
  created() {
    // 页面加载完毕调用
    this.initPageData();
  },
  computed: {

  },
  mounted() {
    // 在组件挂载后添加滚动监听
    window.addEventListener('scroll', this.handleScroll)
  },

  beforeDestroy() {
    // 在组件销毁前移除滚动监听
    window.removeEventListener('scroll', this.handleScroll)
  },

  methods: {
    handleScroll() {
      let browserHeight = document.documentElement.clientHeight
      console.log("高度",document.documentElement.clientHeight)
      const leftImg = this.$refs.leftImg
      const rightImg = this.$refs.rightImg
      const bottomImg = this.$refs.bottomImg
      const scrollPosition = window.scrollY
      if (scrollPosition > 450) {
        leftImg.style.top = '100px'
        leftImg.style.position = 'fixed'
        rightImg.style.top = '0px'
        rightImg.style.position = 'fixed'
        bottomImg.style.bottom="0"
      } else {
        leftImg.style.top = '250px'
        leftImg.style.position = 'absolute'
        rightImg.style.top = '150px'
        rightImg.style.position = 'absolute'
        bottomImg.style.bottom="-300px"
      }
    },
    getContentDetail(){
      this.routeParam.categoryId = this.nav[this.currentActive].id
      getPageData(this.routeParam).then(res => {
        this.twolist = res.data.list[0].contentDetail
      })
    },
    handleDataFromPage(data){
      console.log(data)
      if (this.currentActive === 0){
        this.onelist = data
      }
    },
    goDeatail(data){
      if(data.linkType == 0){
        this.$router.push({
          name: 'details',
          query:{ id: data.id }
        });
      }
      if(data.linkType == 1){
        window.open(data.link, '_blank');
      }
    },
    getContentByCategoryId(id){
      getListById(id).then(res => {
        this.dataList = res.data
      })
    },
    // 触发导航
    getCurrentActive(value) {
      // if (value !== 1){
      //   this.categoryId = this.nav[value].id
      // }
      if (this.currentActive == value) {
        return
      }
      this.currentActive = value
      if (value === 1){
        this.getContentByCategoryId(this.nav[value].id)
      }
      if (value === 2){
        this.getContentDetail()
      }
    },
    initPageData() {
      getCategoryByParentId(this.routeParam.categoryId).then(res => {
        this.nav = res.data
        this.categoryId = this.nav[0].id
      })
    },
  }

}
</script>

<style scoped>
.container {
  background: #F5F5F5;
}
.bj {
  background: #F5F5F5;
}

::v-deep .team .el-input__inner {
  width: 240px;
  border-radius: 50px;
}

/* 圆形分页按钮样式 */
::v-deep .el-pagination .el-pager li:not(.disabled) {
  border-radius: 100%;
  /* 圆形 */
  width: 50px;
  height: 50px;
  /* 按钮高度 */
  line-height: 50px;
  /* 文字垂直居中 */
  text-align: center;
  /* 文字水平居中 */
  margin: 0 15px;
  /* 按钮间距 */
  border-radius: 50%;
  width: 50px;
  height: 50px;
  background: #FFFFFF;

  border: 1px solid #DDDDDD;
}
.about-conts-item1{
  background: #fff;
}
/* 选中的页码按钮样式 */
::v-deep .el-pagination .el-pager .active {
   background-color: #005375 !important;
  /* 背景颜色 */
  color: #fff;
  /* 文字颜色 */
}

::v-deep .el-pagination.is-background .btn-next,
::v-deep .el-pagination.is-background .btn-prev {

  background-color: #f4f4f5;
  color: #333;
  margin: 0 15px;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  background: #FFFFFF;

  border: 1px solid #DDDDDD;
}

::v-deep .el-pagination .btn-next .el-icon,
::v-deep .el-pagination .btn-prev .el-icon {
  font-size: 18px;
}

.top-box {
  width: 100%;
  /* height: 1000px; */
  /* background: url(''); */
  /* background-size: cover; */
  /* 背景图片铺满盒子 */
  /* background-repeat: no-repeat; */
  /* 禁止背景图片重复 */
  position: relative;
}

.tab-box {
  width: 100%;
  box-sizing: border-box;
  padding: 20px 2%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
   background-color: #005375 !important;
  font-weight: bold;
  font-size: 18px;
  color: #FFFFFF;
  /* position: absolute; */
  z-index: 3;

}

.d-s {
  display: flex;
  align-items: center;
}

.logo-box {
  width: 50px;
  height: 50px;
  background: #fff;
}

.logo-size {
  font-weight: 800;
  font-size: 24px;
  color: #FFFFFF;
  margin-left: 20px;

}

.x-x {
  margin-right: 20px;
  cursor: pointer;
}

.ny-banner {
  width: 100%;
}

.ny-banner img {
  width: 100%;
}

.navigation {
  width: 100%;
  height: 60px;
  background: #FFFFFF;
  border-radius: 0px 0px 0px 0px;
  border-bottom: 1px solid #EEEEEE;
}

.navigation .content {
  width: 80%;
  margin: 0 auto;
  height: 60px;
  display: flex;
  justify-content: space-between;
  align-items: center
}

.navigation .content .left {
  width: 30%;
  display: flex;

  align-items: center
}

.navigation img {

  width: 15px;
  margin-right: 10px;
}

.navigation p {

  /* margin-top: 5px; */
  color: #999;
}

.navigation span {

  color: #999;
}

.navigation span:last-child {
  font-weight: 700;
  color: #005375;
}

.navigation .content .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  align-items: center
}

.navigation .content .right .nav-item {
  width: 200px;
  display: flex;
  height: 60px;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  cursor: pointer;
  font-weight: 500;
  border-bottom: 3px solid transparent;
}

.navigation .content .right .active {
  border-bottom: 3px solid #005375;
  color: #005375;
  font-weight: bold;
}

.committee-cont {
  //width: 80%;
  //margin: 15px auto;
  //padding: 30px 0;
  //box-sizing: border-box;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  justify-content: center;  /* 水平居中 */
  align-items: center;      /* 垂直居中 */
  padding-bottom: 0px;
  position: relative;
  background-image: url("../../assets/images/top_.png");
  background-repeat: no-repeat;
  background-position: top;
}

.committee-cont .news {
  width: 80%;
  margin: 0 auto;
  margin-top: 30px;
}

.committee-cont .news .news-list .item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 30px;
  margin-bottom: 30px;
  cursor: pointer;
  border-bottom: 1px solid #EEEEEE;
}

.committee-cont .news .news-list .item .tts {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  width: 80%;
  font-size: 20px;
  color: #333333;
  font-weight: 500;
}

.committee-cont .news .news-list .item .time {
  color: #999999;
  font-size: 14px;
}

.committee-cont .team {
  width: 80%;
  margin: 0 auto;
  margin-top: 30px;
}

.committee-cont .team .team-list {
  border: 1px solid #EEEEEE;
  margin-top: 30px;
}

.committee-cont .team .team-list .team-list-header {
  display: flex;
  height: 50px;
  align-items: center;
  background: #F2F3F5;
}

.committee-cont .team .team-list .team-list-header .div {
  width: 20%;
  height: 50px;
  display: flex;
  align-items: center;
  padding-left: 2%;
  border-right: 1px solid #EEEEEE;
  font-size: 16px;
  font-weight: bold;
}

.committee-cont .team .team-list .team-list-header .div:last-child {
  width: 8%;
}

.committee-cont .team .team-list .item {
  display: flex;
  height: 50px;
  align-items: center;
}

.committee-cont .team .team-list .item .div {
  width: 20%;
  height: 50px;
  display: flex;
  align-items: center;
  padding-left: 2%;
  border-right: 1px solid #EEEEEE;
  font-size: 16px;
}

.committee-cont .team .team-list .item .div:last-child {
  width: 8%;
  color: #005375;
}

.index-footer {
  background: #383838;
  padding-top: 30px;
}

.index-footer .footer {
  width: 80%;
  margin: 0 auto;
}

.index-footer .footer .logo {
  display: flex;
  justify-content: space-between;
  /* align-items: center; */
}

.index-footer .footer .logo .footer-contact {}

.index-footer .footer .logo .footer-contact .p {
  display: inline-block;
  display: flex;
  float: left;
  margin-left: 50px;
  align-items: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 16px;
  /* justify-content: flex-end; */
}

.index-footer .footer .logo .footer-contact .p img {
  margin-right: 10px;
}

.index-footer .footer .logo .footer-contact .p:nth-child(3) {
  width: 100%;
  clear: both;
  margin-top: 20px;
}

.index-footer .footer .footer-nav {
  display: flex;
  margin-top: 20px;
  padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.index-footer .footer .footer-nav .footer-nav-item {
  width: 9%;
  margin-right: 1%;
}

.index-footer .footer .footer-nav .footer-nav-item:last-child {
  margin-right: 0;
}

.index-footer .footer .footer-nav .footer-nav-item .tt {

  font-weight: 500;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 18px;
  position: relative;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.index-footer .footer .footer-nav .footer-nav-item .tt::after {
  content: "";
  width: 20px;
  height: 2px;
  background: #005375;
  border-radius: 0px 0px 0px 0px;
  position: absolute;
  bottom: 0;
  left: 0;
}

.index-footer .footer .footer-nav .footer-nav-item a {
  text-decoration: none;

  font-weight: 500;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 16px;
  display: block;
  margin-bottom: 15px;
}

.index-footer .footer .footer-nav .footer-nav-item a:last-child {
  margin-bottom: 0;
}

.index-footer .footer .web_icp {
  display: flex;
  margin-top: 50px;
  height: 80px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.index-footer .footer .web_icp a {
  text-decoration: none;

  font-weight: 500;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.4);
  line-height: 16px;
  margin-right: 30px;
}

.index-footer .footer .web_icp .right {
  display: flex;
  align-items: center;
  justify-content: flex-end
}

.index-footer .footer .web_icp .right div {
  margin-right: 25px;

  font-weight: 500;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 18px;

}
.dataClass{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.dataClass > div {
  border: 1px solid black;
  font-size: 18px;
  margin: 10px;
  text-align: center;
  padding: 20px;
}
.noticeRsr{
  width: 100%;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  font-size: 20px;
}
.noticeRsr:hover{
  color: #00A0E8;
  cursor: pointer;
}
.noticeRsr{
  width: 100%;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  font-size: 20px;


}
.n-box{
  width: 100%;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #DDDDDD;
  box-sizing: border-box;
  padding: 15px 0px;
  background: #fff;
}
.noticeRsr:hover{
  color: #00A0E8;
  cursor: pointer;
}
.v-time{
  font-weight: 500;
  font-size: 18px;
  color: #005375;
  margin-bottom: 15px;
}
.v-title{
  font-weight: bold;
  font-size: 24px;
  color: #005375;
  margin-bottom: 15px;
}
.v-size{
  width: 800px;
  font-size: 18px;
  color: #999999;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-30px);
  }
  60% {
    transform: translateY(-15px);
  }
}

.left_img {
  position: absolute;
  left: 15px;
  top: 250px;
  display: inline-block;
  animation-name: bounce;
  animation-duration: 2s; /* 设置整个动画持续时间为两秒 */
  animation-timing-function: ease-in-out; /* 控制速度曲线 */
  animation-iteration-count: infinite; /* 循环播放次数 */

}

.right_img {
  position: absolute;
  right: 15px;
  top: 150px;
  display: inline-block;
  animation-name: bounce;
  animation-duration: 2s; /* 设置整个动画持续时间为两秒 */
  animation-timing-function: ease-in-out; /* 控制速度曲线 */
  animation-iteration-count: infinite; /* 循环播放次数 */
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; display: none; }
}
.bottom_img {
  width: 100%;
  height: 400px;
  position: fixed; /* 固定在页面 */
  display: block;
  bottom: -300px;
  left: 0; /* 确保元素从页面左侧开始 */
  background-image: url("../../assets/images/bottom_.png");
  background-repeat: no-repeat;
//z-index: -1;
  background-size: cover;
  transition: all 1s linear;
}
</style>
