vote.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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" v-if="!loading">
  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. loading: false,
  52. tabActive: 'exhibitor',
  53. tabs: [{
  54. label: '展商',
  55. value: 'exhibitor'
  56. }, {
  57. label: '展品',
  58. value: 'exhibit'
  59. }],
  60. favoritesList: [],
  61. }
  62. },
  63. created() {
  64. this.checkAuth('/pages/user/vote')
  65. this.loadFontFace('Poppins')
  66. this.getExhibitorPollInfo()
  67. },
  68. onShow() {
  69. },
  70. methods: {
  71. tabChange(e) {
  72. this.tabActive = e.detail.value
  73. if (this.tabActive === 'exhibitor') {
  74. this.getExhibitorPollInfo()
  75. } else {
  76. this.getExhibitPollInfo()
  77. }
  78. },
  79. getExhibitorPollInfo() {
  80. this.loading = true
  81. getExhibitorPollList().then(res => {
  82. this.favoritesList = res.data.data
  83. this.loading = false
  84. })
  85. },
  86. getExhibitPollInfo() {
  87. this.loading = true
  88. getExhibitPollList().then(res => {
  89. this.favoritesList = res.data.data
  90. this.loading = false
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss">
  97. @import "@/static/style/pages/user-like.scss";
  98. </style>