<template>
    <a-card :bordered="false">
        <a-steps class="steps" :current="currentTab">
            <a-step title="基础信息" />
            <a-step title="渠道号" />
        </a-steps>
        <div class="content">
            <step1 v-if="currentTab === 0" @nextStep="nextStep" ref="step" />
            <step2 v-if="currentTab === 1" />
            <step3 v-if="currentTab === 2" />
        </div>
    </a-card>
</template>

<script>
import Step1 from './components/checkCreat'
import Step2 from '../createChannel'
import Step3 from './components/uploadChannel'
export default {
    name: 'StepForm',
    components: {
        Step1,
        Step2,
        Step3
    },
    data() {
        return {
            currentTab: 0,

            // form
            form: null,
            campaignId: null,
            formComponent: null
        }
    },
    methods: {
        // handler
        nextStep() {
            // if (this.currentTab < 2) {
            //     this.currentTab += 1
            // }
            if (JSON.parse(localStorage.getItem('channelInfo')).createType == '1') {
                this.currentTab = 1
            } else {
                this.currentTab = 2
            }
        },
        prevStep() {
            if (this.currentTab > 0) {
                this.currentTab -= 1
            }
        },
        finish() {
            this.currentTab = 0
        },
        remove(key) {
            this.$emit('removeTab', key)
        }
    },
    watch: {},
    mounted() {
        if (localStorage.getItem('channelInfo')) {
            if (JSON.parse(localStorage.getItem('channelInfo')).createType == '1') {
                this.currentTab = 1
            } else {
                this.currentTab = 2
            }
        } else {
            this.currentTab = 0
        }
    }
}
</script>

<style lang="scss" scoped>
.steps {
    max-width: 750px;
    margin: 16px auto;
}
</style>
