|
|
@ -1,4 +1,4 @@ |
|
|
|
import React, { useEffect, useState} from 'react'; |
|
|
|
import React, { useEffect, useState } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Spin, Button, Popconfirm, Switch } from 'antd'; |
|
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
@ -30,96 +30,96 @@ const promotionalTable = (props) => { |
|
|
|
|
|
|
|
|
|
|
|
const columns = |
|
|
|
[{ |
|
|
|
title: '序号', |
|
|
|
search: false, |
|
|
|
dataIndex: 'containers', |
|
|
|
fixed: 'left', |
|
|
|
width: 120, |
|
|
|
render: (dom, record, key) => { |
|
|
|
return key + 1 |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '视频名称', |
|
|
|
dataIndex: 'videoName', |
|
|
|
fixed: 'left', |
|
|
|
search: false, |
|
|
|
width: 120, |
|
|
|
options: 1, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.name |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '是否展示', |
|
|
|
dataIndex: 'shuffling', |
|
|
|
valueType: 'shufflingRange', |
|
|
|
search: false, |
|
|
|
width: 120, |
|
|
|
fixed: 'right', |
|
|
|
render: (dom, record) => { |
|
|
|
return <div > |
|
|
|
|
|
|
|
<Switch checkedChildren="展示" unCheckedChildren="关闭" onClick={() => onClickEnable(record)} defaultChecked={true ? record.enable == true : false} /></div> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'creatTime', |
|
|
|
valueType: 'dateTimeRange', |
|
|
|
hideInSearch: true, |
|
|
|
width: 160, |
|
|
|
fixed: 'right', |
|
|
|
render: (dom, record) => { |
|
|
|
return <div style={{ position: 'relative', marginTop: '-30px' }}> |
|
|
|
<VideoUpload record={record} counts={counts} setCounts={setCounts} /> |
|
|
|
<Popconfirm |
|
|
|
title="是否确定删除?" |
|
|
|
arrowPointAtCenter={true} |
|
|
|
showArrow={true} |
|
|
|
position="topRight" |
|
|
|
onConfirm={ |
|
|
|
() => { |
|
|
|
const query = { |
|
|
|
publicityId: record.id |
|
|
|
} |
|
|
|
dispatch(delPropagata(query)).then(() => { |
|
|
|
dispatch(getPropagata()).then((res) => { |
|
|
|
setCounts(res.payload.data) |
|
|
|
[ |
|
|
|
{ |
|
|
|
title: '序号', |
|
|
|
search: false, |
|
|
|
dataIndex: 'containers', |
|
|
|
fixed: 'left', |
|
|
|
width: 120, |
|
|
|
render: (dom, record, key) => { |
|
|
|
return key + 1 |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '视频名称', |
|
|
|
dataIndex: 'videoName', |
|
|
|
fixed: 'left', |
|
|
|
search: false, |
|
|
|
width: 120, |
|
|
|
options: 1, |
|
|
|
render: (dom, record) => { |
|
|
|
return record.name |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '是否展示', |
|
|
|
dataIndex: 'shuffling', |
|
|
|
valueType: 'shufflingRange', |
|
|
|
search: false, |
|
|
|
width: 120, |
|
|
|
fixed: 'right', |
|
|
|
render: (dom, record) => { |
|
|
|
return <div > |
|
|
|
<Switch checkedChildren="展示" unCheckedChildren="关闭" onClick={() => onClickEnable(record)} defaultChecked={true ? record.enable == true : false} /> |
|
|
|
</div> |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
dataIndex: 'creatTime', |
|
|
|
valueType: 'dateTimeRange', |
|
|
|
hideInSearch: true, |
|
|
|
width: 120, |
|
|
|
fixed: 'right', |
|
|
|
render: (dom, record) => { |
|
|
|
return <div style={{ position: 'relative', marginTop: '-30px' }}> |
|
|
|
<VideoUpload record={record} counts={counts} setCounts={setCounts} /> |
|
|
|
<Popconfirm |
|
|
|
title="是否确定删除?" |
|
|
|
arrowPointAtCenter={true} |
|
|
|
showArrow={true} |
|
|
|
position="topRight" |
|
|
|
onConfirm={ |
|
|
|
() => { |
|
|
|
const query = { |
|
|
|
publicityId: record.id |
|
|
|
} |
|
|
|
dispatch(delPropagata(query)).then(() => { |
|
|
|
dispatch(getPropagata()).then((res) => { |
|
|
|
setCounts(res.payload.data) |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
> |
|
|
|
<Button type="link" float="right" |
|
|
|
>删除</Button> |
|
|
|
</Popconfirm> |
|
|
|
</div> |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
key: "direction", |
|
|
|
hideInTable: true, |
|
|
|
dataIndex: "direction", |
|
|
|
order: 6, |
|
|
|
renderFormItem: (item, { type, defaultRender, ...rest }, form, record) => { |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<VideoUpload type_ys={1} counts={counts} setCounts={setCounts} /> |
|
|
|
> |
|
|
|
<Button type="link" float="right" |
|
|
|
>删除</Button> |
|
|
|
</Popconfirm> |
|
|
|
</div> |
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
key: "direction", |
|
|
|
hideInTable: true, |
|
|
|
dataIndex: "direction", |
|
|
|
order: 6, |
|
|
|
renderFormItem: (item, { type, defaultRender, ...rest }, form, record) => { |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<VideoUpload type_ys={1} counts={counts} setCounts={setCounts} /> |
|
|
|
</div> |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
] |
|
|
|
|
|
|
|
//获取数据
|
|
|
|
useEffect(() => { |
|
|
|
const vedio = dispatch(getPropagata()).then((res) => { |
|
|
|
setCounts(res.payload.data) |
|
|
|
console.log(res.payload.data) |
|
|
|
}) |
|
|
|
}, []) |
|
|
|
|
|
|
@ -133,12 +133,6 @@ const promotionalTable = (props) => { |
|
|
|
options={false} |
|
|
|
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|
|
|
rowKey='id' |
|
|
|
rowSelection={{ |
|
|
|
selectedRowKeys: rowSelected, |
|
|
|
onChange: (selectedRowKeys) => { |
|
|
|
setRowSelected(selectedRowKeys); |
|
|
|
}, |
|
|
|
}} |
|
|
|
form={{ |
|
|
|
submitter: false, |
|
|
|
}} |
|
|
|