<template>
  <view @click="clickMediaItem" class="media_container">
    <u--image
      :showLoading="true"
      width="100%"
      mode="widthFix"
      :src="item.thumb"
    >
      <template v-slot:loading>
        <u-loading-icon color="red"></u-loading-icon>
      </template>
    </u--image>
    <image
      v-if="isVideo"
      class="play_icon"
      src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/chating_message_video_play.png"
      alt=""
      srcset=""
    />
  </view>
</template>

<script>
import { MessageType, PageEvents } from "../../../../constant";
import { secFormat } from "../../../../util/imCommon";
export default {
  name: "",
  props: {
    item: Object,
    isVideo: Boolean,
  },
  data() {
    return {};
  },
  methods: {
    clickMediaItem() {
      // if (this.isVideo) {
      // 	uni.navigateTo({
      // 		url: `/pages/conversation/previewVideo/index?previewVideoUrl=${this.message.videoElem.videoUrl}`
      // 	})
      // } else {
      // 	const list = this.$store.getters.storePreviewImageList;
      // 	const idx = list.findIndex(item => item === this.getImgUrl)
      // 	uni.previewImage({
      // 		current: idx,
      // 		urls: list,
      // 		fail(err) {
      // 			console.log(err);
      // 		}
      // 	})
      // }
    },
  },
};
</script>

<style lang="scss" scoped>
.media_container {
  position: relative;
  border-radius: 16rpx;
  overflow: hidden;
  margin-bottom: 2%;

  .play_icon {
    width: 48px;
    height: 48px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .video_duration {
    position: absolute;
    bottom: 12rpx;
    right: 24rpx;
    color: #fff;
  }
}
</style>
