<template>
  <div class="banner">
    <div class="imgBox">
      <img src="image/banner/banner_product.png" alt="">
    </div>
    <div class="banner-con bg-absolute">
      <span>{{lang===langType.cn?"产品中心":getAbbrText("产品中心")}}</span>
      <span class="subTitle">{{lang===langType.cn?"持续创新的软硬件产品":getLangText("持续创新的软硬件产品")}}</span>
      <span>1</span>
    </div>
    <div class="banner-con">
      <span>{{lang===langType.cn?"产品中心":getAbbrText("产品中心")}}</span>
      <span class="subTitle">{{lang===langType.cn?"持续创新的软硬件产品":getLangText("持续创新的软硬件产品")}}</span>
      <div class="search-box">
        <div class="search">
          <input type="text" :placeholder="`${lang===langType.cn?'输入产品名称':getLangText('输入产品名称')}`" v-model="key">
          <button type="button" @click="searchProduct">O</button>
        </div>
      </div>

    </div>


  </div>
</template>

<script>
import langMap from "@/map/langMap";

export default {
  name: "productBanner",
  props:{
    pKey:{},
    lang:{
      default: langMap.lang.cn
    },
  },
  data(){
    return {
      langType: langMap.lang,
      key:this.pKey?this.pKey:'',
    }
  },

  methods:{
    getLangText(str){
      return langMap.getText(this.lang,str);
    },
    getAbbrText(str){
      return langMap.getAbbrText(this.lang,str);
    },
    searchProduct(){
      this.$root.$emit('searchProductKey',this.key);
    }
  }
}
</script>

<style scoped>
.banner {
  width: 100%;
  position: relative;
  display: flex;
  overflow: hidden;
  height: 450px;
  justify-content: center;
  align-items: center;
}
.banner *{
  transition: all .4s;
}
.banner .imgBox{
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
}
.banner:hover .imgBox > img{
  left: -20px;
  top: -20px;
  max-width: calc(100% + 40px);
  width: calc(100% + 40px);
  height: calc(100% + 40px);
}
.banner-con{
  position: relative;
  padding: 15px 30px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  margin-top: 100px;
}
.bg-absolute{
  position: absolute;
  filter: blur(5px);
  background-image: linear-gradient(rgba(0,0,0,0) 0,rgba(0,0,0,0.5) 60% );
  color: #b9b7b7;
}
.banner-con > span{
  width: 420px;
  font-size: 2.5em;
  color: white;
  font-weight: bold;
  cursor: default;
  display: flex;
  justify-content: center;
}
.banner:hover .banner-con > span{
  font-size: 2.6em;
}
.banner-con > .subTitle{
  font-size: 2em;
}
.banner:hover .banner-con > .subTitle{
  font-size: 1.9em;
}


.banner-con .search-box{
  width: 100%;
  display: flex;
  justify-content: center;
}
.banner-con .search{
  width: 340px;
  height: 40px;
  margin-top: 10px;
  /*background-color: #fff;*/
  box-shadow: 1px 1px 6px 4px #22b3e5;
  border-radius: 40px;
  cursor: pointer;
  overflow: hidden;
  position: relative;

}
.banner:hover .banner-con .search{
  width: 400px;
  border: 1px solid #ffffff;
}
.banner-con .search > *{
  display: block;
}
.banner-con .search-box .search input{
  width: 100%;
  height: 100%;
  border-radius: 40px;
  outline: #22b3e5;
  BACKGROUND-COLOR: transparent;
  padding-left: 15px;
  color: #b4b4b4;
}
.banner-con .search-box .search button{
  display: block;
  width: 40px;
  height: 40px;
  position: absolute;
  right: 0;
  top: 0;
  color: white;
  font-size: 1.4em;
}
.banner-con .search-box .search button:hover{
  font-size: 1.6em;
  color: orangered;
}
</style>
