diff --git a/app/(root)/backstage/components/BadgeCard.tsx b/app/(root)/backstage/components/BadgeCard.tsx index 269b142..8a86b41 100644 --- a/app/(root)/backstage/components/BadgeCard.tsx +++ b/app/(root)/backstage/components/BadgeCard.tsx @@ -5,7 +5,7 @@ import { useDisclosure } from '@mantine/hooks'; import { IconSettings2 } from '@tabler/icons-react'; import { useRouter } from 'next/navigation'; import { useState } from 'react'; -import SurveyBasicContentsEditor from './SurveyBasicContentsEditor'; // Correct import +import SurveyBasicContentsEditor from './SurveyBasicContentsEditor'; import { SurveyInfo } from '@/api/SurveyApi'; export default function BadgeCard({ survey, showBadge, routeAdmin }: BadgeCardProps) { @@ -74,7 +74,7 @@ export default function BadgeCard({ survey, showBadge, routeAdmin }: BadgeCardPr diff --git a/app/(root)/backstage/components/Tools.tsx b/app/(root)/backstage/components/Tools.tsx index 7481396..109a6fe 100644 --- a/app/(root)/backstage/components/Tools.tsx +++ b/app/(root)/backstage/components/Tools.tsx @@ -1,21 +1,42 @@ -import { Box, Button, Center, Collapse, Group, Menu, Space, Stack, Tooltip } from '@mantine/core'; -import { IconCategory2, IconHome, IconLogout } from '@tabler/icons-react'; +import { Box, Button, Center, Collapse, Group, Menu, Modal, Space, Stack, Tooltip, Text } from '@mantine/core'; +import { IconCategory2, IconHome, IconSettings, IconLogout } from '@tabler/icons-react'; import { useDisclosure } from '@mantine/hooks'; +import { useState } from 'react'; import { Cookie } from '@/components/cookie'; export default function Tools() { const [opened, { toggle }] = useDisclosure(false); + const [openedModal, { open, close }] = useDisclosure(false); + const [actionType, setActionType] = useState<'home' | 'backstage' | null>(null); function goHome() { window.location.href = '/'; } + function goBackstage() { + window.location.href = '/backstage'; + } + function logOut() { Cookie.clearAllCookies(); sessionStorage.setItem('logOutAndRedirect', 'true'); window.location.reload(); } + const openConfirmationModal = (action: 'home' | 'backstage') => { + setActionType(action); + open(); + }; + + const handleConfirm = () => { + if (actionType === 'home') { + goHome(); + } else if (actionType === 'backstage') { + goBackstage(); + } + close(); + }; + return ( + + 您确定要执行此操作吗?如果您正在编辑或批改问卷,建议先保存您的进度,以免丢失重要的修改内容。确保一切都已妥当后再继续操作哦! + + + + + +
- + openConfirmationModal('home')} + style={{ cursor: 'pointer' }} + /> + +
+
+ +
+ + openConfirmationModal('backstage')} + style={{ cursor: 'pointer' }} + />