like.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <page-layout class="user-like">
  3. <nav-bar title="我的点赞" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view>
  5. <view class="user-like-tabs-wrapper">
  6. <view class="user-like-tabs">
  7. <u-tabs :active.sync="tabActive" :tabs="tabs" @change="tabChange" />
  8. </view>
  9. </view>
  10. <view class="main-container">
  11. <view class="user-like-list" v-if="!loading">
  12. <template v-for="(item, index) in likeList">
  13. <template v-if="tabActive === 'exhibitor'">
  14. <exhibitor-item :item="item" :footer-hidden="true" :key="index" />
  15. </template>
  16. <template v-else>
  17. <exhibit-item :item="item" :footer-hidden="true" :key="index" />
  18. </template>
  19. </template>
  20. </view>
  21. </view>
  22. </u-scroll-view>
  23. </page-layout>
  24. </template>
  25. <script>
  26. import NavBar from '@/components/layout/nav-bar'
  27. import UTabs from '@/components/common/u-tabs'
  28. import UScrollView from '@/components/common/u-scroll-view'
  29. import ExhibitItem from '@/pages/exhibitor/components/exhibit-item.vue'
  30. import ExhibitorItem from '@/pages/exhibitor/components/exhibitor-item.vue'
  31. import {
  32. getExhibitorLikeList,
  33. getExhibitLikeList
  34. } from '@/api/user'
  35. import PageLayout from "@/components/layout/page-layout";
  36. export default {
  37. options: {
  38. styleIsolation: 'shared'
  39. },
  40. components: {
  41. PageLayout,
  42. NavBar,
  43. UTabs,
  44. UScrollView,
  45. ExhibitItem,
  46. ExhibitorItem
  47. },
  48. computed: {},
  49. data() {
  50. return {
  51. loading: false,
  52. tabActive: 'exhibitor',
  53. tabs: [{
  54. label: '展商',
  55. value: 'exhibitor'
  56. }, {
  57. label: '展品',
  58. value: 'exhibit'
  59. }],
  60. likeList: [],
  61. }
  62. },
  63. created() {
  64. this.checkAuth('/pages/user/like')
  65. this.loadFontFace('Poppins')
  66. this.getExhibitorLikeInfo()
  67. },
  68. onShow() {},
  69. methods: {
  70. tabChange(e) {
  71. this.tabActive = e.detail.value
  72. if (this.tabActive === 'exhibitor') {
  73. this.getExhibitorLikeInfo()
  74. } else {
  75. this.getExhibitLikeInfo()
  76. }
  77. },
  78. getExhibitorLikeInfo() {
  79. this.loading = true
  80. getExhibitorLikeList().then(res => {
  81. this.likeList = res.data.data
  82. this.loading = false
  83. })
  84. },
  85. getExhibitLikeInfo() {
  86. this.loading = true
  87. getExhibitLikeList().then(res => {
  88. this.likeList = res.data.data
  89. this.loading = false
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss">
  96. @import "@/static/style/pages/user-like.scss";
  97. </style>