From b2681231b096410569501dec6a2b760a2f66ca58 Mon Sep 17 00:00:00 2001 From: zdl <3489966805@qq.com> Date: Mon, 20 Oct 2025 13:34:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/settings.local.json | 10 +- src/App.js | 14 - src/components/Navbars/AdminNavbar.js | 222 ----- src/components/Navbars/AdminNavbarLinks.js | 335 ------- src/components/Navbars/HomeNavbar.js | 15 +- src/components/Sidebar/Sidebar.js | 719 -------------- src/components/Sidebar/SidebarDocs.js | 45 - .../Subscription/SubscriptionBadge.js | 15 +- src/layouts/Admin.js | 222 ----- src/layouts/RTL.js | 257 ----- src/routes.js | 608 +----------- src/views/Applications/Calendar.js | 264 ------ src/views/Applications/DataTables.js | 70 -- src/views/Applications/Kanban.js | 336 ------- src/views/Applications/Wizard.js | 680 -------------- src/views/Dashboard/Automotive.js | 434 --------- src/views/Dashboard/CRM.js | 539 ----------- src/views/Dashboard/Landing.js | 115 --- src/views/Dashboard/SmartHome.js | 532 ----------- src/views/Ecommerce/Orders/OrderDetails.js | 433 --------- src/views/Ecommerce/Orders/OrderList.js | 119 --- src/views/Ecommerce/Products/EditProduct.js | 427 --------- src/views/Ecommerce/Products/NewProduct.js | 885 ------------------ src/views/Ecommerce/Products/ProductPage.js | 597 ------------ 24 files changed, 16 insertions(+), 7877 deletions(-) delete mode 100755 src/components/Navbars/AdminNavbar.js delete mode 100755 src/components/Navbars/AdminNavbarLinks.js delete mode 100755 src/components/Sidebar/Sidebar.js delete mode 100755 src/components/Sidebar/SidebarDocs.js delete mode 100755 src/layouts/Admin.js delete mode 100755 src/layouts/RTL.js delete mode 100755 src/views/Applications/Calendar.js delete mode 100755 src/views/Applications/DataTables.js delete mode 100755 src/views/Applications/Kanban.js delete mode 100755 src/views/Applications/Wizard.js delete mode 100644 src/views/Dashboard/Automotive.js delete mode 100644 src/views/Dashboard/CRM.js delete mode 100644 src/views/Dashboard/Landing.js delete mode 100644 src/views/Dashboard/SmartHome.js delete mode 100755 src/views/Ecommerce/Orders/OrderDetails.js delete mode 100755 src/views/Ecommerce/Orders/OrderList.js delete mode 100755 src/views/Ecommerce/Products/EditProduct.js delete mode 100755 src/views/Ecommerce/Products/NewProduct.js delete mode 100755 src/views/Ecommerce/Products/ProductPage.js diff --git a/.claude/settings.local.json b/.claude/settings.local.json index c48b1f46..1faf39fd 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -5,9 +5,15 @@ "Bash(xargs ls:*)", "Bash(awk:*)", "Bash(npm start)", - "Bash(python3:*)" + "Bash(python3:*)", + "Bash(rm -rf /Users/qiye/Desktop/jzqy/vf_react/src/views/Applications)", + "Bash(rm -rf /Users/qiye/Desktop/jzqy/vf_react/src/views/Ecommerce)", + "Bash(rm /Users/qiye/Desktop/jzqy/vf_react/src/views/Dashboard/Automotive.js)", + "Bash(rm /Users/qiye/Desktop/jzqy/vf_react/src/views/Dashboard/CRM.js)", + "Bash(rm /Users/qiye/Desktop/jzqy/vf_react/src/views/Dashboard/SmartHome.js)", + "Bash(rm /Users/qiye/Desktop/jzqy/vf_react/src/views/Dashboard/Landing.js)" ], "deny": [], "ask": [] } -} \ No newline at end of file +} diff --git a/src/App.js b/src/App.js index e09c0fc9..ed8c6aac 100755 --- a/src/App.js +++ b/src/App.js @@ -23,7 +23,6 @@ import theme from "theme/theme.js"; import PageLoader from "components/Loading/PageLoader"; // Layouts - 保持同步导入(需要立即加载) -import Admin from "layouts/Admin"; import Auth from "layouts/Auth"; import HomeLayout from "layouts/Home"; import MainLayout from "layouts/MainLayout"; @@ -143,19 +142,6 @@ function AppContent() { } /> - {/* 管理后台路由 - 需要登录,不使用 MainLayout */} - {/* 这些路由有自己的加载状态处理 */} - }> - - - - - } - /> - {/* 认证页面路由 - 不使用 MainLayout */} } /> diff --git a/src/components/Navbars/AdminNavbar.js b/src/components/Navbars/AdminNavbar.js deleted file mode 100755 index 0932bc25..00000000 --- a/src/components/Navbars/AdminNavbar.js +++ /dev/null @@ -1,222 +0,0 @@ -/*! - -========================================================= -* Argon Dashboard Chakra PRO - v1.0.0 -========================================================= - -* Product Page: https://www.creative-tim.com/product/argon-dashboard-chakra-pro -* Copyright 2022 Creative Tim (https://www.creative-tim.com/) - -* Designed and Coded by Simmmple & Creative Tim - -========================================================= - -* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -*/ - -// Chakra Imports -import { - Box, - Breadcrumb, - BreadcrumbItem, - BreadcrumbLink, - Flex, - Link, - useColorModeValue, -} from "@chakra-ui/react"; -import { SidebarContext } from "contexts/SidebarContext"; -import PropTypes from "prop-types"; -import React, { useState, useEffect, useContext } from "react"; -import AdminNavbarLinks from "./AdminNavbarLinks"; -import { HamburgerIcon } from "@chakra-ui/icons"; - -export default function AdminNavbar(props) { - const [scrolled, setScrolled] = useState(false); - - const { - sidebarWidth, - setSidebarWidth, - toggleSidebar, - setToggleSidebar, - } = useContext(SidebarContext); - - useEffect(() => { - window.addEventListener("scroll", changeNavbar); - - return () => { - window.removeEventListener("scroll", changeNavbar); - }; - }); - - const { - variant, - children, - fixed, - secondary, - brandText, - onOpen, - ...rest - } = props; - - // Here are all the props that may change depending on navbar's type or state.(secondary, variant, scrolled) - let mainText = - fixed && scrolled - ? useColorModeValue("gray.700", "gray.200") - : useColorModeValue("white", "gray.200"); - let secondaryText = - fixed && scrolled - ? useColorModeValue("gray.700", "gray.200") - : useColorModeValue("white", "gray.200"); - let navbarPosition = "absolute"; - let navbarFilter = "none"; - let navbarBackdrop = "blur(20px)"; - let navbarShadow = "none"; - let navbarBg = "none"; - let navbarBorder = "transparent"; - let secondaryMargin = "0px"; - let paddingX = "15px"; - if (props.fixed === true) - if (scrolled === true) { - navbarPosition = "fixed"; - navbarShadow = useColorModeValue( - "0px 7px 23px rgba(0, 0, 0, 0.05)", - "none" - ); - navbarBg = useColorModeValue( - "linear-gradient(112.83deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.8) 110.84%)", - "linear-gradient(112.83deg, rgba(255, 255, 255, 0.21) 0%, rgba(255, 255, 255, 0) 110.84%)" - ); - navbarBorder = useColorModeValue("#FFFFFF", "rgba(255, 255, 255, 0.31)"); - navbarFilter = useColorModeValue( - "none", - "drop-shadow(0px 7px 23px rgba(0, 0, 0, 0.05))" - ); - } - if (props.secondary) { - navbarBackdrop = "none"; - navbarPosition = "absolute"; - mainText = "white"; - secondaryText = "white"; - secondaryMargin = "22px"; - paddingX = "30px"; - } - const changeNavbar = () => { - if (window.scrollY > 1) { - setScrolled(true); - } else { - setScrolled(false); - } - }; - - return ( - - - - - - - Pages - - - - - - {brandText} - - - - {/* Here we create navbar brand, based on route name */} - - {brandText} - - - { - setSidebarWidth(sidebarWidth === 275 ? 120 : 275); - setToggleSidebar(!toggleSidebar); - }} - /> - - - - - - ); -} - -AdminNavbar.propTypes = { - brandText: PropTypes.string, - variant: PropTypes.string, - secondary: PropTypes.bool, - fixed: PropTypes.bool, - onOpen: PropTypes.func, -}; diff --git a/src/components/Navbars/AdminNavbarLinks.js b/src/components/Navbars/AdminNavbarLinks.js deleted file mode 100755 index ab778961..00000000 --- a/src/components/Navbars/AdminNavbarLinks.js +++ /dev/null @@ -1,335 +0,0 @@ -/*! - -========================================================= -* Argon Dashboard Chakra PRO - v1.0.0 -========================================================= - -* Product Page: https://www.creative-tim.com/product/argon-dashboard-chakra-pro -* Copyright 2022 Creative Tim (https://www.creative-tim.com/) - -* Designed and Coded by Simmmple & Creative Tim - -========================================================= - -* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -*/ - -// Chakra Icons -import { BellIcon } from "@chakra-ui/icons"; -// Chakra Imports -import { - Button, - Flex, - Menu, - MenuButton, - MenuItem, - MenuList, - Text, - Stack, - Box, - useColorMode, - useColorModeValue, - Avatar, - HStack, - Divider, -} from "@chakra-ui/react"; -// Assets -import avatar1 from "assets/img/avatars/avatar1.png"; -import avatar2 from "assets/img/avatars/avatar2.png"; -import avatar3 from "assets/img/avatars/avatar3.png"; -// Custom Icons -import { ProfileIcon, SettingsIcon } from "components/Icons/Icons"; -// Custom Components -import { ItemContent } from "components/Menu/ItemContent"; -import { SearchBar } from "components/Navbars/SearchBar/SearchBar"; -import { SidebarResponsive } from "components/Sidebar/Sidebar"; -import PropTypes from "prop-types"; -import React from "react"; -import { NavLink, useNavigate } from "react-router-dom"; -import routes from "routes.js"; -import { - ArgonLogoDark, - ChakraLogoDark, - ArgonLogoLight, - ChakraLogoLight, -} from "components/Icons/Icons"; -import { useAuth } from "contexts/AuthContext"; -import SubscriptionBadge from "components/Subscription/SubscriptionBadge"; -import SubscriptionModal from "components/Subscription/SubscriptionModal"; - -export default function HeaderLinks(props) { - console.log('🚀 [AdminNavbarLinks] 组件已加载'); - - const { - variant, - children, - fixed, - scrolled, - secondary, - onOpen, - ...rest - } = props; - - const { colorMode } = useColorMode(); - const { user, isAuthenticated, logout } = useAuth(); - const navigate = useNavigate(); - - console.log('👤 [AdminNavbarLinks] 用户状态:', { user, isAuthenticated }); - - // 订阅信息状态 - const [subscriptionInfo, setSubscriptionInfo] = React.useState({ - type: 'free', - status: 'active', - days_left: 0, - is_active: true - }); - const [isSubscriptionModalOpen, setIsSubscriptionModalOpen] = React.useState(false); - - // 加载订阅信息 - React.useEffect(() => { - console.log('🔍 [AdminNavbarLinks] 订阅徽章 - 认证状态:', isAuthenticated, 'userId:', user?.id); - - if (isAuthenticated && user) { - const loadSubscriptionInfo = async () => { - try { - const base = (process.env.NODE_ENV === 'production' ? '' : process.env.REACT_APP_API_URL || 'http://49.232.185.254:5001'); - console.log('🌐 [AdminNavbarLinks] 订阅徽章 - API:', base + '/api/subscription/current'); - const response = await fetch(base + '/api/subscription/current', { - credentials: 'include', - }); - console.log('📡 [AdminNavbarLinks] 订阅徽章 - 响应:', response.status); - if (response.ok) { - const data = await response.json(); - console.log('✅ [AdminNavbarLinks] 订阅徽章 - 完整响应数据:', data); - console.log('🔍 [AdminNavbarLinks] 订阅徽章 - data.data:', data.data); - console.log('🔍 [AdminNavbarLinks] 订阅徽章 - type值:', data.data?.type, '类型:', typeof data.data?.type); - - if (data.success && data.data) { - // 数据标准化处理:确保type字段是小写的 'free', 'pro', 或 'max' - const normalizedData = { - type: (data.data.type || data.data.subscription_type || 'free').toLowerCase(), - status: data.data.status || 'active', - days_left: data.data.days_left || 0, - is_active: data.data.is_active !== false, - end_date: data.data.end_date || null - }; - console.log('✨ [AdminNavbarLinks] 订阅徽章 - 标准化后:', normalizedData); - setSubscriptionInfo(normalizedData); - } - } else { - console.warn('⚠️ [AdminNavbarLinks] 订阅徽章 - API 失败,使用默认值'); - } - } catch (error) { - console.error('❌ [AdminNavbarLinks] 订阅徽章 - 错误:', error); - } - }; - loadSubscriptionInfo(); - } else { - // 用户未登录时,重置为免费版 - console.warn('🚫 [AdminNavbarLinks] 订阅徽章 - 用户未登录,重置为免费版'); - setSubscriptionInfo({ - type: 'free', - status: 'active', - days_left: 0, - is_active: true - }); - } - }, [isAuthenticated, user?.id]); // 只依赖 user.id 而不是整个 user 对象 - - // Chakra Color Mode - let navbarIcon = - fixed && scrolled - ? useColorModeValue("gray.700", "gray.200") - : useColorModeValue("white", "gray.200"); - let menuBg = useColorModeValue("white", "navy.800"); - if (secondary) { - navbarIcon = "white"; - } - - const handleLogout = () => { - logout(); - navigate("/auth/signin"); - }; - - return ( - - - - {/* 订阅状态徽章 - 仅登录用户可见 */} - {console.log('🎨 [订阅徽章] 渲染:', { isAuthenticated, subscriptionInfo })} - {isAuthenticated && ( - <> - setIsSubscriptionModalOpen(true)} - /> - setIsSubscriptionModalOpen(false)} - subscriptionInfo={subscriptionInfo} - /> - - )} - - {/* 用户认证状态 */} - {isAuthenticated ? ( - // 已登录用户 - 显示用户菜单 - - - - - - {user?.name || user?.email} - - - - - - navigate("/admin/profile")}> - - - - {user?.name} - {user?.email} - - - - - navigate("/admin/profile")}> - 个人资料 - - navigate("/admin/settings")}> - 设置 - - - - 退出登录 - - - - - ) : ( - // 未登录用户 - 显示登录按钮 - - - - )} - - - {colorMode === "dark" ? ( - - ) : ( - - )} - - {colorMode === "dark" ? ( - - ) : ( - - )} - - } - colorMode={colorMode} - secondary={props.secondary} - routes={routes} - {...rest} - /> - - - - - - - - - - - - - - - - - - - - - ); -} - -HeaderLinks.propTypes = { - variant: PropTypes.string, - fixed: PropTypes.bool, - secondary: PropTypes.bool, - onOpen: PropTypes.func, -}; diff --git a/src/components/Navbars/HomeNavbar.js b/src/components/Navbars/HomeNavbar.js index 7e1fc4b8..284a18fa 100644 --- a/src/components/Navbars/HomeNavbar.js +++ b/src/components/Navbars/HomeNavbar.js @@ -626,23 +626,15 @@ export default function HomeNavbar() { // 加载订阅信息 React.useEffect(() => { - console.log('🔍 [HomeNavbar] 订阅徽章 - 认证状态:', isAuthenticated, 'userId:', user?.id); - if (isAuthenticated && user) { const loadSubscriptionInfo = async () => { try { const base = getApiBase(); - console.log('🌐 [HomeNavbar] 订阅徽章 - API:', base + '/api/subscription/current'); const response = await fetch(base + '/api/subscription/current', { credentials: 'include', }); - console.log('📡 [HomeNavbar] 订阅徽章 - 响应:', response.status); if (response.ok) { const data = await response.json(); - console.log('✅ [HomeNavbar] 订阅徽章 - 完整响应数据:', data); - console.log('🔍 [HomeNavbar] 订阅徽章 - data.data:', data.data); - console.log('🔍 [HomeNavbar] 订阅徽章 - type值:', data.data?.type, '类型:', typeof data.data?.type); - if (data.success && data.data) { // 数据标准化处理:确保type字段是小写的 'free', 'pro', 或 'max' const normalizedData = { @@ -652,20 +644,16 @@ export default function HomeNavbar() { is_active: data.data.is_active !== false, end_date: data.data.end_date || null }; - console.log('✨ [HomeNavbar] 订阅徽章 - 标准化后:', normalizedData); setSubscriptionInfo(normalizedData); } - } else { - console.warn('⚠️ [HomeNavbar] 订阅徽章 - API 失败,使用默认值'); } } catch (error) { - console.error('❌ [HomeNavbar] 订阅徽章 - 错误:', error); + logger.error('HomeNavbar', '加载订阅信息失败', error); } }; loadSubscriptionInfo(); } else { // 用户未登录时,重置为免费版 - console.warn('🚫 [HomeNavbar] 订阅徽章 - 用户未登录,重置为免费版'); setSubscriptionInfo({ type: 'free', status: 'active', @@ -775,7 +763,6 @@ export default function HomeNavbar() { /> {/* 订阅状态徽章 - 仅登录用户可见 */} - {console.log('🎨 [HomeNavbar] 订阅徽章 - 渲染:', { isAuthenticated, user: !!user, subscriptionInfo })} {isAuthenticated && user && ( <> { - return location.pathname.includes(routeName); - }; - // this function creates the links and collapses that appear in the sidebar (left menu) - const createLinks = (routes) => { - // Chakra Color Mode - let activeBg = 'blue.500'; - let inactiveBg = useColorModeValue('transparent', 'navy.700'); - let activeColor = useColorModeValue('gray.700', 'white'); - let inactiveColor = useColorModeValue('gray.400', 'gray.400'); - let sidebarActiveShadow = '0px 7px 11px rgba(0, 0, 0, 0.04)'; - let activeAccordionBg = useColorModeValue('white', 'navy.700'); - let activeColorIcon = 'white'; - let inactiveColorIcon = 'blue.500'; - - if (landing) { - activeBg = 'white'; - inactiveBg = 'transparent'; - activeColor = 'white'; - inactiveColor = 'white'; - sidebarActiveShadow = '0px 7px 11px rgba(0, 0, 0, 0.04)'; - activeAccordionBg = 'rgba(255, 255, 255, 0.11)'; - activeColorIcon = 'blue.500'; - inactiveColorIcon = 'white'; - } - - return routes.map((prop, key) => { - if (prop.category) { - return ( - - - {prop.name} - - {createLinks(prop.items)} - - ); - } - if (prop.collapse) { - return ( - - - - {activeRoute(prop.path) ? ( - - {prop.icon ? ( - - - {prop.icon} - - - {prop.name} - - - ) : ( - - - - {sidebarWidth === 275 ? prop.name : prop.name[0]} - - - )} - - ) : ( - - {prop.icon ? ( - - - {prop.icon} - - - {prop.name} - - - ) : ( - - - - {sidebarWidth === 275 ? prop.name : prop.name[0]} - - - )} - - )} - - - - - {prop.icon ? ( - createLinks(prop.items) // for bullet accordion links - ) : ( - createAccordionLinks(prop.items) - ) // for non-bullet accordion links - } - - - - - ); - } else { - return ( - - {prop.icon ? ( - - - - {prop.icon} - - - {prop.name} - - - - ) : ( - - - - - {sidebarWidth === 275 ? prop.name : prop.name[0]} - - - - )} - - ); - } - }); - }; - - const createAccordionLinks = (routes) => { - let inactiveColor = useColorModeValue('gray.400', 'gray.400'); - let activeColor = useColorModeValue('gray.700', 'white'); - - if (landing) { - inactiveColor = 'white'; - activeColor = 'white'; - } - - return routes.map((prop, key) => { - return ( - - - - {sidebarWidth === 275 ? prop.name : prop.name[0]} - - - - ); - }); - }; - - let isWindows = navigator.platform.startsWith('Win'); - let links = {createLinks(routes)}; - // BRAND - // Chakra Color Mode - let sidebarBg = useColorModeValue('white', 'navy.800'); - let sidebarRadius = '20px'; - let sidebarMargins = '0px'; - var brand = ( - - {props.logo} - - - ); - - let sidebarContent = ( - - {brand} - - {links} - - - - ); - - // SIDEBAR - return ( - setSidebarWidth(sidebarWidth === 120 ? 275 : 120) : null} - onMouseLeave={toggleSidebar ? () => setSidebarWidth(sidebarWidth === 275 ? 120 : 275) : null}> - - - - {sidebarContent} - - - - - ); -} - -// FUNCTIONS - -export function SidebarResponsive(props) { - // to check for active links and opened collapses - let location = useLocation(); - - let variantChange = '0.2s linear'; - // verifies if routeName is the one active (in browser input) - const activeRoute = (routeName) => { - return location.pathname.includes(routeName); - }; - - // Chakra Color Mode - let activeBg = 'blue.500'; - let inactiveBg = useColorModeValue('transparent', 'navy.700'); - let activeColor = useColorModeValue('gray.700', 'white'); - let inactiveColor = useColorModeValue('gray.400', 'gray.400'); - let activeAccordionBg = useColorModeValue('white', 'navy.700'); - let sidebarActiveShadow = useColorModeValue('0px 7px 11px rgba(0, 0, 0, 0.04)', 'none'); - let activeColorIcon = 'white'; - let inactiveColorIcon = 'blue.500'; - let sidebarBackgroundColor = useColorModeValue('white', 'navy.900'); - - // this function creates the links and collapses that appear in the sidebar (left menu) - const createLinks = (routes) => { - return routes.map((prop, key) => { - if (prop.category) { - return ( - - - {prop.name} - - {createLinks(prop.items)} - - ); - } - if (prop.collapse) { - return ( - - - - {activeRoute(prop.path) ? ( - - {prop.icon ? ( - - - {prop.icon} - - - {prop.name} - - - ) : ( - - - - {prop.name} - - - )} - - ) : ( - - {prop.icon ? ( - - - {prop.icon} - - - {prop.name} - - - ) : ( - - - - {prop.name} - - - )} - - )} - - - - - {prop.icon ? ( - createLinks(prop.items) // for bullet accordion links - ) : ( - createAccordionLinks(prop.items) - ) // for non-bullet accordion links - } - - - - - ); - } else { - return ( - - {prop.icon ? ( - - - - {prop.icon} - - - {prop.name} - - - - ) : ( - - - - - {prop.name} - - - - )} - - ); - } - }); - }; - - const createAccordionLinks = (routes) => { - return routes.map((prop, key) => { - return ( - - - - {prop.name} - - - - ); - }); - }; - const { logo, display, routes } = props; - - let links = {createLinks(routes)}; - // BRAND - // Chakra Color Mode - let hamburgerColor = 'white'; - - var brand = ( - - {logo} - - - ); - - // SIDEBAR - const { isOpen, onOpen, onClose } = useDisclosure(); - const btnRef = React.useRef(); - // Color variables - return ( - - - - - - - - - - {brand} - - {links} - - - - - - - - - ); -} -// PROPS - -export default Sidebar; diff --git a/src/components/Sidebar/SidebarDocs.js b/src/components/Sidebar/SidebarDocs.js deleted file mode 100755 index 632956a3..00000000 --- a/src/components/Sidebar/SidebarDocs.js +++ /dev/null @@ -1,45 +0,0 @@ -import { - Button, - Flex, - Image, - Link, - Stack, - Text, - useColorModeValue, -} from "@chakra-ui/react"; -import SidebarHelpImage from "assets/img/SidebarHelpImage.png"; -import { SidebarContext } from "contexts/SidebarContext"; -import React, { useContext } from "react"; - -export default function SidebarDocs({ landing }) { - - const textColor = useColorModeValue("gray.700", "white"); - - const { sidebarWidth } = useContext(SidebarContext); - - return ( - - - - - Need help? - - - Please check our docs. - - - - - - - ); -} \ No newline at end of file diff --git a/src/components/Subscription/SubscriptionBadge.js b/src/components/Subscription/SubscriptionBadge.js index 0bf1d239..4b4a5bb2 100644 --- a/src/components/Subscription/SubscriptionBadge.js +++ b/src/components/Subscription/SubscriptionBadge.js @@ -4,16 +4,9 @@ import { Box, Text, Tooltip, useColorModeValue } from '@chakra-ui/react'; import PropTypes from 'prop-types'; export default function SubscriptionBadge({ subscriptionInfo, onClick }) { - // 🔍 调试:输出接收到的 props - console.log('🎯 [SubscriptionBadge] 接收到的 subscriptionInfo:', subscriptionInfo); - console.log('🎯 [SubscriptionBadge] subscriptionInfo.type:', subscriptionInfo?.type, '类型:', typeof subscriptionInfo?.type); - // 根据订阅类型返回样式配置 const getBadgeStyles = () => { - console.log('🔧 [SubscriptionBadge] getBadgeStyles 执行, type:', subscriptionInfo.type); - if (subscriptionInfo.type === 'max') { - console.log('✅ [SubscriptionBadge] 匹配到 MAX'); return { bg: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', color: 'white', @@ -24,7 +17,6 @@ export default function SubscriptionBadge({ subscriptionInfo, onClick }) { }; } if (subscriptionInfo.type === 'pro') { - console.log('✅ [SubscriptionBadge] 匹配到 PRO'); return { bg: 'linear-gradient(135deg, #667eea 0%, #3182CE 100%)', color: 'white', @@ -35,7 +27,6 @@ export default function SubscriptionBadge({ subscriptionInfo, onClick }) { }; } // 基础版 - console.log('⚠️ [SubscriptionBadge] 使用默认基础版'); return { bg: 'transparent', color: useColorModeValue('gray.600', 'gray.400'), @@ -49,7 +40,6 @@ export default function SubscriptionBadge({ subscriptionInfo, onClick }) { }; const styles = getBadgeStyles(); - console.log('🎨 [SubscriptionBadge] styles 对象:', styles); // 智能动态 Tooltip 文本 const getTooltipText = () => { @@ -118,10 +108,7 @@ export default function SubscriptionBadge({ subscriptionInfo, onClick }) { }} > {styles.icon && {styles.icon}} - {(() => { - console.log('📝 [SubscriptionBadge] 渲染文本:', styles.label); - return styles.label; - })()} + {styles.label} ); diff --git a/src/layouts/Admin.js b/src/layouts/Admin.js deleted file mode 100755 index b7f6010e..00000000 --- a/src/layouts/Admin.js +++ /dev/null @@ -1,222 +0,0 @@ -/*! - -========================================================= -* Argon Dashboard Chakra PRO - v1.0.0 -========================================================= - -* Product Page: https://www.creative-tim.com/product/argon-dashboard-chakra-pro -* Copyright 2022 Creative Tim (https://www.creative-tim.com/) - -* Designed and Coded by Simmmple & Creative Tim - -========================================================= - -* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -*/ - -// Chakra imports -import { Portal, Box, useColorMode, Stack, useDisclosure, useColorModeValue } from '@chakra-ui/react'; -import Configurator from 'components/Configurator/Configurator'; -import FixedPlugin from 'components/FixedPlugin/FixedPlugin'; -import Footer from 'components/Footer/Footer.js'; -// Custom components -import MainPanel from 'components/Layout/MainPanel'; -import PanelContainer from 'components/Layout/PanelContainer'; -import PanelContent from 'components/Layout/PanelContent'; -// Layout components -import AdminNavbar from 'components/Navbars/AdminNavbar.js'; -import Sidebar from 'components/Sidebar/Sidebar.js'; -import { SidebarContext } from 'contexts/SidebarContext'; -import React, { useState, Suspense } from 'react'; -import 'react-quill/dist/quill.snow.css'; // ES6 - -import { Route, Routes, Navigate } from "react-router-dom"; -import routes from 'routes.js'; -import PageLoader from 'components/Loading/PageLoader'; - -import { - ArgonLogoDark, - ArgonLogoLight, - ChakraLogoDark, - ChakraLogoLight, - ArgonLogoMinifiedDark, - ArgonLogoMinifiedLight -} from 'components/Icons/Icons'; -// Custom Chakra theme -export default function Dashboard(props) { - const { ...rest } = props; - // states and functions - const [ fixed, setFixed ] = useState(false); - const [ toggleSidebar, setToggleSidebar ] = useState(false); - const [ sidebarWidth, setSidebarWidth ] = useState(275); - // functions for changing the states from components - const getRoute = () => { - return window.location.pathname !== '/admin/full-screen-maps'; - }; - const getActiveRoute = (routes) => { - let activeRoute = 'Default Brand Text'; - for (let i = 0; i < routes.length; i++) { - if (routes[i].collapse) { - let collapseActiveRoute = getActiveRoute(routes[i].items); - if (collapseActiveRoute !== activeRoute) { - return collapseActiveRoute; - } - } else if (routes[i].category) { - let categoryActiveRoute = getActiveRoute(routes[i].items); - if (categoryActiveRoute !== activeRoute) { - return categoryActiveRoute; - } - } else { - if (window.location.href.indexOf(routes[i].layout + routes[i].path) !== -1) { - return routes[i].name; - } - } - } - return activeRoute; - }; - const getActiveNavbar = (routes) => { - let activeNavbar = false; - for (let i = 0; i < routes.length; i++) { - if (routes[i].collapse) { - let collapseActiveNavbar = getActiveNavbar(routes[i].items); - if (collapseActiveNavbar !== activeNavbar) { - return collapseActiveNavbar; - } - } else if (routes[i].category) { - let categoryActiveNavbar = getActiveNavbar(routes[i].items); - if (categoryActiveNavbar !== activeNavbar) { - return categoryActiveNavbar; - } - } else { - if (window.location.href.indexOf(routes[i].layout + routes[i].path) !== -1) { - return routes[i].secondaryNavbar; - } - } - } - return activeNavbar; - }; - const getRoutes = (routes) => { - return routes.map((route, key) => { - if (route.layout === '/admin') { - // ⚡ 懒加载组件需要包裹在 Suspense 中 - const Component = route.component; - return ( - }> - - - } - key={key} - /> - ); - } - if (route.collapse) { - return getRoutes(route.items); - } - if (route.category) { - return getRoutes(route.items); - } else { - return null; - } - }); - }; - let bgBoxHeight = '40vh'; - let bgBoxColor = useColorModeValue('blue.500', 'navy.900'); - - const { isOpen, onOpen, onClose } = useDisclosure(); - const { colorMode } = useColorMode(); - document.documentElement.dir = 'ltr'; - document.documentElement.layout = 'admin'; - // Chakra Color Mode - return ( - - - - - {colorMode === 'dark' ? ( - - ) : ( - - )} - - {colorMode === 'dark' ? ( - - ) : ( - - )} - - ) : colorMode === 'light' ? ( - - ) : ( - - ) - } - display='none' - {...rest} - /> - - - - - - - - {getRoute() ? ( - - - - {getRoutes(routes)} - } - /> - - - - ) : null} - -