t-i-news.vue 2.3 KB

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