t-i-news.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. background-color: #FFFFFF;
  52. box-sizing: border-box;
  53. padding: 50rpx 25rpx;
  54. }
  55. .title {
  56. display: flex;
  57. align-items: baseline;
  58. justify-content: space-between;
  59. .text {
  60. font-size: 36rpx;
  61. }
  62. .more {
  63. font-size: 26rpx;
  64. color: #999;
  65. }
  66. }
  67. .list {
  68. margin-top: 20rpx;
  69. width: 700rpx;
  70. .item {
  71. box-sizing: border-box;
  72. padding-top: 20rpx;
  73. padding-bottom: 12rpx;
  74. display: flex;
  75. .left {
  76. width: 240rpx;
  77. height: 136rpx;
  78. image {
  79. width: 240rpx;
  80. height: 136rpx;
  81. border-radius: 8rpx;
  82. overflow: hidden;
  83. }
  84. }
  85. .right {
  86. margin-left: 22rpx;
  87. display: flex;
  88. flex-flow: column;
  89. justify-content: space-around;
  90. .title {
  91. overflow: hidden;
  92. -webkit-line-clamp: 2;
  93. text-overflow: ellipsis;
  94. display: -webkit-box;
  95. -webkit-box-orient: vertical;
  96. font-size: 32rpx;
  97. font-weight: 400;
  98. color: #121212;
  99. line-height: 40rpx;
  100. }
  101. .time {
  102. font-size: 26rpx;
  103. font-weight: 400;
  104. color: #999;
  105. line-height: 40rpx;
  106. }
  107. }
  108. }
  109. }
  110. </style>