wenzhanList.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view @click="linkDetails(item)" v-for="(item,index) in newsList" :key="index" class="box" >
  5. <view class="box_img">
  6. <u--image radius='16rpx' width="224rpx" height="168rpx" :src="item.coverList[0].fileUrl" ></u--image>
  7. </view>
  8. <view class="box_right">
  9. <view class="box_title">
  10. {{item.title}}
  11. </view>
  12. <view class="box_type">
  13. <view style="display: flex;justify-content: space-between;">
  14. <view v-for="item2 in item.columnTag" :class="currentName == 'default' ?'type_one':'type_one_index'">
  15. {{item2}}
  16. </view>
  17. </view>
  18. <!-- <view>{{ computerTime(item) }}</view> -->
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. props: {
  28. listdata: {
  29. type: Array,
  30. default: ()=>[],
  31. },
  32. currentName:{
  33. type:String,
  34. default:'default'
  35. }
  36. },
  37. watch:{
  38. listdata: {
  39. immediate: true,
  40. handler(val) {
  41. // console.log(val);
  42. this.newsList = val.map(v => {
  43. let columnTag = []
  44. if (v?.columnTag) {
  45. columnTag = v?.columnTag.split(',')
  46. }
  47. return {
  48. ...v,
  49. columnTag
  50. }
  51. })
  52. console.log('this.newsList',this.newsList );
  53. },
  54. }
  55. },
  56. data() {
  57. return {
  58. newsList:[]
  59. }
  60. },
  61. onLoad(e) {
  62. },
  63. methods: {
  64. computerTime(data){
  65. let time = data?.time || data?.createTime
  66. if (time) {
  67. return time.slice(5,10)
  68. }else{
  69. return ''
  70. }
  71. },
  72. linkDetails(e){
  73. uni.navigateTo({
  74. url: '/pages/home/ArticleDetails?id=' + e.id
  75. });
  76. }
  77. }
  78. }
  79. </script>
  80. <style>
  81. .content{
  82. width: 100vw;
  83. background-color: #FFFFFF;
  84. padding: 30rpx 0 30rpx 0;
  85. }
  86. .box{
  87. display: flex;
  88. margin: 40rpx auto;
  89. justify-content: flex-start;
  90. width: 90vw;
  91. height: 160rpx;
  92. }
  93. .box_img{
  94. width: 224rpx;
  95. height: 168rpx;
  96. border-radius: 16rpx;
  97. background-color: #999999;
  98. }
  99. .box_right{
  100. margin-left: 10rpx;
  101. display: flex;
  102. flex-direction: column;
  103. justify-content: space-between;
  104. }
  105. .box_title{
  106. width: 454rpx;
  107. height: 80rpx;
  108. font-size: 28rpx;
  109. font-weight: bold;
  110. color: #333333;
  111. line-height: 40rpx;
  112. margin-left: 12rpx;
  113. display: -webkit-box;
  114. word-break: break-all;
  115. text-overflow: ellipsis;
  116. overflow: hidden;
  117. -webkit-box-orient: vertical;
  118. -webkit-line-clamp:2;
  119. }
  120. .box_type{
  121. display: flex;
  122. justify-content: space-between;
  123. font-size: 28rpx;
  124. font-weight: 400;
  125. color: #999999;
  126. line-height: 40rpx;
  127. }
  128. .type_one{
  129. width: 136rpx;
  130. height: 48rpx;
  131. background: #DEEEFC;
  132. border-radius: 8rpx 8rpx 8rpx 8rpx;
  133. opacity: 1;
  134. margin-left: 4rpx;
  135. font-size: 28rpx;
  136. font-weight: 400;
  137. color: #46A6FF;
  138. line-height: 48rpx;
  139. text-align: center;
  140. }
  141. .type_one_index{
  142. width: 136rpx;
  143. height: 48rpx;
  144. /* background: #DEEEFC; */
  145. border-radius: 8rpx 8rpx 8rpx 8rpx;
  146. opacity: 1;
  147. font-size: 28rpx;
  148. font-weight: 400;
  149. color: #999;
  150. line-height: 48rpx;
  151. text-align: center;
  152. }
  153. </style>