index.vue 1.91 KB
<template>
  <div class="channel-main">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="渠道码列表" name="first"></el-tab-pane>
      <el-tab-pane label="数据统计" name="second"></el-tab-pane>
    </el-tabs>
    <channel-list v-if="activeName == 'first'"></channel-list>
    <channel-statistics v-if="activeName == 'second'"></channel-statistics>
  </div>
</template>

<script>
import channelList from './components/channelList'
import channelStatistics from './components/channelStatistics'
export default {
  name: 'channel',
  components: {
    channelList,
    channelStatistics
  },
  data() {
    return {
      activeName: 'first'
    }
  },
  methods: {
    jumpWx() {
      this.$history.push('/settings/enterpriseWechat/index')
    },
    wxTips() {
      const menu = JSON.parse(sessionStorage['SCRM_BASE_MENULIST'])
      menu.forEach(item => {
        if (!item.children) {
          return
        }
        item.children.forEach(itm => {
          if (itm.path == '/enterpriseWechat/index') {
            this.$apis.channel.getStatus({}).then(res => {
              if (res.status != 'SUCCESS') {
                const h = this.$createElement
                this.$message({
                  showClose: true,
                  duration: 0,
                  message: h('p', null, [h('span', null, '此功能需完成【企业微信授权】后方可使用! '), h('span', { on: { click: this.jumpWx }, style: { marginRight: '150px', cursor: 'pointer', color: '#5850ff' } }, ['企业微信授权 ', h('i', { class: 'el-icon-d-arrow-right' }, '')])])
                })
              }
            })
          }
        })
      })
    },
    handleClick() {}
  },
  beforeDestroy() {
    this.$message.closeAll()
  },
  mounted() {
    this.wxTips()
  }
}
</script>

<style lang="scss" scoped>
.channel-main {
  /deep/ {
    .el-tabs__nav-wrap::after {
      height: 0px;
    }
  }
}
</style>