news.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view>
  3. <view class="title" >
  4. <view class="title_text">{{info.title}}</view>
  5. <view class="title_more" @click="clicktoMore">更多></view>
  6. </view>
  7. <view v-if="menuslist.length>0">
  8. <wenzhanList currentName='index' :listdata="menuslist" ></wenzhanList>
  9. </view>
  10. </view>
  11. </template>
  12. <script>
  13. import wenzhanList from '@/pages/components/wenzhanList.vue'
  14. import {moduleByFour} from '@/http/api/common.js'
  15. export default {
  16. components: {
  17. wenzhanList,
  18. },
  19. data() {
  20. return {
  21. menuslist:[],
  22. info:{
  23. title:'最新资讯'
  24. }
  25. }
  26. },
  27. async mounted() {
  28. this.getmoduleByFour()
  29. },
  30. methods: {
  31. async getmoduleByFour(){
  32. //获取模块4
  33. let res = await moduleByFour()
  34. this.menuslist = []
  35. if (res.data.code == 200) {
  36. this.info = res.data.data
  37. if (res.data.data.articleVoList) {
  38. const arr = res.data.data.articleVoList;
  39. this.menuslist = arr.slice(0, 3);
  40. }
  41. }
  42. },
  43. clicktoMore(){
  44. if (this.info?.moreToSubId && this.info?.moreToColumnId) {
  45. let data = {
  46. curNowid:this.info?.moreToColumnId,
  47. curNowsubid:this.info?.moreToSubId,
  48. }
  49. uni.setStorageSync('curNowdata',JSON.stringify(data) );
  50. uni.switchTab({
  51. url: '/pages/home/Information',
  52. });
  53. }
  54. },
  55. }
  56. }
  57. </script>
  58. <style>
  59. .title{
  60. display: flex;
  61. width: 90vw;
  62. justify-content: space-between;
  63. margin: 0 auto;
  64. }
  65. .title_text{
  66. width: 128rpx;
  67. height: 45rpx;
  68. font-size: 32rpx;
  69. font-weight: bold;
  70. color: #333333;
  71. line-height: 45rpx;
  72. }
  73. .title_more{
  74. width: 80rpx;
  75. height: 40rpx;
  76. font-size: 28rpx;
  77. font-weight: 500;
  78. color: #999999;
  79. line-height: 40rpx;
  80. }
  81. .box{
  82. display: flex;
  83. margin: 20rpx auto;
  84. justify-content: flex-start;
  85. width: 90vw;
  86. height: 160rpx;
  87. }
  88. .box_img{
  89. width: 224rpx;
  90. height: 150rpx;
  91. border-radius: 16rpx;
  92. background-color: #999999;
  93. }
  94. .box_right{
  95. margin-left: 10rpx;
  96. display: flex;
  97. flex-direction: column;
  98. justify-content: space-around;
  99. }
  100. .box_title{
  101. width: 454rpx;
  102. height: 80rpx;
  103. font-size: 28rpx;
  104. font-weight: bold;
  105. color: #333333;
  106. line-height: 40rpx;
  107. display: -webkit-box;
  108. word-break: break-all;
  109. text-overflow: ellipsis;
  110. overflow: hidden;
  111. -webkit-box-orient: vertical;
  112. -webkit-line-clamp:2;
  113. }
  114. .box_type{
  115. display: flex;
  116. justify-content: space-between;
  117. font-size: 28rpx;
  118. font-weight: 400;
  119. color: #999999;
  120. line-height: 40rpx;
  121. }
  122. </style>