index-page.vue 2 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) {
      this.$store.dispatch('reportYas', {
      params: {
        param: {TAB_ID: index + 1 },
        appop: 'XY_UFO_MAIN_TAB'
      }
    });
      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;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
}

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

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

@supports (bottom: env(safe-area-inset-bottom)) {
  .content {
    height: calc(env(safe-area-inset-bottom) + 100% + 88px);
  }

  .footer {
    height: calc(env(safe-area-inset-bottom) + 100px);
  }
}
</style>