index.vue 2.6 KB
<!--
 * @Author: yangming yangming@didihu.com.cn
 * @Date: 2022-10-12 09:30:11
 * @LastEditors: yangming yangming@didihu.com.cn
 * @LastEditTime: 2022-11-23 09:50:08
 * @FilePath: \scrm-micro-drainage\src\views\channel\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="channel-main">
    <GLTabs v-model="activeName" :tabPaneList="tabPaneList" class="tabs-panel"></GLTabs>
    <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'
import a from '@/api/modules/channel'
export default {
  name: 'channel',
  components: {
    channelList,
    channelStatistics
  },
  data() {
    return {
      activeName: 'first',
      tabPaneList: [
        {
          label: '渠道码列表',
          name: 'first'
        },
        {
          label: '数据统计',
          name: 'second'
        }
      ]
    }
  },
  methods: {
    render(createElement) {
      createElement(
        'div',
        {
          class: {
            'channel-main': true
          }
        },
        [createElement('el-tabs', {})]
      )
    },
    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() {
    console.log(a)
    this.wxTips()
  }
}
</script>

<style lang="scss" scoped>
.channel-main {
  .tabs-panel {
    margin-bottom: 10px;
  }
}
</style>