<template>
  <div class="main">
    <!-- 搜索 -->
    <search-bar readonly @click.native="onSearch"></search-bar>
    <card :title="title">
      <activity-list :show-index="!type" :params="{ type }"></activity-list>
    </card>
  </div>
</template>

<script>
// components
import SearchBar from '@/components/SearchBar'
import Card from '@/components/Card'
import ActivityList from '@/components/ActivityList'
export default {
  name: 'ActivityIndex',
  components: { SearchBar, Card, ActivityList },
  data() {
    return {}
  },
  computed: {
    type() {
      return this.$route.query.type
    },
    title() {
      const typeMap = {
        1: '公益行',
        2: '去游学',
        3: '直播课',
        4: '找工作',
        5: '运动家'
      }
      return typeMap[this.type] || '活动热度榜'
    }
  },
  methods: {
    onSearch() {
      this.$router.push({ name: 'search', query: { tab: '2' } })
    }
  }
}
</script>

<style lang="scss"></style>
