feat(global-header): 重构全局头部组件及样式优化
- 完全重写 GlobalHeader 组件结构,改用 div 语义及自定义样式替代原antd a-menu - 新增 Logo 区域包含图标和标题,支持点击跳转首页功能 - 实现导航菜单动态渲染,根据路由权限过滤显示 - 用户区域支持未登录和已登录两种状态切换 - 未登录时展示登录、注册按钮,支持路由跳转 - 已登录时显示用户头像、用户名及下拉菜单,包含个人中心、设置和退出登录操作 - 引入 Arco Design 图标组件优化视觉表现 - 完善登出流程,清理本地Token并提示用户 - 优化响应式布局和交互体验,提升用户界面整体一致性与可用性
This commit is contained in:
@@ -3,6 +3,7 @@ import axios, {
|
||||
type InternalAxiosRequestConfig,
|
||||
} from "axios";
|
||||
import { ENV } from "../config";
|
||||
import { getAccessToken } from "@/utils/token";
|
||||
|
||||
const request: AxiosInstance = axios.create({
|
||||
baseURL: ENV.API_BASE_URL,
|
||||
@@ -14,8 +15,8 @@ const request: AxiosInstance = axios.create({
|
||||
// =======================
|
||||
request.interceptors.request.use(
|
||||
(config: InternalAxiosRequestConfig<any>) => {
|
||||
// 自动携带 token
|
||||
const token = localStorage.getItem("token");
|
||||
// 自动携带 access token
|
||||
const token = getAccessToken();
|
||||
if (token) {
|
||||
config.headers = config.headers || {};
|
||||
config.headers.Authorization = `Bearer ${token}`;
|
||||
|
||||
Reference in New Issue
Block a user