artList.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <view class="jj-wrap">
  3. <view class="jj" v-for="cp in item[index].list" @click="navto('/pages/index/artListType?id=' + cp.id+'&type='+item[index].type+'&title='+encodeURI(cp.title))">
  4. <image :src="cp.image" 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 clamp2">
  10. {{cp.intr}}
  11. </view>
  12. </view>
  13. </view>
  14. <uni-load-more :status="item[index].loadingType"></uni-load-more>
  15. </view>
  16. </template>
  17. <script>
  18. import { articleList } from '@/api/user.js';
  19. export default {
  20. data() {
  21. return {
  22. index:0,
  23. cid:0,
  24. item:[{
  25. list: [],
  26. page: 1,
  27. limit: 10,
  28. title:'粟珈依安',
  29. loadingType: 'more',
  30. type: 3,
  31. },
  32. {
  33. list: [],
  34. page: 1,
  35. limit: 10,
  36. title:'康养家居',
  37. loadingType: 'more',
  38. type: 2,
  39. },
  40. {
  41. list: [],
  42. page: 1,
  43. limit: 10,
  44. title:'调理养护',
  45. loadingType: 'more',
  46. type: 0,
  47. },
  48. {
  49. list: [],
  50. page: 1,
  51. limit: 10,
  52. title:'专家专项',
  53. loadingType: 'more',
  54. type: 1,
  55. },{
  56. list: [],
  57. page: 1,
  58. limit: 10,
  59. title:'公司文化',
  60. loadingType: 'more',
  61. type: 4,
  62. }]
  63. }
  64. },
  65. onLoad(opt) {
  66. this.index = opt.type;
  67. this.cid = opt.id;
  68. uni.setNavigationBarTitle({
  69. title: this.item[this.index].title
  70. })
  71. this.getArticleList()
  72. },
  73. methods: {
  74. navto(url) {
  75. uni.navigateTo({
  76. url: url
  77. })
  78. },
  79. getArticleList() {
  80. let obj = this.item[this.index];
  81. if(obj.loadingType == 'noMore' || obj.loadingType == 'loading') {
  82. return
  83. }
  84. obj.loadingType = 'loading';
  85. articleList({
  86. page: obj.page,
  87. limit: obj.limit,
  88. fl:obj.type,
  89. }).then(({data}) => {
  90. obj.list = obj.list.concat(data)
  91. obj.page++
  92. if(data.length == obj.limit) {
  93. obj.loadingType = 'more'
  94. }else {
  95. obj.loadingType = 'noMore'
  96. }
  97. })
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. page {
  104. background-color: #fff;
  105. min-height: 100%;
  106. }
  107. .jj-wrap {
  108. background-color: #fff;
  109. // margin: 20rpx 0;
  110. .jj {
  111. margin: auto;
  112. width: 689rpx;
  113. height: 202rpx;
  114. border-bottom: 1px solid #e5e5e5;
  115. padding: 20rpx;
  116. padding-left: 0;
  117. display: flex;
  118. &:last-of-type {
  119. border-bottom: none;
  120. }
  121. .jj-img {
  122. flex-shrink: 0;
  123. width: 222rpx;
  124. height: 158rpx;
  125. background-color: #bfa;
  126. border-radius: 10rpx;
  127. }
  128. .jj-info {
  129. width: 450rpx;
  130. // flex-shrink: 0;
  131. padding: 0 10rpx;
  132. padding-left: 15rpx;
  133. font-size: 32rpx;
  134. font-weight: bold;
  135. display: flex;
  136. flex-direction: column;
  137. justify-content: space-around;
  138. .jj-tit-tit {
  139. }
  140. .jj-val {
  141. font-size: 28rpx;
  142. font-weight: 500;
  143. }
  144. }
  145. }
  146. }
  147. </style>