dongtai.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="main">
  3. <view class="container">
  4. <view class="list">
  5. <view class="infobox" v-for="(item , index) in articleList" :key="index" @click="articleDetails(item.id)">
  6. <view class="left">
  7. <view class="infoname">{{item.title}}</view>
  8. <view class="infotxt">{{item.gist == null? '': item.gist}}</view>
  9. <view class="infolook">
  10. <image src="../../static/index/look.png"></image>
  11. <view>{{ item.virtual_view + item.view }}</view>
  12. </view>
  13. </view>
  14. <view class="right">
  15. <image :src="item.image"></image>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. name: 'articleList',
  25. data() {
  26. return {
  27. cate_id: null,
  28. articleList:[],
  29. }
  30. },
  31. onLoad(option) {
  32. console.log(option)
  33. this.cate_id = option.cate_id
  34. },
  35. mounted(){
  36. this.articleListData()
  37. },
  38. methods: {
  39. // 下拉刷新数据
  40. onPullDownRefresh: function(){
  41. this.articleListData()
  42. setTimeout(function () {
  43. uni.stopPullDownRefresh();
  44. }, 1000);
  45. },
  46. articleListData: async function(){
  47. let res = await this.$request.get('/api/Article/articleList?page=1&size=10&cate_id='+this.cate_id);
  48. console.log(res.data.data)
  49. if(res.code == 200){
  50. this.articleList = res.data.data
  51. }else{
  52. uni.showToast({
  53. icon: 'none',
  54. title: res.message
  55. });
  56. }
  57. },
  58. // 跳转到文章详情
  59. articleDetails(id){
  60. uni.navigateTo({
  61. url: '/pages/index/articleDetails?id=' + id
  62. })
  63. }
  64. }
  65. }
  66. </script>
  67. <style>
  68. page{
  69. background: #F5F5F5;
  70. }
  71. .main{
  72. width: 100vw;
  73. height: auto;
  74. margin-bottom: 20px;
  75. }
  76. .container{
  77. padding: 0 15px;
  78. }
  79. .list{
  80. width: 100%;
  81. height: auto;
  82. margin-top: 20px;
  83. }
  84. .list .infobox{
  85. width: 100%;
  86. height: 200rpx;
  87. margin: 15px 0;
  88. padding: 15rpx;
  89. display: flex;
  90. justify-content: space-between;
  91. background: #fff;
  92. border-radius: 5px;
  93. }
  94. .infobox .left{
  95. width: 54vw;
  96. }
  97. .infobox .right{
  98. width: 34vw;
  99. }
  100. .infobox .right .right-img-item{
  101. border-radius:12rpx;
  102. }
  103. .right image{
  104. width: 100%;
  105. height: 100%;
  106. }
  107. .left .infoname{
  108. /* width: 100%; */
  109. height: 80rpx;
  110. font-size: 32rpx;
  111. font-weight: 400;
  112. color: rgba(85,88,100,1);
  113. font-family: PingFangSC-Regular, sans-serif;
  114. /* overflow: hidden; */
  115. }
  116. .left .infotxt{
  117. width: 100%;
  118. height: 50rpx;
  119. line-height: 50rpx;
  120. color: #999;
  121. font-size: 24rpx;
  122. font-family: PingFangSC-Regular, sans-serif;
  123. overflow: hidden;
  124. text-overflow: ellipsis;
  125. white-space: nowrap;
  126. }
  127. .left .infolook{
  128. width: 100%;
  129. height: 50rpx;
  130. display: flex;
  131. align-items: center;
  132. }
  133. .infolook image{
  134. width: 34rpx;
  135. height: 34rpx;
  136. margin: 2px;
  137. border-radius: 12rpx;
  138. }
  139. .infolook view{
  140. width: auto;
  141. height: 30px;
  142. line-height: 30px;
  143. padding: 0 5px;
  144. color: #999;
  145. }
  146. </style>