<template>
  <!-- 材料预览弹窗 -->
  <div class="preview-modal flex jcc aic">
    <div class="preview-box flex flexc aic">
      <div class="preview-header flex flexc jca">
        <p class="materails-name tac">{{ previewInfo.materialName }}</p>
        <p class="materails-full-name tac">
          材料全称：{{ previewInfo.materiaFullName }}
        </p>
      </div>
      <div class="preview-img-box scroll3 flex1 flex jcc aic">
        <img
          :src="
            previewInfo.preview
              ? api + previewInfo.preview
              : api + previewInfo.preViewPath
          "
        />
      </div>
      <div class="footer-btn flex aic jcc">
        <slot></slot>
      </div>
    </div>
  </div>
</template>

<script>
import local from "@/utils/local";
export default {
  props: {
    previewInfo: {
      type: Object,
      required: true,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      api: local.getLocal("baseUrl")
        ? local.getLocal("baseUrl")
        : "http://192.168.0.98:11074",
    };
  },
};
</script>

<style lang="less" scoped>
.preview-modal {
  width: 100%;
  height: 100%;
  position: fixed;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 1200;
  .preview-box {
    width: 40%;
    height: 90%;
    padding-top: 20px;
    background-color: #fff;
    border-radius: 10px;
    .preview-header {
      width: 100%;
      height: 80px;
      margin-bottom: 10px;
    }
    .materails-name {
      font-size: 28px;
      color: #333;
    }
    .materails-full-name {
      color: #999;
    }
    .preview-img-box {
      width: 80%;
      height: 80%;
      box-shadow: 1px 1px 4px 4px #ccc;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .footer-btn {
      width: 100%;
      height: 100px;
    }
  }
}
</style>