MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / ImageView

Function ImageView

src/components/Grid/imageViewer/index.jsx:11–128  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

9const isAdmin = localStorage.getItem('userRole') === 'admin' ? true : false;//模板的编辑和删除权限
10const { confirm } = Modal;
11function 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 }

Callers

nothing calls this directly

Calls 6

getGuidFunction · 0.90
getTypeFunction · 0.85
goEditFunction · 0.85
deleteScreenFunction · 0.85
previewFunction · 0.85
copyScreenFunction · 0.70

Tested by

no test coverage detected