<template>
  <div class="brandreg">
    <div style="width:1200px;margin: 30px auto ;">
      <div class="brand" style="width:100%;">
        <div style="width:1200px;margin:0 auto">
          <div style="width:1200px">
            <!-- <div style="background-color:#2692FF;height:24px;width:4px;float:left"></div> -->
            <div class="brand-title">商标注册申请</div>
            <div class="brand-text">
              <span>
                <img src="../../../assets/imgs/dui.png" style="margin-right: 10px;" alt />
                诚信商家
              </span>
              <span>
                <img src="../../../assets/imgs/dui.png" style="margin-right: 10px;" alt />
                1v1专业服务
              </span>
              <span>
                <img src="../../../assets/imgs/dui.png" style="margin-right: 10px;" alt />
                省钱省心省力
              </span>
            </div>
          </div>
          <!-- 轮播部分 -->
          <div
            class="brandreg-swiper swiper-no-swiping"
            @mouseenter="dataList.length>3 ? showArrows = true : showArrows=false"
          >
            <div class="swiper-container">
              <div class="swiper-wrapper">
                <div
                  class="swiper-slide"
                  v-for="(item, index) in dataList"
                  :class="{'swiper-slide-enter':index==current}"
                  @mouseenter="adHeight(index,$event)"
                  :key="index"
                >
                  <div
                    class="brandreg-swiper-hearder"
                    :class="{'brandreg-swiper-hearder-enter':index==current}"
                  >
                    <div>
                      <div>
                        <img :src="item.productLogo" alt />
                      </div>
                      <div>{{item.itemName}}</div>
                    </div>
                  </div>
                  <div class="brandreg-swiper-content">
                    <ul>
                      <li v-for="(item, index) in item.productDesc.desc" :key="index">
                        <div>
                          <img src="../../../assets/imgs/dbx.png" alt />
                        </div>
                        <div>{{item}}</div>
                      </li>
                    </ul>
                    <div>
                      <div>
                        <sup>￥</sup>
                        <span>{{item.proPrice}}</span>/件
                      </div>
                      <div
                        class="brandreg-swiper-content-button"
                        :class="{'brandreg-swiper-content-button-enter':index==current}"
                        @click="jumpJdProductDetails(item,$event)"
                      >立即购买</div>
                    </div>
                  </div>
                </div>
              </div>
              <!-- Add Pagination -->
              <!-- <div class="swiper-pagination"></div> -->
            </div>
            <!-- 控制箭头隐藏显示 -->
            <div v-show="showArrows" @mouseleave="showArrows = false">
              <div class="swiper-button-prev"></div>
              <!--左箭头。如果放置在swiper-container外面，需要自定义样式。-->
              <div class="swiper-button-next"></div>
              <!--右箭头。如果放置在swiper-container外面，需要自定义样式。-->
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import api from "@/api/api.js";

export default {
  data() {
    return {
      dataList: [],
      showArrows: false
    };
  },
  mounted() {
    // 请求数据并装填到datalist里面
    this.$axios
      .post(api.testData, {
        actionProcess: "jd",
        sign: "2FviZ9PGws8Pt1fBhq0t90mjUvI",
        actionBody: { timeStamp: 1577781269, channelUserId: "" },
        timeStamp: 1577781269,
        channelUserId: "",
        itemCode: "",
        actionType: "getProductListByTypeOneCode",
        isUser: "no",
        isDecryptUser: "no"
      })
      .then(d => {
        console.log(d);
      });
  },
  methods: {
    /*swiper区域添加class */
    adHeight(index, event) {
      this.current = index;
    },
    jumpJdProductDetails(code, e) {
      if (code.channelItemCode) {
        switch (code.itemCode) {
          case "zzsbzc":
            location.href =
              "https://oauth2.jdcloud.com/authorize?response_type=token&redirect_uri=https://tm.plus.jdcloud.com/jdtm/getUser&state=selftmreg&client_id=9491577327154697";
            /*this.$router.push({ path: "/jd/selftmreg", query: {} });*/
            break;
          case "fzsbzc":

          case "dbsbzc":
            let productId = code.channelItemCode.split("-")[1];
            console.log(code.channelItemCode.split("-"), "xxxxxxxxxxxxxx");
            window.open(
              `https://market.jdcloud.com/service/details/${productId}`
            );
            break;
          default:
            break;
        }
      } else {
        return;
      }
      console.log(code, e);
    }
  }
};
</script>

<style lang="scss" scoped>
.brand-title {
  width: 100%;
  text-align: center;
  font-size: 28px;
  font-family: MicrosoftYaHei;
  font-weight: 400;
  color: rgba(51, 51, 51, 1);
  line-height: 100px;
}

.brand-text {
  font-size: 14px;
  font-family: MicrosoftYaHei;
  font-weight: 400;
  color: rgba(153, 153, 153, 1);
  text-align: center;
  /* flex弹性布局 */
  display: flex;
  justify-content: center;
}

/*  */
.brand-text > span:not(:nth-child(1)) {
  margin-left: 45px;
}

/*  */
.brand-text > span {
  /* flex弹性布局 */
  display: flex;
  align-items: center;
}

.brand-text > span > img {
  width: 13px;
  height: 9px;
}
.brand-text > span > h5 {
  font-size: 14px;
  font-weight: 400;
  color: rgba(153, 153, 153, 1);
}

/* 轮播 */
.brandreg-swiper {
  position: relative;
  margin-top: 22px;
}

.brandreg-swiper .swiper-container {
  width: 1203px;
  height: 380px;
  padding-left: 3px;
}

.brandreg-swiper .swiper-wrapper {
  display: flex;
  align-items: flex-end;
}

.brandreg-swiper .swiper-slide {
  width: 400px !important;
  box-sizing: border-box;
  height: 370px;
  text-align: center;
  margin-right: 0 !important;
  transition: all 0.1s;
  box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
  border-radius: 1px;
}

/* 移入 */
.brandreg-swiper .swiper-slide-enter {
  height: 380px;
}

.brandreg-swiper .brandreg-swiper-hearder-enter {
  height: 80px;
  background: #32b6e7;
  color: #fff;
  font-size: 18px;
  line-height: 80px;
}

.brandreg-swiper .brandreg-swiper-content-button-enter {
  background: #32b6e7;
  border: 1px solid #32b6e7;
  color: #fff;
  cursor: pointer;
}

/* 结束 */

.brandreg-swiper .swiper-button-prev {
  position: absolute;
  left: -40px;
  right: auto;
}

.brandreg-swiper .swiper-button-next {
  position: absolute;
  right: -40px;
  left: auto;
}

.brandreg-swiper-hearder {
  font-size: 16px;
  height: 70px;
  background: #2f3353;
  color: #fff;
}

.brandreg-swiper-hearder > div {
  width: 100%;
  height: 100%;
  line-height: 70px;
}

.brandreg-swiper-hearder > div > div {
  display: inline-block;
}

.brandreg-swiper-hearder > div > div:nth-child(1) {
  width: 39px;
  height: 39px;
  margin-right: 15px;
}

.brandreg-swiper-hearder > div > div:nth-child(1) > img {
  width: 100%;
  height: 100%;
}

.brandreg-swiper-content ul {
  height: 145px;
  box-sizing: border-box;
  padding: 30px 26px 0;
}

.brandreg-swiper-content ul li {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFangSC;
  font-weight: 400;
  color: rgba(67, 67, 67, 1);
  margin-bottom: 15px;
}

.brandreg-swiper-content ul li:nth-last-child(1) {
  padding-bottom: 30px;
  border-bottom: 1px solid #ededef;
}

.brandreg-swiper-content ul li > div:nth-child(1) {
  width: 14px;
  /* height: 16px; */
  margin-right: 14px;
  margin-left: 41px;
}

.brandreg-swiper-content ul li > div:nth-child(1) > img {
  width: 100%;
  height: 100%;
}

.brandreg-swiper-content > div > div:nth-child(1) {
  font-size: 16px;
  margin-top: 15px;
  font-family: PingFangSC-Regular, PingFangSC;
  font-weight: 400;
  color: rgba(223, 0, 130, 1);
}

.brandreg-swiper-content > div > div:nth-child(1) > span {
  font-size: 36px;
}

.brandreg-swiper-content-button {
  width: 364px;
  height: 46px;
  border-radius: 1px;
  line-height: 46px;
  border: 1px solid rgba(0, 136, 199, 1);
  margin: 21px auto 0;
  font-size: 14px;
  font-family: PingFangSC-Regular, PingFangSC;
  font-weight: 400;
  color: rgba(0, 136, 199, 1);
}
</style>