artList.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 { article } from '@/api/user.js';
  19. export default {
  20. data() {
  21. return {
  22. list: [],
  23. page: 1,
  24. limit: 10,
  25. loadingType: 'more',
  26. cid: 0,
  27. }
  28. },
  29. onLoad(opt) {
  30. this.cid = opt.cid
  31. this.tit = decodeURI(opt.tit)
  32. uni.setNavigationBarTitle({
  33. title: this.tit
  34. })
  35. this.getArticleList()
  36. },
  37. methods: {
  38. navto(url) {
  39. uni.navigateTo({
  40. url: url
  41. })
  42. },
  43. getArticleList() {
  44. let obj = this
  45. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  46. return
  47. }
  48. obj.loadingType = 'loading'
  49. article({
  50. page: obj.page,
  51. limit: obj.limit
  52. },obj.cid).then(({data}) => {
  53. obj.list = obj.list.concat(data)
  54. obj.page++
  55. if(data.length == obj.limit) {
  56. obj.loadingType = 'more'
  57. }else {
  58. obj.loadingType = 'noMore'
  59. }
  60. })
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. page {
  67. background-color: #fff;
  68. min-height: 100%;
  69. }
  70. .jj-wrap {
  71. background-color: #fff;
  72. // margin: 20rpx 0;
  73. .jj {
  74. margin: auto;
  75. width: 689rpx;
  76. height: 202rpx;
  77. border-bottom: 1px solid #e5e5e5;
  78. padding: 20rpx;
  79. padding-left: 0;
  80. display: flex;
  81. &:last-of-type {
  82. border-bottom: none;
  83. }
  84. .jj-img {
  85. flex-shrink: 0;
  86. width: 222rpx;
  87. height: 158rpx;
  88. background-color: #bfa;
  89. border-radius: 10rpx;
  90. }
  91. .jj-info {
  92. width: 450rpx;
  93. // flex-shrink: 0;
  94. padding: 10rpx;
  95. padding-left: 15rpx;
  96. font-size: 32rpx;
  97. font-weight: bold;
  98. display: flex;
  99. flex-direction: column;
  100. justify-content: space-between;
  101. .jj-tit-tit {
  102. }
  103. .jj-val {
  104. padding-top: 20rpx;
  105. font-size: 28rpx;
  106. font-weight: 500;
  107. }
  108. }
  109. }
  110. }
  111. </style>