m-video-topbottom.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="video-item" :style="{width: `${(750-30*column-30)/column}rpx`}"
  3. @click="gotoPaly">
  4. <view class="image-box">
  5. <view class="img-box">
  6. <image class="image" :src="carVideoItem.cover" mode="aspectFill"></image>
  7. </view>
  8. <text>{{carVideoItem.duration}}</text>
  9. <m-icon class="icon" type="bofangshipin"></m-icon>
  10. </view>
  11. <text>{{carVideoItem.title}}</text>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. carVideoItem: {
  18. type: Object,
  19. default: {}
  20. },
  21. column: {
  22. type: Number,
  23. default: 2
  24. },
  25. palyObj: {
  26. type: Object,
  27. default: null
  28. }
  29. },
  30. name: "m-video-topbottom",
  31. methods:{
  32. gotoPaly(){
  33. if(!this.palyObj){
  34. this.$utils.route.goPage('/pages/carVideo/play',null,{carVideoItem:this.carVideoItem})
  35. }else{
  36. this.$emit('click')
  37. }
  38. }
  39. }
  40. }
  41. </script>
  42. <style lang="scss">
  43. .video-item {
  44. margin-right: 30rpx;
  45. margin-top: 30rpx;
  46. position: relative;
  47. display: flex;
  48. flex-direction: column;
  49. justify-content: center;
  50. text-align: center;
  51. .image-box {
  52. position: relative;
  53. .img-box {
  54. width: 100%;
  55. padding-bottom: 64%;
  56. position: relative;
  57. .image {
  58. position: absolute;
  59. left: 0;
  60. top: 0;
  61. width: 100%;
  62. height: 100%;
  63. }
  64. }
  65. text {
  66. position: absolute;
  67. color: #8A9099;
  68. right: 2rpx;
  69. bottom: 2rpx;
  70. }
  71. .icon {
  72. position: absolute;
  73. left: 50%;
  74. top: 50%;
  75. transform: translate(-50%, -50%);
  76. }
  77. }
  78. text {
  79. font-size: 30rpx;
  80. font-weight: 400;
  81. line-height: 39rpx;
  82. color: #0F0404;
  83. white-space: nowrap;
  84. text-overflow: ellipsis;
  85. overflow: hidden;
  86. }
  87. }
  88. </style>