list.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <view class="list">
  3. <template v-if="cid == 11">
  4. <view class="order-item" @click="ToDetail(1)">
  5. <view class="list-cell">
  6. <image class="image" src="../../static/img/personal.jpg"></image>
  7. <view class="list-tpl">个人会员报名</view>
  8. </view>
  9. </view>
  10. <view class="order-item" @click="ToDetail(2)">
  11. <view class="list-cell">
  12. <image class="image" src="../../static/img/group.jpg"></image>
  13. <view class="list-tpl">团队会员报名</view>
  14. </view>
  15. </view>
  16. </template>
  17. <template v-if="cid == 12">
  18. <view class="order-item" @click="ToDetail(3)">
  19. <view class="list-cell">
  20. <image class="image" src="../../static/img/zffw.jpg"></image>
  21. <view class="list-tpl">志愿服务报名</view>
  22. </view>
  23. </view>
  24. </template>
  25. <template v-if="cid != 11 && cid != 12">
  26. <empty v-if="loaded && list.length==0"></empty>
  27. </template>
  28. <view class="list-item" v-for="item in list" @click="navTo('/pages/article/detail?id=' + item.id)">
  29. <view class="article-tit">{{item.title}}</view>
  30. <view class="article-time">{{item.release_time}}</view>
  31. </view>
  32. <uni-load-more :status="loadingType"></uni-load-more>
  33. </view>
  34. </template>
  35. <script>
  36. import empty from '../../components/empty.vue'
  37. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  38. import { getArticleList } from '../../api/index.js'
  39. export default {
  40. components: {
  41. uniLoadMore,
  42. empty
  43. },
  44. data() {
  45. return {
  46. cid: '',
  47. list: [],
  48. page: 1,
  49. limit: 10,
  50. loadingType: 'more',
  51. loaded: false
  52. }
  53. },
  54. onLoad(opt) {
  55. if(opt.cid) {
  56. this.cid = opt.cid
  57. }
  58. this.getList()
  59. },
  60. methods: {
  61. navTo(url) {
  62. uni.navigateTo({
  63. url: url
  64. })
  65. },
  66. getList() {
  67. let obj =this
  68. if(obj.loadingType == 'loading' || obj.loadingType == 'noMore') {
  69. return
  70. }
  71. obj.loadingType = 'loading'
  72. getArticleList({
  73. page: obj.page,
  74. limit: obj.limit
  75. },obj.cid).then( ({data}) => {
  76. console.log(data)
  77. obj.list = obj.list.concat(data.list)
  78. obj.page++
  79. if(data.length == obj.limit) {
  80. obj.loadingType = 'more'
  81. }else {
  82. obj.loadingType = 'noMore'
  83. }
  84. obj.$set(obj,'loaded',true)
  85. })
  86. },
  87. //跳转到详情
  88. ToDetail(index) {
  89. if(index == 1) {
  90. uni.navigateTo({
  91. url: '/pages/cart/personal'
  92. })
  93. }
  94. if(index == 2) {
  95. uni.navigateTo({
  96. url: '/pages/cart/group'
  97. })
  98. }
  99. if(index == 3) {
  100. uni.navigateTo({
  101. url: '/pages/form/tovolApply'
  102. })
  103. }
  104. }
  105. }
  106. }
  107. </script>
  108. <style lang="scss" scoped>
  109. .list-item {
  110. border-bottom: 1px solid #ccc;
  111. border-top: 1px solid #ccc;
  112. padding:20rpx 35rpx;
  113. line-height: 1.5;
  114. .article-tit {
  115. font-size: 34rpx;
  116. color: #000000;
  117. font-weight: 500;
  118. letter-spacing: 3rpx;
  119. }
  120. .article-time {
  121. font-size: 28rpx;
  122. color: #888;
  123. font-weight: 500;
  124. }
  125. }
  126. .order-item {
  127. width: 100%;
  128. padding: 0rpx 25rpx;
  129. padding-top: 25rpx !important;
  130. .list-cell {
  131. background-color: #ffffff;
  132. border-radius: 20rpx;
  133. width: 100%;
  134. box-shadow: 0px 0px 40px 0px rgba(0, 0, 0, 0.06);
  135. .image {
  136. width: 100%;
  137. height: 300rpx;
  138. border-top-left-radius: 25rpx;
  139. border-top-right-radius: 25rpx;
  140. }
  141. .list-tpl {
  142. padding: 25rpx 25rpx;
  143. padding-bottom: 35rpx !important;
  144. font-size: 34rpx;
  145. color: #222222;
  146. font-weight:500;
  147. }
  148. }
  149. }
  150. </style>