(props)
| 9 | const isAdmin = localStorage.getItem('userRole') === 'admin' ? true : false;//模板的编辑和删除权限 |
| 10 | const { confirm } = Modal; |
| 11 | function ImageView(props) { |
| 12 | const { handlePreview } = props; |
| 13 | const [files, setFiles] = useState(props.files || []); |
| 14 | console.log(files) |
| 15 | const [visiblePreview, setVisiblePreview] = useState(false) |
| 16 | function imgClick(item) { |
| 17 | handlePreview(item) |
| 18 | } |
| 19 | function openModal() { |
| 20 | props.openModal() |
| 21 | } |
| 22 | function createBlankScreen() { |
| 23 | props.createBlankScreen() |
| 24 | } |
| 25 | const goEdit = id => { |
| 26 | if(!id){ |
| 27 | message.error('系统模板不可编辑') |
| 28 | return; |
| 29 | } |
| 30 | router.push({ |
| 31 | pathname: '/workspace', |
| 32 | query: { templateName: id } |
| 33 | }); |
| 34 | } |
| 35 | const copyScreen = id => { |
| 36 | props.copyScreen(id) |
| 37 | } |
| 38 | const getType = () => { |
| 39 | if (props.isSystemTemplate) { |
| 40 | return '模板' |
| 41 | } if (props.isPrivate) { |
| 42 | return '组件' |
| 43 | } |
| 44 | return '大屏' |
| 45 | |
| 46 | } |
| 47 | const deleteScreen = id => { |
| 48 | confirm({ |
| 49 | title: `确定删除此${getType()}?此操作不可逆!`, |
| 50 | getContainer: document.getElementById("workspace"), |
| 51 | icon: <ExclamationCircleOutlined />, |
| 52 | okText: '确定', |
| 53 | okType: 'danger', |
| 54 | okButtonProps: { |
| 55 | ghost: true |
| 56 | }, |
| 57 | maskClosable: true, |
| 58 | mask: true, |
| 59 | cancelText: '取消', |
| 60 | cancelButtonProps: { |
| 61 | ghost: true |
| 62 | }, |
| 63 | onOk() { |
| 64 | props.deleteSelectedTemplate(id) |
| 65 | }, |
| 66 | onCancel() { }, |
| 67 | }); |
| 68 | } |
nothing calls this directly
no test coverage detected