Component({
    options: {},
    /**
     * 组件的属性列表
     */
    properties: {
        show: {
            type: Boolean,
            value: false,
        },
    },
    /**
     * 组件的初始数据
     */
    data: {
        currentStep: 'first',
        currentStepIndex: 0,
        stepTexts: [
            '这里请输入你想让小朋友熟悉的汉字、字母、数字等，点击“确定”',
            '点击这里修改颜色',
            '点击这里删除',
            '这里会生成图片，点击下载后可打印、涂色、识字',
        ],
        platform: '',
    },
    lifetimes: {
        attached() {
            const { platform } = wx.getDeviceInfo();
            this.setData({
                platform,
            });
        },
    },
    /**
     * 组件的方法列表
     */
    methods: {
        onClose() {
            this.triggerEvent('onClose');
        },

        toNextStep() {
            const stepArr = ['first', 'second', 'third', 'fourth'];
            const { currentStepIndex: preStepIndex } = this.data;

            if (preStepIndex === 3) return this.triggerEvent('onClose');
            const currentStepIndex = preStepIndex + 1;

            this.setData({
                currentStepIndex,
                currentStep: stepArr[currentStepIndex],
            });
        },

        preventScroll() { },
    },
});
