<template>
    <div :style="styleData.prizePreviewNewAll" ref="hdzxtDrawPrize">
        <div :style="styleData.prizePreviewNew" class="prizePreviewNew">
            <div :style="styleData.listStyle" class="prize-scroll-container">
                <div :style="styleData.libox" v-for="(item, index) in prizeList" :key="index" class="prize-item">
                    <div :style="styleData.imgbox">
                        <img :src="item.showImg || item.prizeImg" :style="styleData.imgdiv" alt="图片加载失败" />
                    </div>
                    <div :style="styleData.prizeName">{{ item.prizeName }}</div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import apis1 from '../../../util/apis1.js';
let { drawPrize } = apis1;

export default {
    props: ['isTemplate', 'datas', 'keyData', 'styleData', 'templateData', 'isWebClick', 'modifyContent', 'actType'],
    name: 'prizeDisplay',
    data() {
        return {
            prizeList: [],
        };
    },
    created() {
        this.initData();
    },
    methods: {
        initData() {
            if (this.isTemplate) {
                var datasAll = this.templateData
                if (datasAll) {
                    for (var i = 0; i < datasAll.draw.prizeList.length; i++) {
                        datasAll.draw.prizeList[i].leftNum = datasAll.draw.prizeList[i].totalPrizeNum;
                        datasAll.draw.prizeList[i].allNum = datasAll.draw.prizeList[i].totalPrizeNum;
                        datasAll.draw.prizeList[i].days = datasAll.draw.prizeList[i].cotinueSignDay;
                        datasAll.draw.prizeList[i].canReceive = false;
                        datasAll.draw.prizeList[i].status = 2;
                        datasAll.draw.prizeList[i].statueImg = '//img10.360buyimg.com/imgzone/jfs/t1/154713/4/12793/8489/5fec39ceE7bd9c63e/a64d5084bf34494d.png';
                    }
                    this.prizeList = datasAll.draw.prizeList;
                } else {
                    this.prizeList = [
                        {
                            showImg: '//img10.360buyimg.com/imgzone/jfs/t1/158835/9/878/32528/5fed6feeE1dea01a1/492a92753717c9c8.png',
                            prizeName: '测试大奖1'
                        },
                        {
                            showImg: '//img10.360buyimg.com/imgzone/jfs/t1/158835/9/878/32528/5fed6feeE1dea01a1/492a92753717c9c8.png',
                            prizeName: '测试大奖2'
                        },
                        {
                            showImg: '//img10.360buyimg.com/imgzone/jfs/t1/158835/9/878/32528/5fed6feeE1dea01a1/492a92753717c9c8.png',
                            prizeName: '测试大奖3'
                        },
                        {
                            showImg: '//img10.360buyimg.com/imgzone/jfs/t1/158835/9/878/32528/5fed6feeE1dea01a1/492a92753717c9c8.png',
                            prizeName: '测试大奖4'
                        },
                    ];
                }
            } else {
                drawPrize((responseData) => {
                    if (responseData && responseData.data && responseData.data.prizeInfo) {
                        this.prizeList = responseData.data.prizeInfo;
                    }
                });
            }
        }
    }
};
</script>

<style scoped>
.prize-scroll-container {
    scrollbar-width: none;
}

.prize-scroll-container::-webkit-scrollbar {
    display: none;
}
</style>
