news-module.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view class="news_module vflex">
  3. <block v-for="(item,index) in pageList" :key="index">
  4. <view class="news_box" @click="toDetail(item.id)">
  5. <view class="news_title">
  6. {{item.title}}
  7. </view>
  8. <view class="hflex acenter user" v-if="item.user">
  9. <view class="avatar_box">
  10. <image :src="item.user.avatar" mode="aspectFill" class="avatar"></image>
  11. </view>
  12. <view class="user_text">{{item.user.name}}</view>
  13. <view v-if="item.user.is_blueV" class="blue_v">
  14. V
  15. </view>
  16. </view>
  17. <view v-if="item.imgs.length > 0" class="imgList hflex acenter jbetween">
  18. <block v-for="(item2,index2) in item.imgs" :key="index2">
  19. <image :src="item2" mode="aspectFill" class="img" @tap.stop="priveImg(index,index2)"></image>
  20. </block>
  21. </view>
  22. <view v-if="item.video" class="imgList">
  23. <video :src="item.video" controls></video>
  24. </view>
  25. <view class="hflex acenter bottom">
  26. <view class="bottom_text">{{item.type}}</view>
  27. <view class="bottom_text2">{{item.client}}</view>
  28. <view class="bottom_text2">{{item.comment}}评论</view>
  29. </view>
  30. </view>
  31. </block>
  32. </view>
  33. </template>
  34. <script>
  35. import $api from '@/static/js/api.js'
  36. export default {
  37. name:"news-module",
  38. props: {
  39. pageList: {
  40. type: Array,
  41. value: []
  42. }
  43. },
  44. data() {
  45. return {
  46. }
  47. },
  48. methods: {
  49. // 打开详情
  50. toDetail(id) {
  51. $api.jump('/page_index/pages/index/newDetail?id=' + id)
  52. },
  53. // 查看图片
  54. priveImg(index,index2) {
  55. var that = this
  56. uni.previewImage({
  57. urls: that.pageList[index].imgs,
  58. current: that.pageList[index].imgs[index2]
  59. });
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss">
  65. .news_module {
  66. width: 100%;
  67. .news_box {
  68. margin-top: 20rpx;
  69. padding-bottom: 20rpx;
  70. border-bottom: 1rpx solid #f3f3f3;
  71. .news_title {
  72. font-size: 36rpx;
  73. color: #333;
  74. line-height: 50rpx;
  75. }
  76. .user {
  77. padding: 14rpx 0 0;
  78. .avatar_box {
  79. margin-right: 8rpx;
  80. .avatar {
  81. width: 32rpx;
  82. height: 32rpx;
  83. border-radius: 50%;
  84. }
  85. }
  86. .user_text {
  87. font-size: 24rpx;
  88. font-weight: 400;
  89. color: #666666;
  90. line-height: 34rpx;
  91. }
  92. .blue_v {
  93. background: #506DFF;
  94. border-radius: 12rpx 4rpx 12rpx 4rpx;
  95. margin-left: 8rpx;
  96. text-align: center;
  97. line-height: 28rpx;
  98. // padding: 6rpx;
  99. width: 28rpx;
  100. height: 28rpx;
  101. color: #fff;
  102. font-size: 14rpx;
  103. }
  104. }
  105. .imgList {
  106. margin: 16rpx 0;
  107. .img {
  108. width: 224rpx;
  109. height: 148rpx;
  110. border-radius: 8rpx 0px 0px 8rpx;
  111. margin: 0 12rpx 20rpx 0;
  112. }
  113. }
  114. .bottom {
  115. .bottom_text {
  116. font-size: 24rpx;
  117. color: #3261FF;
  118. }
  119. .bottom_text2 {
  120. color: #999999;
  121. font-size: 24rpx;
  122. margin-left: 20rpx;
  123. }
  124. }
  125. }
  126. }
  127. </style>