<template>
  <common-header/>
  <div class="banner-box pr">
    <div class="banner"
         :style="{'background': 'url('+curMenu.img+') top no-repeat','background-size': 'cover'}"></div>

  </div>
  <div class="content-bg pt10 pb80">
    <div class="main pt50">
      <h3 class="title-img m-0"><img src="/images/home/zbkt.png?v=20221024" alt=""></h3>
      <div class="zbkt">
        <img src="/images/home/zb.png" class="w100" alt="">
        <div class="zb-link left hand" @click="toLive(2)"></div>
        <div class="zb-link middle hand" @click="toLive(1)"></div>
        <div class="zb-link right hand" @click="toLive(3)"></div>
      </div>
      <h3 class="title-img m-0">
        <img src="/images/home/kczy.png?v=20221024" alt="">
      </h3>
      <div class="d-flex flex-between mt20 mb30">
        <div class="w-610px hand" @click="toLive(9)"><img src="/images/home/jbkc.png" class="w100" alt=""></div>
        <div class="w-608px hand" @click="toLive(10)"><img src="/images/home/tskc.png" class="w100" alt=""></div>
      </div>
      <h3 class="title-img m-0">
        <img src="/images/home/zhjy.png?v=20221024" alt="">
      </h3>
      <div class="mt25 pr h-315px">
        <div class="w-439px pa -left-25px hand" @click="toLive(4)"><img src="/images/home/zxxx.png" class="w100" alt=""></div>
        <div class="w-439px pa left-380px hand" @click="toLive(5)"><img src="/images/home/xtbk.png" class="w100" alt=""></div>
        <div class="w-439px pa left-786px hand" @click="toLive(6)"><img src="/images/home/tbjy.png" class="w100" alt=""></div>
      </div>
      <div class="pr">
        <h3 class="title-img m-0">
          <img src="/images/home/yscg.png" alt="">
        </h3>
      </div>
      <div class="d-flex flex-between mt20 mb30">
        <div class="w-608px hand" @click="toLive(7)"><img src="/images/home/ysgc.png" class="w100" alt=""></div>
        <div class="w-608px hand" @click="toLive(8)"><img src="/images/home/szmsg.png" class="w100" alt=""></div>
      </div>
<!--      <ul class="mt20 work-list d-flex">-->
<!--        <li class="pr30" v-for="item in zpList" @click="lookDetail(item.yz_id)">-->
<!--          <div class="work-img"><img :src="item.yz_img" alt=""></div>-->
<!--          <div class="p15">-->
<!--            <h3 class="font-size-20 text-overflow">{{item.yz_name}}</h3>-->
<!--            <div class="mt15 pt15 work-info d-flex flex-between">-->
<!--              <h3 class="font-size-16 text-hex-5B8BEC">-->
<!--                <span class="d-in-block v-mid">详情</span>-->
<!--                <span class="d-in-block v-mid arrow ml5"></span>-->
<!--              </h3>-->
<!--            </div>-->
<!--          </div>-->
<!--        </li>-->
<!--      </ul>-->


    </div>
  </div>
  <common-footer/>
</template>
<script>
import CommonHeader from "@/components/CommonHeader/index.vue";
import CommonFooter from "@/components/CommonFooter/index.vue";
import {user} from "@/store/user.js";
import {getFullUrl} from '@/utils/helper';
import img1 from "/images/home/live-1.png";
import img2 from "/images/home/live2.png";
import img3 from "/images/home/live3.png";
import bgImg1 from "/images/home/live-2.png";
import bgImg2 from "/images/home/live-3.png";
import 'swiper/css/swiper.css';
import Swiper from 'swiper';
import {ElMessage} from "element-plus";

export default {
  components: {
    CommonHeader,
    CommonFooter
  },
  data() {
    return {
      menuList: [{
        id: 1,
        title: '八骏奔腾展宏图',
        img: '/images/home/banner-6.jpg'
      }],
      curMenu: {
        id: 1,
        title: '八骏奔腾展宏图',
        img: '/images/home/banner-6.jpg'
      },
      value: '4',
      xsyxzy: [{
        id: '1',
        img: '/images/home/1.png',
        title: '野天鹅',
        rate: 5,
        prove: '10w+',
        favor: '14w+'
      }, {
        id: '2',
        img: '/images/home/2.png',
        title: '安徒生世界插画',
        rate: 4,
        prove: '9w+',
        favor: '14w+'
      }, {
        id: '3',
        img: '/images/home/3.png',
        title: '传送门',
        rate: 4,
        prove: '10w+',
        favor: '14w+'
      }, {
        id: '4',
        img: '/images/home/4.png',
        title: '拇指姑娘',
        rate: 4,
        prove: '10w+',
        favor: '14w+'
      }],
      xsSwiper: null,
      jsxyzp: [{
        id: '1',
        img: '/images/home/1.png',
        title: '野天鹅',
        rate: 5,
        prove: '10w+',
        favor: '14w+'
      }, {
        id: '2',
        img: '/images/home/2.png',
        title: '安徒生世界插画',
        rate: 4,
        prove: '9w+',
        favor: '14w+'
      }, {
        id: '3',
        img: '/images/home/3.png',
        title: '传送门',
        rate: 4,
        prove: '10w+',
        favor: '14w+'
      }],
      jsSwiper: null,
      liveData: [
        {
          name: "全景课堂",
          pro1: "轻松便捷的快速构建教学",
          pro2: "超强的抗弱网能力，优秀的网络自适应策略保证优质观看效果",
          pro3: "满足大规模教师、学生同时接入",
          img: img1,
          bgImg: bgImg1
        },
        {
          name: "名师优课",
          pro1: "支持音频/视频实景上课，音频、动作等实时传递，呈现真实课堂的教学环境",
          pro2: "老师在线发布测验题，学生端进行答题检测，老师可查看测验结果，检查教室内学员是否认真听课",
          pro3: "",
          img: img2,
          bgImg: bgImg1
        },
        {
          name: "艺术现场",
          pro1: "支持云端录制和本地录制，生成直播录制视频及云端回放链接",
          pro2: "完全重现直播时的场景，便于学习复习及教学内容再次传播",
          pro3: "",
          img: img3,
          bgImg: bgImg2
        }
      ],
      activeLive: 0,
      imgList:[{
        id:1,
        img:'/images/home/z-1.png'
      },{
        id:3,
        img:'/images/home/z-2.png'
      },{
        id:2,
        img:'/images/home/z-3.png'
      }],
      isTeacher:false,
      zpList:[]
    }

  },
  methods: {
    switchImg(item) {
      this.curMenu = item;
    },
    toTeacher() {
      if (!user) {
        ElMessage.warning(`请先登录!`);
      } else {
        this.$router.push({name: 'resource'});
      }

      // localStorage.setItem('curNav', 'resource');
    },
    toLive(type) {
      if (!user) {
        ElMessage.warning(`请先登录!`);
      } else {
        switch (type) {
          case 1:
            if (user.user_role_id < 76) {
              this.$router.push({name: 'ssys', params: { status:"1" }});
            } else {
              ElMessage.warning(`您暂无权限!`);
            }

            // localStorage.setItem('curNav', 'zbkt');
            break;
          case 2:
            this.$router.push({name: 'wlzb'});
            // localStorage.setItem('curNav', 'zbkt');
            break;
          case 3:
            this.$router.push({name: 'ztzb'});
            // localStorage.setItem('curNav', 'zbkt');
            break;
          case 4:
            if (user.user_role_id < 76) {
              this.$router.push({name: 'zhjy_zhjyzxxx'});
            } else {
              ElMessage.warning(`您暂无权限!`);
            }

            // localStorage.setItem('curNav', 'zhjy');
            break;
          case 5:
            if (user.user_role_id < 76) {
              this.$router.push({name: 'zhjy_zhjyxtbk'});
            } else {
              ElMessage.warning(`您暂无权限!`);
            }

            // localStorage.setItem('curNav', 'zbkt');
            break;
          case 6:
            if (user.user_role_id < 76) {
              this.$router.push({name: 'zhjy_zhjytbjy'});
            } else {
              ElMessage.warning(`您暂无权限!`);
            }

            // localStorage.setItem('curNav', 'zbkt');
            break;
          case 7:
            this.$router.push({name: 'ysgc'});
            // localStorage.setItem('curNav', 'zbkt');
            break;
          case 8:
            this.$router.push({name: 'szmsg'});
            // localStorage.setItem('curNav', 'zbkt');
            break;
          case 9:
            this.$router.push({
              path: '/resourceAll',
              query: {
                kcName: '基础课程',
                kcId:1
              }
            });
            break;
          case 10:
            this.$router.push({
              path: '/resourceAll',
              query: {
                kcName: '特色课程',
                kcId: 5
              }
            });
            break;

        }
      }

    },
    lookDetail(id) {
      if (!user) {
        ElMessage.warning(`请先登录!`);
      } else {
        if (!this.isTeacher) {
          this.$router.push({name: "ysgc_stuDetail", params: {id: id}});
        } else {
          this.$router.push({name: "ysgc_jsDetail", params: {id: id}});
        }
      }

    },
    initXSData() {
      request({
        url: '/ysgc/zp/index',
        data: {
          yz_type: 1,
        }
      }).then(res => {
        if (res.code == 1) {
          this.xsyxzy = res.data.page_data;
        }
      })
    },
    initJSData() {
      request({
        url: '/ysgc/zp/index',
        data: {
          yz_type: 2,
        }
      }).then(res => {
        if (res.code == 1) {
          this.jsxyzp = res.data.page_data;
        }
      })
    },
    initZpData(type){
      request({
        url: '/ysgc/zp/index',
        data: {
          yz_type: type,
        }
      }).then(res => {
        if (res.code == 1) {
          this.zpList = res.data.page_data.splice(0,3);
        }
      })
    },
    switchZpType() {
      if(this.isTeacher) {
        this.isTeacher = false;
        this.initZpData(1)
      } else {
        this.isTeacher = true;
        this.initZpData(2);
      }
    },
    handleHover(index) {
      this.activeLive = index;
      if (index == 1) {
        this.liveData[1].bgImg = bgImg1;
      } else if (index == 2) {
        this.liveData[1].bgImg = bgImg2;
      }
    }
  },
  mounted() {
    this.initZpData(1);
  }
}
</script>
<style lang="scss" scoped>
@import "@/styles/mixin.scss";
</style>
<style lang="scss" scoped>
::v-deep .el-carousel__mask{
  opacity: 0!important;
}
.main {
  width: 1200px;
  margin: 0 auto;
}

.banner-box {
  width: 100%;
  height: 533px;

  .banner {
    width: 100%;
    height: 100%;
  }

  .mask {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 50;
    width: 100%;
    height: 100%;
    background: radial-gradient(
            rgba(255, 255, 255, 0),
            rgba(160, 221, 255, 0),
            rgba(74, 190, 255, 0.54),
            rgba(0, 163, 255, 0.86)
    );
  }

  .right-menu {
    position: absolute;
    left: 50%;
    top: 0;
    z-index: 60;
    margin-left: 505px;
    width: 318px;
    height: 560px;
    background: linear-gradient(
            270deg,
            rgba(0, 163, 255, 0.41),
            rgba(0, 208, 255, 0.16)
    );
    display: flex;
    justify-content: right;

    ul {
      padding-top: 60px;
      padding-right: 10px;

      li {
        font-size: 16px;
        color: #fff;
        position: relative;
        text-align: right;
        height: 30px;
        line-height: 30px;
        cursor: pointer;

        &.selected,
        &:hover {
          font-size: 28px;
        }

        & + li {
          margin-top: 18px;
        }
      }
    }
  }
}

.content-bg {
  width: 100%;
  background: #f6f8fa;
}

.title-img {
  width: 320px;
  height: 77px;
  margin: 0 auto 30px;
  img {
    width: 100%;
  }
}

.course-box {
  position: relative;
  z-index: 80;
  margin-top: -48px;
  align-items: center;

  .arrow {
    width: 20px;
    height: 20px;

    &.prev {
      background: url("/images/home/arr-left.png") center no-repeat;
      background-size: 20px 20px;

      &:hover {
        background: url("/images/home/arr-left-hover.png") center no-repeat;
        background-size: 20px 20px;
      }
    }

    &.next {
      background: url("/images/home/arr-right.png") center no-repeat;
      background-size: 20px 20px;

      &:hover {
        background: url("/images/home/arr-right-hover.png") center no-repeat;
        background-size: 20px 20px;
      }
    }
  }

  .swiper-container-horizontal:deep {
    .swiper-button-prev:after,
    .swiper-container-rtl .swiper-button-next:after {
      display: none;
    }

    .swiper-button-next:after,
    .swiper-container-rtl .swiper-button-prev:after {
      display: none;
    }

    .swiper-button-prev,
    .swiper-button-next,
    .swiper-button-prev1,
    .swiper-button-next1 {
      position: sticky;
      left: unset;
      right: unset;
    }
  }

  .course-list {
    width: 100%;
    display: flex;

    li,
    .swiperContent {
      cursor: pointer;
      // min-width: 223px;
      // width: 223px;
      border-radius: 12px;
      background: #fff;

      // + li {
      //   margin-left: 14px;
      // }
    }

    .course-img {
      width: 100%;
      height: 131px;
      border-radius: 12px 12px 0 0;
      overflow: hidden;

      img {
        width: 100%;
      }

      .tag-info {
        position: absolute;
        right: 0;
        top: 0;
        z-index: 30;
        width: 145px;
        height: 27px;
        background: rgba(0, 0, 0, 0.59);
        border-radius: 0 10px 0 10px;

        .tag-icon {
          width: 20px;
          height: 20px;

          &.prove {
            background: url("/images/home/icon-prove.png") center no-repeat;
            background-size: 14px 14px;
          }

          &.favor {
            background: url("/images/home/icon-favor.png") center no-repeat;
            background-size: 15px 13px;
          }
        }
      }
    }

    .course-info {
      width: 100%;
      padding: 8px 6px;
    }
  }
}

.title {
  width: 241px;
  height: 50px;
  background: url("/images/home/title-bg.png") center no-repeat;
  font-size: 34px;
  color: #000;
  text-align: center;
  line-height: 50px;
}

.res-list {
  display: flex;

  a {
    width: 251px;
    height: 390px;
    border-radius: 12px;
    background: #fff;
    padding-top: 56px;
    margin-left: 18px;

    &:hover {
      position: relative;
      z-index: 30;
      border: 2px solid #00a3ff;
      box-shadow: 0 0 6px rgba(0, 78, 255, 0.79);
      transform: scale(1.2);
    }

    .res-icon {
      width: 89px;
      height: 89px;

      img {
        width: 100%;
      }
    }
  }
}

.live-list {
  padding-left: 100px;

  a {
    height: 391px;

    .list {
      height: 100%;
      width: 300px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: width linear 0.05s;
    }

    .activeLive {
      margin-top: -15px;
      margin-right: -25px;
      width: 885px;
      height: 439px;
      cursor: pointer;
      display: block;
    }
  }
}

.wit-list {
  display: flex;

  li {
    width: 500px;
    height: 381px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(153, 162, 168, 0.18);

    img {
      display: block;
      margin: -60px auto 40px;
      max-width: 100%;
    }

    & + li {
      margin-left: 50px;
    }
  }
}

.arrow-right {
  width: 20px;
  height: 20px;
  background: url("/images/home/arrow-right.png") center no-repeat;
  background-size: 20px 20px;

  &.blue {
    background: url("/images/home/arrow-right-blue.png") center no-repeat;
    background-size: 20px 20px;
  }
}

.m-box {
  width: 833px;
  height: 277px;
  padding: 41px 0 0 81px;

  &:first-child {
    background: url("/images/home/m-1.png") center no-repeat;
  }

  &:nth-child(2) {
    background: url("/images/home/m-2.png") center no-repeat;
  }
}

.switch-right {
  position: absolute;
  right: 0;
  bottom: 35px;
  width: 162px;
  font-size: 24px;
  color: #000;
  text-align: left;
  padding-left: 15px;

  .tag {
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 100%;
    height: 18px;
    background: url("/images/home/tag.png") center no-repeat;
    background-size: 162px 18px;
  }

  .arrow {
    position: absolute;
    right: 10px;
    top: 50%;
    margin-top: -7px;
    width: 10px;
    height: 14px;
    background: url("/images/home/icon-arrow-new.png") center no-repeat;
    background-size: 10px 14px;
  }
}

.work-list {
  li {
    width: 380px;
    height: 380px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
    cursor: pointer;
    &+li{
      margin-left: 30px;
    }
  }

  .work-img {
    width: 350px;
    height: 227px;
    border-radius: 10px;
    overflow: hidden;

    img {
      width: 100%;
    }
  }
  .work-info{
    width: 100%;
    border-top: 1px dashed rgba(112,112,112,.25);
    .arrow{
      width: 15px;
      height: 8px;
      background: url("/images/home/icon.png") center no-repeat;
      background-size: 15px 8px;
    }
  }
}
.zbkt{
  position: relative;
  width: 1272px;
  height: 432px;
  left: -36px;
  .zb-link{
    position: absolute;
    z-index: 20;
    &.left{
      top: 50px;
      left: 35px;
      width: 255px;
      height: 310px;
    }
    &.middle{
      top: 25px;
      left: 297px;
      width: 678px;
      height: 360px;
    }
    &.right{
      top: 50px;
      right: 35px;
      width: 255px;
      height: 310px;

    }
  }
}
</style>
