index-page.vue 1.61 KB
<template>
  <LayoutApp :show-back="false" :title="title">
    <div class="body">
      <div class="content">
        <router-view></router-view>
      </div>
      <div class="footer">
        <Tabs :value="tabIndex" @click="onClick"></Tabs>
      </div>
    </div>
  </LayoutApp>
</template>

<script>

import Tabs from './components/tabs';

export default {
  name: 'IndexPage',
  props: ['tabIndex', 'title'],
  components: {
    Tabs
  },
  methods: {
    onClick(index) {
      switch (index) {
        case 0: {
          this.go('ChannelPage');
          break;
        }
        case 1: {
          this.go('CategoryPage');
          break;
        }
        case 2: {
          this.$yoho.auth({
            refer: '/xianyu/index/news'
          }).then((res) => {
            if(res) {
              this.go('NewsPage');
            }
          })
          break;
        }
        case 3: {
          this.$yoho.auth({
            refer: '/xianyu/index/mine'
          }).then((res) => {
            if(res) {
              this.go('MinePage');
            }
          })
          break;
        }
        default: {
          this.go('ChannelPage');
        }
      }
    },
    go(name) {
      this.$router.replace({
        name
      });
    }
  }
};
</script>

<style lang="scss" scoped>

* {
  transition: none !important;
  transform: none !important;
}

.body {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.content {
  flex: 1;
  overflow: hidden;
  background-color: white;
  position: relative;
}

.footer {
  border-top: 1px solid #eee;
  height: 100px;
  width: 100%;
  background-color: white;
}
</style>