artList.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="jj-wrap">
  3. <view class="jj" v-for="cp in list" @click="navto('/pages/index/artDetail?id=' + cp.id)">
  4. <image :src="cp.image_input[0]" mode="" class="jj-img"></image>
  5. <view class="jj-info">
  6. <view class="jj-tit-tit clamp2">
  7. {{cp.title}}
  8. </view>
  9. <view class="jj-val clamp">
  10. 更新时间{{cp.add_time}}
  11. </view>
  12. </view>
  13. </view>
  14. <uni-load-more :status="loadingType"></uni-load-more>
  15. </view>
  16. </template>
  17. <script>
  18. import {
  19. loadIndexs,
  20. getArticleList
  21. } from '@/api/index.js';
  22. export default {
  23. data() {
  24. return {
  25. list: [],
  26. page: 1,
  27. limit: 10,
  28. loadingType: 'more',
  29. cid: 0,
  30. }
  31. },
  32. onLoad(opt) {
  33. this.cid = opt.cid
  34. this.getArticleList()
  35. },
  36. methods: {
  37. navto(url) {
  38. uni.navigateTo({
  39. url: url
  40. })
  41. },
  42. getArticleList() {
  43. let obj = this
  44. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  45. return
  46. }
  47. obj.loadingType = 'loading'
  48. getArticleList({
  49. page: obj.page,
  50. limit: obj.limit
  51. },obj.cid).then(({data}) => {
  52. obj.list = obj.list.concat(data)
  53. obj.page++
  54. if(data.length == obj.limit) {
  55. obj.loadingType = 'more'
  56. }else {
  57. obj.loadingType = 'noMore'
  58. }
  59. })
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. page {
  66. background-color: #fff;
  67. min-height: 100%;
  68. }
  69. .jj-wrap {
  70. background-color: #fff;
  71. // margin: 20rpx 0;
  72. .jj {
  73. margin: auto;
  74. width: 689rpx;
  75. height: 202rpx;
  76. border-bottom: 1px solid #e5e5e5;
  77. padding: 20rpx;
  78. padding-left: 0;
  79. display: flex;
  80. &:last-of-type {
  81. border-bottom: none;
  82. }
  83. .jj-img {
  84. flex-shrink: 0;
  85. width: 222rpx;
  86. height: 158rpx;
  87. background-color: #bfa;
  88. border-radius: 10rpx;
  89. }
  90. .jj-info {
  91. width: 450rpx;
  92. // flex-shrink: 0;
  93. padding: 10rpx;
  94. padding-left: 15rpx;
  95. font-size: 32rpx;
  96. font-weight: bold;
  97. display: flex;
  98. flex-direction: column;
  99. justify-content: space-between;
  100. .jj-tit-tit {
  101. }
  102. .jj-val {
  103. padding-top: 20rpx;
  104. font-size: 28rpx;
  105. font-weight: 500;
  106. }
  107. }
  108. }
  109. }
  110. </style>