import React, { Component } from 'react'
import { Carousel, Tabs } from 'antd';
import { config, request, permission, util } from 'utils'
const { WXMpAPI } = config
import styles from './index.less';
import router from 'umi/router';
import { GetQueryString } from '../getCommonId';
class productList extends Component {
    constructor(props) {
        super(props)
        this.state = {
            list: [
        
            ]
        }
    }
    componentWillMount() {
        this.getProductList();
    }
    getProductList = () => {
        let that = this
        const columnId = GetQueryString('columnId') ? GetQueryString('columnId') : 1
        const data = {
            "pageIndex": 1,
            "pageSize": 10,
            "filters": [
                {
                    "field": "floor_column_id",
                    "operate": "equal",
                    "value":columnId
                }
            ],
        }
        request({
            url: WXMpAPI + '/wx/content/floor/queryFloorsFront',
            method: "post",
            data: data
        }).then((sussess) => {
            that.setState({
                list: sussess.items
            })
        });
    }
    onClick = (val,key) =>{
        // console.log(val,'-=-=-=')
        // router.push({pathname:'/viewHome/contentDetails',query:{contentId:val.floorItemList[key].flooritemUrl}})
    }
    render() {
        const { TabPane } = Tabs;
        let SsoToken = util.auth.getToken();
        return (
            <div className={styles.productList}>
                <ul style={{ padding: "0" }} className={styles.productList_item}>
                    {
                        this.state.list && this.state.list.map((item, key) => {
                            return (
                                <div className={styles.list_item}>
                                    <div style={{padding:"10px 15px"}} className={styles.defaultTitle}>{item.floorName}</div>
                                    <div className={styles.content}>
                                    {
                                        item.floorItemList && item.floorItemList.map((items, keys) => {
                                            return <li className={styles.goods_item} >
                                                <a href={items.flooritemUrl}>
                                                <img src={items.flooritemPhotoaddress + "?Sso-Token=" + SsoToken} className={styles.handleImg} mode="aspectFill"/>
                                                 <div className={styles.money_title}>
                                                     {items.flooritemTitle}
                                                 </div>
                                                 </a>
                                            </li>
                                        })
                                    }
                                      </div>
                                </div>

                            )
                        })
                    }
                </ul>
            </div>
        )
    }
}

export default productList
