vote.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <page-layout class="user-vote user-like">
  3. <nav-bar title="我的投票" @init="onInitNavbar"></nav-bar>
  4. <u-scroll-view>
  5. <view class="user-vote-tabs-wrapper user-like-tabs-wrapper">
  6. <view class="user-vote-tabs 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-vote-list user-like-list">
  12. <template v-for="(item, index) in favoritesList">
  13. <template v-if="tabActive === 'exhibitor'">
  14. <exhibitor-item :item="item" :footer-hidden="true" :key="index" />
  15. </template>
  16. <template v-else-if="tabActive === 'exhibit'">
  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. getExhibitorPollList,
  33. getExhibitPollList
  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. ExhibitItem,
  45. ExhibitorItem
  46. },
  47. computed: {
  48. },
  49. data() {
  50. return {
  51. tabActive: 'exhibitor',
  52. tabs: [{
  53. label: '展商',
  54. value: 'exhibitor'
  55. }, {
  56. label: '展品',
  57. value: 'exhibit'
  58. }],
  59. favoritesList: [],
  60. }
  61. },
  62. created() {
  63. this.checkAuth('/pages/user/vote')
  64. this.loadFontFace('Poppins')
  65. this.getExhibitorPollInfo()
  66. },
  67. onShow() {
  68. },
  69. methods: {
  70. tabChange(e) {
  71. this.tabActive = e.detail.value
  72. if (this.tabActive === 'exhibitor') {
  73. this.getExhibitorPollInfo()
  74. } else {
  75. this.getExhibitPollInfo()
  76. }
  77. },
  78. getExhibitorPollInfo() {
  79. this.loading = true
  80. getExhibitorPollList().then(res => {
  81. this.favoritesList = res.data.data
  82. console.log(this.favoritesList)
  83. this.loading = false
  84. })
  85. },
  86. getExhibitPollInfo() {
  87. this.loading = true
  88. getExhibitPollList().then(res => {
  89. this.favoritesList = res.data.data
  90. console.log(this.favoritesList)
  91. this.loading = false
  92. })
  93. }
  94. }
  95. }
  96. </script>
  97. <style lang="scss">
  98. @import "@/static/style/pages/user-like.scss";
  99. </style>