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",
|
id: "dashboard",
|
||||||
title: "数据面板",
|
title: "数据面板",
|
||||||
icon: "📊",
|
icon: "📊",
|
||||||
path: "/ckbox/dashboard",
|
path: "/pc/dashboard",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "wechat",
|
id: "wechat",
|
||||||
title: "微信管理",
|
title: "微信管理",
|
||||||
icon: "💬",
|
icon: "💬",
|
||||||
path: "/ckbox/weChat",
|
path: "/pc/weChat",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Layout, Drawer, Avatar, Dropdown, Space, Button } from "antd";
|
import { Layout, Drawer, Avatar, Space, Button } from "antd";
|
||||||
import {
|
import { MenuOutlined, UserOutlined } from "@ant-design/icons";
|
||||||
MenuOutlined,
|
import { useUserStore } from "@/store/module/user";
|
||||||
UserOutlined,
|
|
||||||
LogoutOutlined,
|
|
||||||
SettingOutlined,
|
|
||||||
} from "@ant-design/icons";
|
|
||||||
import type { MenuProps } from "antd";
|
|
||||||
import { useCkChatStore } from "@/store/module/ckchat/ckchat";
|
import { useCkChatStore } from "@/store/module/ckchat/ckchat";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { drawerMenuData, menuList } from "./index.data";
|
import { drawerMenuData, menuList } from "./index.data";
|
||||||
@@ -26,6 +21,8 @@ const NavCommon: React.FC<NavCommonProps> = ({
|
|||||||
const [drawerVisible, setDrawerVisible] = useState(false);
|
const [drawerVisible, setDrawerVisible] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { userInfo } = useCkChatStore();
|
const { userInfo } = useCkChatStore();
|
||||||
|
const { user } = useUserStore();
|
||||||
|
console.log(user);
|
||||||
|
|
||||||
// 处理菜单图标点击
|
// 处理菜单图标点击
|
||||||
const handleMenuClick = () => {
|
const handleMenuClick = () => {
|
||||||
@@ -119,7 +116,7 @@ const NavCommon: React.FC<NavCommonProps> = ({
|
|||||||
<Avatar
|
<Avatar
|
||||||
size={40}
|
size={40}
|
||||||
icon={<UserOutlined />}
|
icon={<UserOutlined />}
|
||||||
src={userInfo?.account?.avatar}
|
src={user?.avatar}
|
||||||
className={styles.avatar}
|
className={styles.avatar}
|
||||||
/>
|
/>
|
||||||
</Space>
|
</Space>
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ export const useUserStore = createPersistStore<UserState>(
|
|||||||
set({ user, token, isLoggedIn: true });
|
set({ user, token, isLoggedIn: true });
|
||||||
|
|
||||||
Toast.show({ content: "登录成功", position: "top" });
|
Toast.show({ content: "登录成功", position: "top" });
|
||||||
window.location.href = "/ckbox/weChat";
|
window.location.href = "/pc/weChat";
|
||||||
},
|
},
|
||||||
login2: token2 => {
|
login2: token2 => {
|
||||||
localStorage.setItem("token2", token2);
|
localStorage.setItem("token2", token2);
|
||||||
|
|||||||
Reference in New Issue
Block a user