MediaItem.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <view @click="clickMediaItem" class="media_container">
  3. <u--image
  4. :showLoading="true"
  5. width="100%"
  6. mode="widthFix"
  7. :src="item.thumb"
  8. >
  9. <template v-slot:loading>
  10. <u-loading-icon color="red"></u-loading-icon>
  11. </template>
  12. </u--image>
  13. <image
  14. v-if="isVideo"
  15. class="play_icon"
  16. src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/chating_message_video_play.png"
  17. alt=""
  18. srcset=""
  19. />
  20. </view>
  21. </template>
  22. <script>
  23. import { MessageType, PageEvents } from "../../../../constant";
  24. import { secFormat } from "../../../../util/imCommon";
  25. export default {
  26. name: "",
  27. props: {
  28. item: Object,
  29. isVideo: Boolean,
  30. },
  31. data() {
  32. return {};
  33. },
  34. methods: {
  35. clickMediaItem() {
  36. // if (this.isVideo) {
  37. // uni.navigateTo({
  38. // url: `/pages/conversation/previewVideo/index?previewVideoUrl=${this.message.videoElem.videoUrl}`
  39. // })
  40. // } else {
  41. // const list = this.$store.getters.storePreviewImageList;
  42. // const idx = list.findIndex(item => item === this.getImgUrl)
  43. // uni.previewImage({
  44. // current: idx,
  45. // urls: list,
  46. // fail(err) {
  47. // console.log(err);
  48. // }
  49. // })
  50. // }
  51. },
  52. },
  53. };
  54. </script>
  55. <style lang="scss" scoped>
  56. .media_container {
  57. position: relative;
  58. border-radius: 16rpx;
  59. overflow: hidden;
  60. margin-bottom: 2%;
  61. .play_icon {
  62. width: 48px;
  63. height: 48px;
  64. position: absolute;
  65. top: 50%;
  66. left: 50%;
  67. transform: translate(-50%, -50%);
  68. }
  69. .video_duration {
  70. position: absolute;
  71. bottom: 12rpx;
  72. right: 24rpx;
  73. color: #fff;
  74. }
  75. }
  76. </style>