import {
    getPromotionText
} from '~/api/sale'
Component({
    properties: {

    },
    data: {
        current: 0,
        list: []
    },
    lifetimes: {
        async attached() {
            let list = await getPromotionText()
            this.setData({
                list
            })
        }
    },
    methods: {
        openInvite() {
            this.selectComponent("#popUp").showModal()
        },
        closeInvite() {
            this.selectComponent("#popUp").hideModal()
        },
        swiperChange(e) {
            this.setData({
                current: e.detail.current
            })
        },
        clipboar() {
            wx.setClipboardData({
                data: this.data.list[this.data.current].text,
                success: function (res) { //成功回调函数
                    wx.showToast({
                        title: '已复制',
                        icon: "none"
                    })
                },
                fail(res) {
                    console.log(res, 'rrr');
                }
            })
        },
        createPoster() {
            this.closeInvite()
            this.selectComponent('#createPoster').open()
        },
        jump() {
            wx.navigateTo({
                url: '/salesperson/pages/gzhShare/index',
            })
        },
    }
})