zhanghua
2022-12-05 c88f56fbd311766de4245ba74789eebd7ee65eab
src/components/filePictrue/index.vue
@@ -1,118 +1,125 @@
<template>
    <div class="file-picture">
        <div class="file-tell">
            <div class="tell-title">上报</div>
            <div class="tell-show" v-for="item in imgSource" :key="item.id">
                <div v-if="item.type == '01'" style="display:flex">
                    <div class="my-demo" v-for="childer in item.url">
                        <img class="img" :src="childer" alt="">
                        <div class="tip">
                            <div>【图片类型】上报</div>
                            <div>【上传时间】{{ changeTime(item.createTime) }}</div>
                        </div>
                    </div>
                </div>
  <div class="file-picture">
    <div class="file-tell">
      <div class="tell-title">上报</div>
      <div class="tell-show" v-for="item in imgSource" :key="item.id">
        <div v-if="item.type == '01'" style="display: flex">
          <div class="my-demo" v-for="childer in item.url">
            <img class="img" :src="childer" alt="" />
            <div class="tip">
              <div>【图片类型】上报</div>
              <div>【上传时间】{{ changeTime(item.createTime) }}</div>
            </div>
          </div>
        </div>
        <div class="file-deal">
            <div class="tell-title">处置</div>
            <div class="tell-show" v-for="item in imgSource" :key="item.id">
                <div v-if="item.type == '02'" class="tell-demo">
                    <div class="my-demo" v-for="childer in item.url">
                        <img class="img" :src="childer" alt="">
                        <div class="tip">
                            <!-- <div>【图片类型】处置</div> -->
                            <div>【上传时间】{{ changeTime(item.createTime) }}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
      </div>
    </div>
    <div class="file-deal">
      <div class="tell-title">处置</div>
      <div class="tell-show" v-for="item in imgSource" :key="item.id">
        <div v-if="item.type == '02'" class="tell-demo">
          <div class="my-demo" v-for="childer in item.url">
            <img class="img" :src="childer" alt="" />
            <div class="tip">
              <!-- <div>【图片类型】处置</div> -->
              <div>【上传时间】{{ changeTime(item.createTime) }}</div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { parseTime } from "@/utils/index"
import { parseTime } from "@/utils/index";
export default {
    data() {
        return {
            imgSource: []
        }
  data() {
    return {
      imgSource: [],
    };
  },
  props: ["filesPictureVo", "mycode"],
  created() {
    const {
      filesPictureVo: { imageResources: imgList },
    } = this;
    let pic = this.filesPictureVo.imageResources;
    pic.forEach((item) => {
      item.url = item.url.split(",");
    });
    this.imgSource = pic;
    // this.getEventInfo(this.mycode);
  },
  methods: {
    // 获取token
    getToken() {
      const token = sessionStorage.getItem("token");
      const tokenHead = sessionStorage.getItem("tokenHead");
      if (token && tokenHead) {
        return { Authorization: tokenHead + token };
      }
    },
    props: ['filesPictureVo', 'mycode'],
    created() {
        const { filesPictureVo: { imageResources: imgList } } = this
        this.getEventInfo(this.mycode);
    changeTime(time) {
      if (time) {
        return parseTime(time);
      }
    },
    methods: {
        // 获取token
        getToken() {
            const token = sessionStorage.getItem('token');
            const tokenHead = sessionStorage.getItem('tokenHead');
            if (token && tokenHead) {
                return { Authorization: tokenHead + token };
            }
        },
        changeTime(time) {
            if (time) {
                return parseTime(time)
            }
        },
        getEventInfo(mycode) {
            this.$axios({
                method: 'get',
                url: `sccg/base_case/baseCaseDetail/${mycode}`
            })
                .then(res => {
                    this.info = res.data;
                    this.dialogView = true;
                    let pic = res.data.filesPictureVo.imageResources;
                    pic.forEach(item => {
                        item.url = item.url.split(',')
                    })
                    this.imgSource = pic;
                })
        },
    }
}
    getEventInfo(mycode) {
      this.$axios({
        method: "get",
        url: `sccg/base_case/baseCaseDetail/${mycode}`,
      }).then((res) => {
        this.info = res.data;
        this.dialogView = true;
        let pic = res.data.filesPictureVo.imageResources;
        pic.forEach((item) => {
          item.url = item.url.split(",");
        });
        this.imgSource = pic;
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.file-picture {
    padding-top: 50px;
  padding-top: 50px;
    .file-tell,
    .file-deal {
        .tell-title {
            line-height: 40px;
        }
        .tell-show {
            .tell-demo {
                display: flex;
                flex-wrap: wrap;
                width: 100%;
            }
        }
  .file-tell,
  .file-deal {
    .tell-title {
      line-height: 40px;
    }
    .my-demo {
        position: relative;
        height: 159px;
        margin: 10px;
    .tell-show {
      .tell-demo {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
      }
    }
  }
  .my-demo {
    position: relative;
    height: 159px;
    margin: 10px;
  }
  .tip {
    div {
      line-height: 20px;
    }
    .tip {
        div {
            line-height: 20px;
        }
    text-align: left;
    position: absolute;
    bottom: 0px;
  }
        text-align: left;
        position: absolute;
        bottom: 0px;
    }
    .img {
        width: 226px;
        height: 159px;
    }
  .img {
    width: 226px;
    height: 159px;
  }
}
</style>