index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="activity-index">
  3. <nav-bar title="同期活动" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view :tabbar-conflict="true">
  5. <view class="main-container">
  6. <view class="activity-head">
  7. <view class="activity-head-title">同期活动</view>
  8. <view class="activity-head-desc">{{ mettingDesc }}</view>
  9. </view>
  10. <van-empty v-if="activityList.length === 0" description="暂无数据" />
  11. <view v-else class="activity-list">
  12. <template v-for="(item, index) in activityList">
  13. <activity-item :item="item" :key="index" @updateItemCollect="updateItemCollect"/>
  14. </template>
  15. </view>
  16. <!-- <disclaimer-text></disclaimer-text> -->
  17. </view>
  18. </u-scroll-view>
  19. </view>
  20. </template>
  21. <script>
  22. import NavBar from '@/components/layout/nav-bar'
  23. import UScrollView from '@/components/common/u-scroll-view'
  24. import ActivityItem from '@/pages/activity/components/activity-item.vue'
  25. import DisclaimerText from '@/components/disclaimer-text/index.vue'
  26. import { mettingList, mettingDesc } from '@/api/exhibitor'
  27. export default {
  28. options: {
  29. styleIsolation: 'shared'
  30. },
  31. components: {
  32. NavBar,
  33. UScrollView,
  34. ActivityItem,
  35. DisclaimerText
  36. },
  37. data() {
  38. return {
  39. activityList: [{ favourited: true }, {}, {}],
  40. activityParams: {
  41. page: 1,
  42. page_size: 10,
  43. keyword: '',
  44. },
  45. activityListLoading: false,
  46. activityListLastPage: 1,
  47. mettingDesc: ''
  48. }
  49. },
  50. created() {
  51. this.getMettingDesc()
  52. this.getList()
  53. },
  54. methods: {
  55. getList() {
  56. this.activityListLoading = true
  57. mettingList(this.activityParams).then(res => {
  58. if (res.data.data) {
  59. if (this.activityParams.page > 1) {
  60. this.activityList = [...this.activityList, ...res.data.data]
  61. } else {
  62. this.activityList = res.data.data
  63. this.activityListLastPage = res.data.last_page
  64. }
  65. } else {
  66. this.showToast('系统繁忙,稍候再试')
  67. }
  68. this.activityListLoading = false
  69. })
  70. },
  71. updateItemCollect(e) {
  72. this.activityList.forEach((item) => {
  73. if (item.id === e.id) {
  74. item.is_collect = item.is_collect === 1 ? 0 : 1
  75. }
  76. })
  77. },
  78. getMettingDesc() {
  79. mettingDesc().then(res => {
  80. this.mettingDesc = res.data
  81. })
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. .activity-head{
  88. color: #333333;
  89. .activity-head-title{
  90. font-weight: bold;
  91. font-size: $fontSize6;
  92. line-height: 49rpx;
  93. }
  94. .activity-head-desc{
  95. margin-top: 20rpx;
  96. font-size: $fontSize3;
  97. line-height: 40rpx;
  98. }
  99. .activity-favourites-text{
  100. white-space: nowrap;
  101. }
  102. }
  103. .activity-list{
  104. display: grid;
  105. grid-template-columns: 1fr;
  106. grid-row-gap: 30rpx;
  107. margin-top: 40rpx;
  108. color: #333333;
  109. }
  110. </style>