import { useRef, useState } from "react"; import { Switch } from "antd"; import { Radio, Space } from "antd"; import { SettingOutlined, ShoppingCartOutlined } from "@ant-design/icons"; import SettingArticle from "../auth/setting/SettingArticle"; import DictComponent from "../dict/DictComponent"; import { DictIcon, TermIcon } from "../../assets/icon"; import TermShell from "./TermShell"; const setting = ( <> {"保存到用户设置"} { console.log(checked); }} /> ); const ProTabsWidget = () => { const [value2, setValue2] = useState("close"); const divSetting = useRef(null); const divDict = useRef(null); const divTerm = useRef(null); const divCart = useRef(null); const divPanel = useRef(null); const rightBarWidth = "48px"; const closeAll = () => { if (divPanel.current) { divPanel.current.style.display = "none"; } }; const openPanel = () => { if (divPanel.current) { divPanel.current.style.display = "block"; } }; const headHeight = 64; const stylePanel: React.CSSProperties = { height: `calc(100vh - ${headHeight})`, overflowY: "scroll", }; return (
{setting}
{ console.log("radio change", e.target.value); if (divSetting.current) { divSetting.current.style.display = "none"; } if (divDict.current) { divDict.current.style.display = "none"; } if (divTerm.current) { divTerm.current.style.display = "none"; } if (divCart.current) { divCart.current.style.display = "none"; } switch (e.target.value) { case "setting": if (divSetting.current) { divSetting.current.style.display = "block"; } openPanel(); break; case "dict": if (divDict.current) { divDict.current.style.display = "block"; } openPanel(); break; case "term": if (divTerm.current) { divTerm.current.style.display = "block"; } openPanel(); break; case "cart": if (divCart.current) { divCart.current.style.display = "block"; } openPanel(); break; default: break; } setValue2(e.target.value); }} > { if (value2 === "setting") { setValue2("close"); closeAll(); } }} > { if (value2 === "dict") { setValue2("close"); closeAll(); } }} > { if (value2 === "term") { setValue2("close"); closeAll(); } }} > { if (value2 === "cart") { setValue2("close"); closeAll(); } }} >
); }; export default ProTabsWidget;