diff --git a/CLAUDE.md b/CLAUDE.md index 2db8659..293139b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## Project Overview -This is the GFast UI project, a Vue 3 admin management system based on the vue-next-admin template, customized for a digital advertising/trading platform. +This is the **GFast UI** project (`gfast-ui`), a Vue 3 admin management system based on the vue-next-admin template, customized for a digital advertising/trading platform. ## Commands @@ -60,11 +60,14 @@ This is the GFast UI project, a Vue 3 admin management system based on the vue-n 2. **API Requests**: - API methods are organized by domain in `src/api/` (each subdomain has its own directory structure) - - The Axios instance in `src/utils/request.ts` automatically: - - Adds Bearer token from session storage - - Sends only changed fields for PUT requests (diff comparison with original data) - - Handles token expiration globally with redirect to login + - The Axios instance in `src/utils/request.ts` is pre-configured with: + - 50 second request timeout + - `qs` serialization of query parameters with dot notation for nested objects + - Automatically adds Bearer token (from cookies via Session utility) to all requests + - Automatically sends only changed fields for PUT requests (diff comparison with original data via `_originalData` field) + - Handles token expiration globally with redirect to login (prevents multiple overlapping popups) - Provides error message extraction from multiple response formats (`message`, `msg`, `error`, `detail`) + - Error throttling: maximum one error message every 2 seconds - Supports error mode configuration via `requestOptions.errorMode`: - `global`: (default) Global error popup with backend message - `page`: No automatic popup, reject the error for page-level handling @@ -78,9 +81,14 @@ This is the GFast UI project, a Vue 3 admin management system based on the vue-n - `getUpFileUrl`, `handleTree`, `useDict`, `selectDictLabel`, `parseTime`, `getItems`, `setItems`, `getOptionValue`, `isEmpty` - Global components: - `pagination` - Reusable pagination component + - Global plugins registered: + - `vue-simple-uploader` - Large file upload component - Global event bus via mitt: `app.config.globalProperties.mittBus` -4. **Authentication**: Token is stored in session storage via the `Session` utility. 401 responses (HTTP or business code) trigger automatic logout. +4. **Authentication**: + - Token is stored in cookies via `js-cookie` (through the `Session` utility). Other user session data is stored in `sessionStorage`. + - The `Session.clearAuth()` method only clears authentication-related keys (`token`, `userInfo`, `userMenu`, `permissions`), preserving other local preferences. + - 401 responses (HTTP or business code) containing token expiration signals trigger automatic logout with a single confirmation popup. 5. **Keep-alive**: Route components can be cached via keep-alive, managed by the `useKeepALiveNames` store. diff --git a/src/views/home/components/ChatList.vue b/src/views/home/components/ChatList.vue index 0cf86ed..4d5ea89 100644 --- a/src/views/home/components/ChatList.vue +++ b/src/views/home/components/ChatList.vue @@ -3,18 +3,10 @@
今天 15:14
-
-
AI
-
-
{{ msg.content }}
{{ msg.time }}
- -
-
-
@@ -48,42 +40,6 @@ const messages = ref([ time: '09:31', isUser: false, }, - { - id: 4, - content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?', - time: '09:31', - isUser: true, - }, - { - id: 5, - content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?', - time: '09:31', - isUser: false, - }, - { - id: 6, - content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?', - time: '09:31', - isUser: true, - }, - { - id: 7, - content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?', - time: '09:31', - isUser: false, - }, - { - id: 8, - content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?', - time: '09:31', - isUser: true, - }, - { - id: 9, - content: '当然可以,这个系统提供了多种功能:日记、文件、快捷指令、快捷回复,以及技能管理和模型管理入口。你想先看哪一块?', - time: '09:31', - isUser: false, - }, ]); @@ -121,49 +77,6 @@ const messages = ref([ } } -.avatar-wrap { - width: 36px; - height: 36px; - flex-shrink: 0; - display: flex; - align-items: flex-start; - padding-top: 4px; -} - -.ai-avatar { - width: 36px; - height: 36px; - border-radius: 50%; - display: flex; - align-items: center; - justify-content: center; - font-size: 12px; - font-weight: 700; - color: #1e40af; - background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); - border: 1px solid #93c5fd; - box-shadow: - inset 0 1px 0 rgba(255, 255, 255, 0.8), - 0 2px 8px rgba(59, 130, 246, 0.15); -} - -.user-avatar { - width: 36px; - height: 36px; - border-radius: 50%; - display: flex; - align-items: center; - justify-content: center; - font-size: 12px; - font-weight: 700; - color: #ffffff; - background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); - border: 1px solid #f59e0b; - box-shadow: - inset 0 1px 0 rgba(255, 255, 255, 0.25), - 0 2px 8px rgba(245, 158, 11, 0.2); -} - .bubble-wrap { display: flex; flex-direction: column; diff --git a/src/views/home/components/Sidebar.vue b/src/views/home/components/Sidebar.vue index be67da0..dc0118c 100644 --- a/src/views/home/components/Sidebar.vue +++ b/src/views/home/components/Sidebar.vue @@ -1,32 +1,12 @@