鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
3.1 KiB

  1. <template>
  2. <view class="live">
  3. <view class="flex live-header">
  4. <view>图片直播</view>
  5. <button class="flex btn">
  6. <view>查看全部</view>
  7. <image class="img" src="@/static/image/icon-arrow-right.png" mode="widthFix"></image>
  8. </button>
  9. </view>
  10. <!-- todo: auto scroll -->
  11. <view class="live-content">
  12. <view class="live-item" v-for="item in liveList" :key="item.id">
  13. <image class="live-item-bg" :src="item.image" mode="aspectFill"></image>
  14. <view class="live-item-info">
  15. <view class="text-ellipsis live-item-info-title">{{ item.title }}</view>
  16. <view class="live-item-info-time">{{ item.time }}</view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. data() {
  25. return {
  26. liveList: [],
  27. }
  28. },
  29. created() {
  30. this.getData()
  31. },
  32. methods: {
  33. getData() {
  34. // todo: fetch
  35. this.liveList = [
  36. {
  37. id: '001',
  38. image: '/static/image/temp-15.png',
  39. title: '苕溪露营漂流',
  40. time: '2025-04-18',
  41. },
  42. {
  43. id: '002',
  44. image: '/static/image/temp-16.png',
  45. title: '科技奇遇记',
  46. time: '2025-04-18',
  47. },
  48. {
  49. id: '003',
  50. image: '/static/image/temp-17.png',
  51. title: '满陇桂雨',
  52. time: '2025-04-18',
  53. },
  54. {
  55. id: '004',
  56. image: '/static/image/temp-18.png',
  57. title: '跟着皇帝游江南',
  58. time: '2025-04-18',
  59. },
  60. {
  61. id: '005',
  62. image: '/static/image/temp-15.png',
  63. title: '苕溪露营漂流',
  64. time: '2025-04-18',
  65. },
  66. {
  67. id: '006',
  68. image: '/static/image/temp-16.png',
  69. title: '科技奇遇记',
  70. time: '2025-04-18',
  71. },
  72. ]
  73. },
  74. },
  75. }
  76. </script>
  77. <style scoped lang="scss">
  78. .live {
  79. width: 100%;
  80. padding: 32rpx;
  81. box-sizing: border-box;
  82. background-image: linear-gradient(164deg,#DAF3FF, #FBFEFF , #FBFEFF);
  83. border: 2rpx solid #FFFFFF;
  84. border-radius: 32rpx;
  85. &-header {
  86. justify-content: space-between;
  87. font-size: 36rpx;
  88. font-weight: 500;
  89. color: #191919;
  90. .btn {
  91. column-gap: 4rpx;
  92. font-size: 24rpx;
  93. color: #8B8B8B;
  94. .img {
  95. width: 32rpx;
  96. height: auto;
  97. }
  98. }
  99. }
  100. &-content {
  101. margin-top: 16rpx;
  102. white-space: nowrap;
  103. width: 100%;
  104. overflow-x: auto;
  105. font-size: 0;
  106. }
  107. &-item {
  108. flex: none;
  109. display: inline-block;
  110. width: 180rpx;
  111. height: 240rpx;
  112. border-radius: 12rpx;
  113. overflow: hidden;
  114. position: relative;
  115. & + & {
  116. margin-left: 16rpx;
  117. }
  118. &-bg {
  119. width: 100%;
  120. height: 100%;
  121. }
  122. &-info {
  123. position: absolute;
  124. left: 0;
  125. bottom: 0;
  126. width: 100%;
  127. padding: 8rpx 12rpx;
  128. box-sizing: border-box;
  129. &-title {
  130. font-size: 26rpx;
  131. font-weight: 600;
  132. color: #FFFFFF;
  133. }
  134. &-time {
  135. font-size: 22rpx;
  136. color: #FFFFFF;
  137. }
  138. }
  139. }
  140. }
  141. </style>