<template>
  <div class="Detail">
    <div class="header-top">
      <div class="titles">{{ data.content }}</div>
      <div class="flex">
        <span class="left">
          <span class="type">{{ $dict.getLabel('wyGirdNewsType', data.type) }}</span>
          <span class="times">{{ data.name }}</span>
        </span>
      </div>
    </div>
    <div class="img-list" v-if="data.files">
      <div class="title">图片</div>
      <img :src="item.accessUrl" alt="" v-for="(item, index) in data.files" :key="index" @click="previewImage(data.files, item.accessUrl)" />
    </div>
  </div>
</template>

<script>
export default {
  name: 'Detail',
  data() {
    return {
      data: {},
      id: '',
      listName: '',
      selectList: []
    }
  },
  onLoad(o) {
    this.id = o.id
    this.$dict.load(['wyGirdNewsType']).then(() => {
      this.getDetail()
    })
    
  },
  onShow() {
    document.title = '网格动态'
  },
  methods: {
    previewImage(images, img) {
      uni.previewImage({
        urls: images.map(v => v.url),
        current: img
      })
    },
    getDetail() {
      this.$http.post(`/app/appgirdnews/queryDetailById?id=${this.id}`).then((res) => {
        if (res?.data) {
          this.data = res.data
        }
      })
    },
  },
}
</script>

<style scoped lang="scss">
.Detail {
  height: 100%;
  padding: 0 32px;
  background: #fff;

  .header-top {
    padding: 40px 0 32px 0;

    .titles {
      font-size: 48px;
      font-weight: 600;
      width: 100%;
      font-family: PingFangSC-Semibold, PingFang SC;
      color: #333;
      line-height: 66px;
      word-break: break-all;
      margin-bottom: 16px;
    }

    .titles-bottom {
      margin-top: 16px;
      font-size: 30px;
      color: #999999;

      .to-left {
        margin-left: 32px;
      }
    }
  }

  .header-middle {
    padding: 64px 0 48px 0;
    background: inherit;

    .contsnts {
      font-size: 36px;
      line-height: 1.5;
      word-break: break-all;
      background: inherit;
    }

    img {
      margin-top: 30px;
      width: 686px;
      height: 486px;
    }
  }

  .img-list {
    img {
      width: 204px;
      height: 204px;
      margin: 0 8px 8px 0;
    }

    .title {
      width: 100%;
      line-height: 112px;
      background: #FFF;
      font-size: 32px;
      font-family: PingFangSC-Regular, PingFang SC;
      color: #999;
    }
  }

  .flex {
    display: flex;
    justify-content: space-between;

    .left {
      .garydiv {
        font-size: 28px;
        color: #999999;
        background: #eeeeee;
        border-radius: 24px;
        padding: 4px 16px;
      }

      .times {
        font-size: 28px;
        color: #999999;
      }

      .type {
        display: inline-block;
        padding: 0 16px;
        line-height: 48px;
        background: #EEE;
        border-radius: 24px;
        font-size: 24px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #999;
        margin-right: 16px;
      }
    }

    .right {
      font-size: 28px;
      color: #999;

      img {
        width: 32px;
        height: 32px;
        vertical-align: middle;
        margin-right: 8px;
      }

      .font {
        color: #4181ff;
      }
    }
  }

  ::v-deep uni-video {
    width: 100%;
  }
}
</style>
