hanbaoshan
2021-02-28 72f553661a74b225c89310d3fb3d78f3ebe35f82
src/components/subComponents/CardItem.vue
@@ -31,9 +31,8 @@
        </div>
        <div
          class="s-card-left-isCompare-div compareScore111"
          style
          :style="{
            bottom: getBottom(),
            bottom: '0',
            background: getUrl(data.baseInfo[initialIndex].bwType)
          }"
        >
@@ -57,8 +56,9 @@
            <img :src="item | httpImage" class="cursor-pointer" @click="detailsClick($event)" />
          </el-carousel-item>
        </el-carousel>
        <!-- 暂时认为只有人脸抓拍的报警, 首页显示小图, 其他时间均显示大图 -->
        <img
          v-else-if="data.targetInfo == null || data.targetInfo[0].picSmUrl == ''"
          v-else-if="data.targetInfo == null || data.targetInfo[0].targetType !== 'FaceDetect'"
          :src="data.picMaxUrl[0] | httpImage"
          class="cursor-pointer"
          @click="detailsClick($event)"
@@ -74,6 +74,7 @@
        <img :src="data.baseInfo[0] | httpImage" class="cursor-pointer" />
      </div>
    </div>
    <!-- 右侧文字区域 -->
    <!-- 多张底图切换 -->
    <div class="s-card-right-isCompare" v-if="showType == 'compare'">
@@ -492,7 +493,8 @@
export default {
  mounted() {
    window.addEventListener("resize", this.watchWindow);
    //window.addEventListener("resize", this.watchWindow);
    window.addEventListener("resize", this.getBottom)
  },
  props: {
    data: {
@@ -555,13 +557,14 @@
  },
  methods: {
    getBottom() {
      // let imgDom = document.getElementById(str)
      let imgDom = this.$refs.firstImg
      if (imgDom) {
        let num = (imgDom.offsetHeight - imgDom.offsetWidth) / 2
        return `${num}px`;
      }
      return `4px`;
      this.$nextTick(() => {
        let imgDom = this.$refs.firstImg
        if (imgDom) {
          let num = (imgDom.offsetHeight - imgDom.offsetWidth) / 2
          return `${num}px`;
        }
        return `4px`;
      })
    },
    getUrl(bwtype) {
      if (bwtype == 1) {
@@ -640,11 +643,11 @@
    .card-img-box {
      box-sizing: border-box;
      width: 100%;
      height: 100%;
      position: relative;
      overflow: hidden;
      top: 50%;
      transform: translateY(-50%);
      .card-img-box-compear {
        height: 100%;
        width: 100%;
        display: flex;
        .card-img-box-compear-left {
@@ -653,8 +656,13 @@
          justify-content: center;
          align-items: Center;
          overflow: hidden;
          width: 100%;
          flex: 1;
          height: 100%;
        }
        .el-carousel {
          flex: 1;
          width: auto;
          height: auto !important;
        }
        .el-carousel__item {
          display: flex;
@@ -692,9 +700,10 @@
      }
    }
    img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
      //height: 100%;
      //object-fit: contain;
    }
    .s-card-left-isCompare-div {
      width: 60px;