t-i-news.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="content">
  3. <view class="title">
  4. <view class="text">新闻动态</view>
  5. <view class="more" @click="go_more()">查看全部 <uni-icons type="arrowright" color="#999" size="11"></uni-icons>
  6. </view>
  7. </view>
  8. <view class="list">
  9. <view class="item" v-for="(item,index) in newsList" :key="index" @click="go_detail(item.id)">
  10. <view class="left">
  11. <image :src="item.main_img"></image>
  12. </view>
  13. <view class="right">
  14. <view class="title">{{item.title}}</view>
  15. <view class="time">{{item.created_at}}</view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. name: "t-i-news",
  24. props: [
  25. "newsList",
  26. "mine_code"
  27. ],
  28. data() {
  29. return {
  30. list: []
  31. };
  32. },
  33. methods: {
  34. // 打开详情页
  35. go_detail(id) {
  36. uni.navigateTo({
  37. url: "../../index/news/news?id=" + id + "&mine_code=" + this.mine_code
  38. })
  39. },
  40. // 打开列表
  41. go_more(){
  42. uni.navigateTo({
  43. url: "../../index/news/news_list/news_list?mine_code=" + this.mine_code
  44. })
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. .content {
  51. margin-top: 0;
  52. margin-bottom: 20rpx;
  53. background-color: #FFFFFF;
  54. box-sizing: border-box;
  55. padding: 30rpx 25rpx;
  56. }
  57. .title {
  58. display: flex;
  59. align-items: baseline;
  60. justify-content: space-between;
  61. .text {
  62. font-size: 36rpx;
  63. }
  64. .more {
  65. font-size: 26rpx;
  66. color: #999;
  67. }
  68. }
  69. .list {
  70. margin-top: 20rpx;
  71. width: 700rpx;
  72. .item {
  73. box-sizing: border-box;
  74. padding-top: 20rpx;
  75. padding-bottom: 12rpx;
  76. display: flex;
  77. .left {
  78. width: 240rpx;
  79. height: 136rpx;
  80. image {
  81. width: 240rpx;
  82. height: 136rpx;
  83. border-radius: 8rpx;
  84. overflow: hidden;
  85. }
  86. }
  87. .right {
  88. margin-left: 22rpx;
  89. display: flex;
  90. flex-flow: column;
  91. justify-content: space-around;
  92. .title {
  93. overflow: hidden;
  94. -webkit-line-clamp: 2;
  95. text-overflow: ellipsis;
  96. display: -webkit-box;
  97. -webkit-box-orient: vertical;
  98. font-size: 32rpx;
  99. font-weight: 400;
  100. color: #121212;
  101. line-height: 40rpx;
  102. }
  103. .time {
  104. font-size: 26rpx;
  105. font-weight: 400;
  106. color: #999;
  107. line-height: 40rpx;
  108. }
  109. }
  110. }
  111. }
  112. </style>