t-i-news.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.detail_url)">
  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(detail_url) {
  37. // uni.navigateTo({
  38. // url: "../../index/news/news?id=" + id + "&mine_code=" + this.mine_code
  39. // })
  40. uni.navigateTo({
  41. url:"../../index/h5/h5?url="+detail_url
  42. })
  43. },
  44. // 打开列表
  45. go_more(){
  46. uni.navigateTo({
  47. url: "../../index/news/news_list/news_list?mine_code=" + this.mine_code
  48. })
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. .content {
  55. margin-top: 0;
  56. margin-bottom: 20rpx;
  57. background-color: #FFFFFF;
  58. box-sizing: border-box;
  59. padding: 30rpx 25rpx;
  60. }
  61. .title {
  62. display: flex;
  63. align-items: baseline;
  64. justify-content: space-between;
  65. .text {
  66. font-size: 36rpx;
  67. }
  68. .more {
  69. font-size: 26rpx;
  70. color: #999;
  71. }
  72. }
  73. .list {
  74. margin-top: 20rpx;
  75. width: 700rpx;
  76. .item {
  77. box-sizing: border-box;
  78. padding-top: 20rpx;
  79. padding-bottom: 12rpx;
  80. display: flex;
  81. .left {
  82. width: 240rpx;
  83. height: 136rpx;
  84. image {
  85. width: 240rpx;
  86. height: 136rpx;
  87. border-radius: 8rpx;
  88. overflow: hidden;
  89. }
  90. }
  91. .right {
  92. margin-left: 22rpx;
  93. display: flex;
  94. flex-flow: column;
  95. justify-content: space-around;
  96. .title {
  97. overflow: hidden;
  98. -webkit-line-clamp: 2;
  99. text-overflow: ellipsis;
  100. display: -webkit-box;
  101. -webkit-box-orient: vertical;
  102. font-size: 32rpx;
  103. font-weight: 400;
  104. color: #121212;
  105. line-height: 40rpx;
  106. }
  107. .time {
  108. font-size: 26rpx;
  109. font-weight: 400;
  110. color: #999;
  111. line-height: 40rpx;
  112. }
  113. }
  114. }
  115. }
  116. </style>