index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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" platform="metting" @updateItemValue="updateItemValue()"/>
  14. </template>
  15. </view>
  16. </view>
  17. </u-scroll-view>
  18. </view>
  19. </template>
  20. <script>
  21. import NavBar from '@/components/layout/nav-bar'
  22. import UScrollView from '@/components/common/u-scroll-view'
  23. import ActivityItem from '@/pages/activity/components/activity-item.vue'
  24. import { mettingList, mettingDesc } from '@/api/exhibitor'
  25. export default {
  26. options: {
  27. styleIsolation: 'shared'
  28. },
  29. components: {
  30. NavBar,
  31. UScrollView,
  32. ActivityItem
  33. },
  34. data() {
  35. return {
  36. activityList: [],
  37. activityParams: {
  38. page: 1,
  39. page_size: 10,
  40. keyword: '',
  41. },
  42. activityListLoading: false,
  43. activityListLastPage: 1,
  44. mettingDesc: ''
  45. }
  46. },
  47. created() {
  48. this.getMettingDesc()
  49. this.getList()
  50. },
  51. methods: {
  52. getList() {
  53. this.activityListLoading = true
  54. mettingList(this.activityParams).then(res => {
  55. if (res.data.data) {
  56. if (this.activityParams.page > 1) {
  57. this.activityList = [...this.activityList, ...res.data.data]
  58. } else {
  59. this.activityList = res.data.data
  60. this.activityListLastPage = res.data.last_page
  61. }
  62. } else {
  63. this.showToast('系统繁忙,稍候再试')
  64. }
  65. this.activityListLoading = false
  66. })
  67. },
  68. updateItemValue(e) {
  69. this.activityList.forEach((item) => {
  70. if (item.id === e.id) {
  71. item[e.key] = e.value
  72. }
  73. })
  74. },
  75. getMettingDesc() {
  76. mettingDesc().then(res => {
  77. this.mettingDesc = res.data
  78. })
  79. }
  80. }
  81. }
  82. </script>
  83. <style lang="scss">
  84. .activity-head{
  85. color: #333333;
  86. .activity-head-title{
  87. font-weight: bold;
  88. font-size: $fontSize6;
  89. line-height: 49rpx;
  90. }
  91. .activity-head-desc{
  92. margin-top: 20rpx;
  93. font-size: $fontSize3;
  94. line-height: 40rpx;
  95. }
  96. .activity-favourites-text{
  97. white-space: nowrap;
  98. }
  99. }
  100. .activity-list{
  101. display: grid;
  102. grid-template-columns: 1fr;
  103. grid-row-gap: 30rpx;
  104. margin-top: 40rpx;
  105. color: #333333;
  106. }
  107. </style>