<template>
  <div>
    <van-nav-bar title="报告详情" @click-left="$router.back()" left-arrow fixed placeholder safe-area-inset-top />
    <div class="main">
      <van-row class="cell">
        <van-col span="6">报告事件：</van-col>
        <van-col span="18">
          <van-field v-model="form.event" placeholder="活动名称" />
        </van-col>
      </van-row>
      <van-row class="cell">
        <van-col span="6">报告人：</van-col>
        <van-col span="18">{{form.operator}}</van-col>
      </van-row>
      <van-row class="cell">
        <van-col span="6">报告时间：</van-col>
        <van-col span="18">
          <van-field v-model="form.mandatoryDate" placeholder="请选择" disabled />
        </van-col>
      </van-row>
      <van-row class="cell">
        <van-col span="6">联系电话：</van-col>
        <van-col span="18">
          <van-field v-model="form.phone" placeholder="请输入详细地址" />
        </van-col>
      </van-row>
      <van-row class="cell">
        <van-col span="6">报告详情：</van-col>
        <van-col span="18">
          <van-field class="textarea" v-model="form.content" rows="1" type="textarea" placeholder="请输入活动详情" />
        </van-col>
      </van-row>
      <div class="videoimg">
        <div>
          <p>照片：</p>
          <div class="boximg">
            <div v-for="(item,index) in pics" :key="index">
              <van-image fit="contain" :src="item" alt="" @click="show=true" />
            </div>
          </div>
          <van-image-preview v-model="show" :images="pics"></van-image-preview>
        </div>
        <div>
          <p>视频：</p>
          <div class="boximg">
            <div v-for="(item,index) in videos" :key="index">
              <video @click="showvideoplay=true,videourl=item" style="object-fit:cover;" :src="item" poster='../../assets/video.png'></video>
            </div>
          </div>
        </div>
      </div>
    </div>
    <van-dialog style="width:100%;border-radius:0;height:200px" v-model="showvideoplay" :show-cancel-button="false" :show-confirm-button="false" closeOnClickOverlay>
      <video controls preload="auto" style="width:100%;height:200px;object-fit: contain;" :src="videourl" v-if="videourl"></video>
    </van-dialog>
  </div>
</template>
<script>
import { mandatoryDetail } from '../../api/index.js'
export default {
  data() {
    return {
      show: false,
      showvideoplay: false,
      streetList: [],
      form: {},
      appendFile: '',
      id: '',
      orgform: {},
      pics: [],
      videos: [],
      videourl: '',
    }
  },
  created() {
    this.id = this.$route.query.id
    this.mandatoryDetail()
  },
  methods: {
    async mandatoryDetail() {
      const res = await mandatoryDetail({ id: this.id })
      this.form = res.data
      this.pics = res.data.pics.split(',')
      if (!res.data.videos) return
      this.videos = res.data.videos.split(',')
    },
  },
}
</script>
<style lang="scss" scoped>
.tx {
  width: 160px;
  height: 160px;
}
.message {
  padding: 0 30px;
}
.topBox {
  padding: 24px 0;
  border-bottom: 1px solid #eee;
}
.van-row {
  font-size: 30px;
  text-align: left;
}
.row {
  .van-col {
    line-height: 60px;
  }
}
.main {
  padding: 0 30px;
}
.cell {
  border-bottom: 1px solid #eee;
  margin-top: 16px;
  .van-col {
    line-height: 80px;
  }
  .van-cell {
    padding: 0;
    line-height: 80px;
  }
}
.textarea {
  line-height: 30px !important;
  margin-top: 25px;
}
.box {
  position: relative;
  height: 240px;
  .boxlist {
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    div {
      width: 200px;
      height: 200px;
      margin: 0 20px;
    }

    img {
      width: 100%;
      height: 100%;
    }
    video {
      width: 100%;
      height: 100%;
    }
    // background-color: chocolate;
  }
  .van-uploader {
    position: absolute;
    top: 0;
    left: 0;
    /deep/.van-uploader__wrapper {
      .van-uploader__upload {
        width: 200px;
        height: 200px;
      }
    }

    /deep/.van-uploader__preview {
      margin: 0 20px;
      .van-uploader__file {
        opacity: 0;
      }
      .van-image {
        width: 200px;
        height: 200px;
        opacity: 0;
        // margin: 20px;
      }
      width: 200px;
      height: 200px;
    }
  }
}
.videoimg {
  font-size: 30px;
}
.boximg {
  min-height: 100px;
  border: 1px solid #eee;
  padding: 20px 0;
  font-size: 26px;
  color: #999;
  display: flex;
  flex-wrap: wrap;

  //   justify-content: space-between;
  .van-image {
    max-width: 200px;
    // max-height: 200px;
    margin: 0 10px;
    //   margin-right: 16px;
    margin-bottom: 16px;
  }
  video {
    width: 180px;
    height: 180px;
    //   margin-right: 16px;
    margin-bottom: 16px;
  }
}
/deep/.van-field__control {
  color: #333;
}
/deep/.van-field__control:disabled {
  color: #333;
  -webkit-text-fill-color: unset;
}
</style>