|
|
|
@ -2,7 +2,7 @@
|
|
|
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
|
|
|
import { ActionType, ProColumns, ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { PageContainer } from '@ant-design/pro-layout';
|
|
|
|
|
import { Button, message, Popconfirm, Switch } from 'antd';
|
|
|
|
|
import { Button, Image, message, Popconfirm, Switch } from 'antd';
|
|
|
|
|
import React, { useRef, useState } from 'react';
|
|
|
|
|
import { Access, useAccess } from 'umi';
|
|
|
|
|
import UpdateForm from './components/UpdateForm';
|
|
|
|
@ -102,7 +102,15 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
{
|
|
|
|
|
title: '预览',
|
|
|
|
|
dataIndex: 'pbcAdvertisement',
|
|
|
|
|
search: false
|
|
|
|
|
search: false,
|
|
|
|
|
render: (text) => {
|
|
|
|
|
const str = text?.toString()
|
|
|
|
|
if (str?.substring(str.lastIndexOf('.')) === '.mp4') {
|
|
|
|
|
return <video onClick={() => window.open(str)} style={{ objectFit: 'contain' }} src={str} width={200} height={200} />
|
|
|
|
|
} else {
|
|
|
|
|
return <Image style={{ objectFit: 'contain' }} src={str} width={200} height={200} />
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '创建时间',
|
|
|
|
@ -116,7 +124,7 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
valueType: 'option',
|
|
|
|
|
render: (text, record) => (
|
|
|
|
|
<span>
|
|
|
|
|
<Access key="config" accessible={access.roleSave}>
|
|
|
|
|
<Access key="config" accessible={access.adScreenUpdate}>
|
|
|
|
|
<Switch
|
|
|
|
|
checked={record.pbcBusinessState === 1}
|
|
|
|
|
onChange={async (value) => {
|
|
|
|
@ -130,7 +138,7 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</Access>
|
|
|
|
|
<Access key="config" accessible={access.roleSave}>
|
|
|
|
|
<Access key="config" accessible={access.adScreenAdd}>
|
|
|
|
|
<Button
|
|
|
|
|
type="link"
|
|
|
|
|
onClick={() => {
|
|
|
|
@ -141,7 +149,7 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
编辑
|
|
|
|
|
</Button>
|
|
|
|
|
</Access>
|
|
|
|
|
<Access key="remove" accessible={access.roleDelete}>
|
|
|
|
|
<Access key="remove" accessible={access.adScreenDelete}>
|
|
|
|
|
<Popconfirm
|
|
|
|
|
title="确定删除该开屏广告?"
|
|
|
|
|
onConfirm={async () => {
|
|
|
|
@ -188,7 +196,7 @@ const TableList: React.FC<{}> = () => {
|
|
|
|
|
>
|
|
|
|
|
{searchText}
|
|
|
|
|
</Button>,
|
|
|
|
|
<Access key="add" accessible={access.roleSave}>
|
|
|
|
|
<Access key="add" accessible={access.adScreenAdd}>
|
|
|
|
|
<Button
|
|
|
|
|
icon={<PlusOutlined />}
|
|
|
|
|
type="primary"
|
|
|
|
|