import React from "react"
import { Image, Badge, Space, Button, Tooltip } from "antd"
import { EyeOutlined } from "@ant-design/icons"
import style from './index.less'
let columns = (look: (value: any) => void) => [
    {
        title: '推广页名称',
        dataIndex: 'name',
        key: 'name',
        align: 'left',
        width: 150,
        fixed: 'left',
        render: (a: any, b: any) => {
            return <Tooltip title={a}><div className={style.oneText}>{a}</div></Tooltip>
        }
    },
    {
        title: '分享标题',
        dataIndex: 'title',
        key: 'title',
        width: 120,
        render: (a: any, b: any) => {
            return <Tooltip title={a}><div className={style.oneText}>{a}</div></Tooltip>
        }
    },
    {
        title: '分享描述',
        dataIndex: 'descContext',
        key: 'descContext',
        width: 120,
        render: (a: any, b: any) => {
            return <Tooltip title={a}><div className={style.oneText}>{a}</div></Tooltip>
        }
    },
    {
        title: '小说',
        dataIndex: 'novelName',
        key: 'novelName',
        width: 100,
        render: (a: any, b: any) => {
            return <Tooltip title={a}><div className={style.oneText}>{a}</div></Tooltip>
        }
    },
    {
        title: '页面背景色',
        dataIndex: 'pageContextList',
        key: 'pageContextList',
        align: 'center',
        width: 100,
        render: (a: any, b: any) => {
            if (a && a?.length > 0) {
                return <span style={{ fontSize: "12px" }}>{a[0]?.backgroundColor}</span>
            } else {
                return null
            }
        }
    },
    {
        title: '顶部素材类型',
        dataIndex: 'topCanvasType',
        key: 'topCanvasType',
        align: 'center',
        width: 110,
        render: (a: any, b: any) => {
            return <span>{a === 41 ? <Badge color={'geekblue'} text='顶部图片' /> : a === 61 || a === 142 ? <Badge color={'red'} text='顶部视频' /> : a === 101 ? <Badge color={'yellow'} text='顶部轮播图' /> : ''}</span>
        }
    },
    {
        title: '顶部素材预览',
        dataIndex: 'thumbUrl',
        key: 'thumbUrl',
        align: 'center',
        width: 110,
        render: (a: any, b: any) => {
            if (a) {
                return <div className="topimgthumbUrl"><Image height={25} src={a}/></div>
            }else {
                return null
            }
        }
    },
    {
        title: '创建时间',
        dataIndex: 'createTime',
        key: 'createTime',
        align: 'center',
        width: 130,
        render: (a: any, b: any) => {
            return <span style={{ fontSize: "12px" }}>{a}</span>
        }
    },
    {
        title: '操作',
        dataIndex: 'cz',
        key: 'cz',
        align: 'center',
        fixed: 'right',
        width: 80,
        render: (a: string, b: any) => (
            <Space>
                <Button onClick={() => look(b)} type='link' style={{ fontSize: "12px", padding: 0 }}><EyeOutlined /> 查看</Button>
            </Space>
        )
    }
]

export default columns