refactor(路由): 统一将路由路径从/ckbox更改为/pc
更新用户登录后跳转路径和导航菜单中的路由路径,从/ckbox/weChat改为/pc/weChat,/ckbox/dashboard改为/pc/dashboard,保持路由命名一致性
This commit is contained in:
@@ -12,13 +12,13 @@ export const menuList: MenuItem[] = [
|
||||
id: "dashboard",
|
||||
title: "数据面板",
|
||||
icon: "📊",
|
||||
path: "/ckbox/dashboard",
|
||||
path: "/pc/dashboard",
|
||||
},
|
||||
{
|
||||
id: "wechat",
|
||||
title: "微信管理",
|
||||
icon: "💬",
|
||||
path: "/ckbox/weChat",
|
||||
path: "/pc/weChat",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
import React, { useState } from "react";
|
||||
import { Layout, Drawer, Avatar, Dropdown, Space, Button } from "antd";
|
||||
import {
|
||||
MenuOutlined,
|
||||
UserOutlined,
|
||||
LogoutOutlined,
|
||||
SettingOutlined,
|
||||
} from "@ant-design/icons";
|
||||
import type { MenuProps } from "antd";
|
||||
import { Layout, Drawer, Avatar, Space, Button } from "antd";
|
||||
import { MenuOutlined, UserOutlined } from "@ant-design/icons";
|
||||
import { useUserStore } from "@/store/module/user";
|
||||
import { useCkChatStore } from "@/store/module/ckchat/ckchat";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { drawerMenuData, menuList } from "./index.data";
|
||||
@@ -26,6 +21,8 @@ const NavCommon: React.FC<NavCommonProps> = ({
|
||||
const [drawerVisible, setDrawerVisible] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const { userInfo } = useCkChatStore();
|
||||
const { user } = useUserStore();
|
||||
console.log(user);
|
||||
|
||||
// 处理菜单图标点击
|
||||
const handleMenuClick = () => {
|
||||
@@ -119,7 +116,7 @@ const NavCommon: React.FC<NavCommonProps> = ({
|
||||
<Avatar
|
||||
size={40}
|
||||
icon={<UserOutlined />}
|
||||
src={userInfo?.account?.avatar}
|
||||
src={user?.avatar}
|
||||
className={styles.avatar}
|
||||
/>
|
||||
</Space>
|
||||
|
||||
@@ -69,7 +69,7 @@ export const useUserStore = createPersistStore<UserState>(
|
||||
set({ user, token, isLoggedIn: true });
|
||||
|
||||
Toast.show({ content: "登录成功", position: "top" });
|
||||
window.location.href = "/ckbox/weChat";
|
||||
window.location.href = "/pc/weChat";
|
||||
},
|
||||
login2: token2 => {
|
||||
localStorage.setItem("token2", token2);
|
||||
|
||||
Reference in New Issue
Block a user