// pages/promotional/modules/productList.js

Component({
    /**
     * 组件的属性列表
     */
    properties: {
        total: {
            type: String,
            value: "0"
        },
        list: {
            type: Array,
            value: []
        }
    },

    options: {
        addGlobalClass: true,
        shareData: null
    },

    /**
     * 组件的初始数据
     */
    data: {},

    /**
     * 组件的方法列表
     */
    methods: {
        toDetail(e) {
            const {
                item
            } = e.currentTarget.dataset;
            //type 1图片 2视频 3图文
            wx.navigateTo({
                url: `/marketing/promotional/details?id=${item.sat_sharematerialid}&type=${item.type}`,
            })
        },
        handleShare(e) {
            const {
                item,
                index
            } = e.currentTarget.dataset;
            this.setData({
                shareData: item,
                [`list[${index}].sharecount`]: item.sharecount + 1
            })
        }
    }
})