<template>
  <div class="max-w1280">
    <div class="layer specifications-wrap mb1">
      <div class="banner">
        <img class="banner-img" src="@/assets/img/icon/ggs.png">
      </div>
      <div class="search-input-wrap">
        <el-input class="input-wrap" v-model="specifications" size="large"  @click="user.searchFalg = true" placeholder="请输入您要查询的元器件型号" @keyup.enter.native="SearchFun">
          <template #append>
            <div @click="SearchFun">
              <el-icon>
                <Search />
              </el-icon>
            </div>
          </template>
        </el-input>
      </div>
      <div class="search-result">
        <p class="tips">大家都在搜</p>
        <ul>
          <li v-for="i in ProductArr" :key="i.id">
            <h3><img src="@/assets/img/pdf.svg" alt="" srcset="">{{i.materialSn}}</h3>
            <a :href="i.goodsManual">查看</a>
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Search } from "@element-plus/icons-vue";
import { useAll } from "~/api/pubAll/service";
const { selectProductLike } = useAll();
let pageTitle: any = ref("HOTKING-规格书");
useHead(() => ({
  title: pageTitle.value,
}));
const user = useUserStore();
const nuxtApp = useNuxtApp();
const isClient = !nuxtApp.ssrContext;
let specifications = ref("");
function SearchFun() {}

const {
  data: ssrProductData,
  error,
  refresh,
} = await useAsyncData<any>("selectProductLike", () =>
  selectProductLike({
    pageNum: 1,
    pageSize: 10,
    queryValue: "",
    categoryId: "",
    categoryName: "",
    brandName: "",
    attrs: [],
    brandId: "",
    goodsType: "",
    type: "",
    specParam: "",
    language: 1,
  })
);
const ProductArr:any = ref<any[]>(ssrProductData.value?.data.records || []);
</script>
<style scoped lang="scss">
.specifications-wrap {
  padding-bottom: 10px;
}
.banner-img {
  height: 247px;
  width: 100%;
}
.search-input-wrap {
  padding: 1px 12px 6px 12px;
  display: flex;
  .input-wrap {
    height: 32px;
    background: #fff;
    border-radius: 28px;
    width: 100%;
    border: 1px solid rgba(0, 0, 0, 0.15);
  }
  :deep(.el-input--large .el-input__wrapper) {
    border-radius: 28px;
    box-shadow: unset;
    padding-right: 0;
  }
  :deep(.el-input__inner) {
    height: 30px;
    line-height: 20px;
    padding: 5px 0;
  }
  :deep(.el-input__prefix) {
    font-size: 18px;
  }
  .el-input:deep(.el-input__wrapper.is-focus) {
    box-shadow: unset !important;
  }
  :deep(.el-input-group__append) {
    background: #fff;
    border-radius: 0 25px 25px 0;
    box-shadow: 0 0 0 1px #fff inset;
    color: $mainColor;
    padding: 0 10px;
    .el-icon {
      width: 26px;
      height: 26px;
      font-size: 18px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
}
.search-result {
  padding: 12px;
  padding-bottom: 0;
  .tips {
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
  }
  ul {
    li {
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid #e8e8e8;
      padding: 0 5px;
      height: 40px;
      h3 {
        color: #333;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        img {
          width: 20px;
          margin-right: 5px;
        }
      }
      a {
        background: $mainColor;
        color: #fff;
        border-radius: 36px;
        height: 24px;
        line-height: 24px;
        padding: 0 15px;
        font-size: 12px;
      }
    }
  }
}
</style>