From 85f4ca9744327bf4ae09f765a2217de1b806b250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B6=85=E7=BA=A7=E8=80=81=E7=99=BD=E5=85=94?= Date: Sat, 16 Aug 2025 11:24:07 +0800 Subject: [PATCH] =?UTF-8?q?FEAT=20=3D>=20=E6=9C=AC=E6=AC=A1=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=A1=B9=E7=9B=AE=E4=B8=BA=EF=BC=9A=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20index.html=20=E5=92=8C=20manifest.json=20=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E8=B3=87=E6=BA=90=E5=BC=95=E7=94=A8=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20token2=20=E6=94=AF=E6=8C=81=E6=96=BC=E8=AB=8B=E6=B1=82?= =?UTF-8?q?=E6=A8=A1=E7=B5=84=EF=BC=8C=E4=B8=A6=E8=AA=BF=E6=95=B4=20ChatWi?= =?UTF-8?q?ndow=20=E7=B5=84=E4=BB=B6=E7=9A=84=E6=A8=A3=E5=BC=8F=E4=BB=A5?= =?UTF-8?q?=E6=94=B9=E5=96=84=E9=A1=AF=E7=A4=BA=E6=95=88=E6=9E=9C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cunkebao/dist/.vite/manifest.json | 4 +-- Cunkebao/dist/index.html | 4 +-- Cunkebao/src/api/request.ts | 16 ++++++++-- .../ChatWindow/ChatWindow.module.scss | 31 ++++++++++++++----- .../pc/ckbox/components/ChatWindow/index.tsx | 16 +++++----- Cunkebao/src/store/module/user.ts | 10 ++++-- 6 files changed, 57 insertions(+), 24 deletions(-) diff --git a/Cunkebao/dist/.vite/manifest.json b/Cunkebao/dist/.vite/manifest.json index 99f0a5cd..739932df 100644 --- a/Cunkebao/dist/.vite/manifest.json +++ b/Cunkebao/dist/.vite/manifest.json @@ -33,7 +33,7 @@ "name": "vendor" }, "index.html": { - "file": "assets/index-BRxvrekd.js", + "file": "assets/index-Bos-kh2O.js", "name": "index", "src": "index.html", "isEntry": true, @@ -44,7 +44,7 @@ "_charts-D0fT04H8.js" ], "css": [ - "assets/index-qTkOjY3P.css" + "assets/index-4EWIsBVv.css" ] } } \ No newline at end of file diff --git a/Cunkebao/dist/index.html b/Cunkebao/dist/index.html index 8648bac5..dd832d12 100644 --- a/Cunkebao/dist/index.html +++ b/Cunkebao/dist/index.html @@ -11,13 +11,13 @@ - + - +
diff --git a/Cunkebao/src/api/request.ts b/Cunkebao/src/api/request.ts index 6394d22e..8cce9cac 100644 --- a/Cunkebao/src/api/request.ts +++ b/Cunkebao/src/api/request.ts @@ -6,7 +6,7 @@ import axios, { } from "axios"; import { Toast } from "antd-mobile"; import { useUserStore } from "@/store/module/user"; -const { token } = useUserStore.getState(); +const { token, token2 } = useUserStore.getState(); const DEFAULT_DEBOUNCE_GAP = 1000; const debounceMap = new Map(); @@ -19,7 +19,13 @@ const instance: AxiosInstance = axios.create({ }); instance.interceptors.request.use((config: any) => { - if (token) { + // 从配置中获取是否使用token2 + const useToken2 = config.useToken2; + + if (useToken2 && token2) { + config.headers = config.headers || {}; + config.headers["Authorization"] = `Bearer ${token2}`; + } else if (token) { config.headers = config.headers || {}; config.headers["Authorization"] = `Bearer ${token}`; } @@ -56,6 +62,7 @@ export function request( method: Method = "GET", config?: AxiosRequestConfig, debounceGap?: number, + isToken2?: boolean, ): Promise { const gap = typeof debounceGap === "number" ? debounceGap : DEFAULT_DEBOUNCE_GAP; @@ -72,7 +79,10 @@ export function request( url, method, ...config, - }; + } as any; + + // 添加自定义属性 + (axiosConfig as any).useToken2 = isToken2; // 如果是FormData,不设置Content-Type,让浏览器自动设置 if (data instanceof FormData) { diff --git a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/ChatWindow.module.scss b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/ChatWindow.module.scss index 7df79562..076eaf59 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/ChatWindow.module.scss +++ b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/ChatWindow.module.scss @@ -21,32 +21,47 @@ height: 64px; min-height: 64px; flex-shrink: 0; + gap: 16px; // 确保信息区域和按钮区域有足够间距 - .chatInfo { + .chatHeaderInfo { display: flex; align-items: center; gap: 12px; + flex: 1; + min-width: 0; // 防止flex子元素溢出 - .chatDetails { - .chatName { + .chatHeaderDetails { + flex: 1; + display: flex; + align-items: center; + + .chatHeaderName { font-size: 16px; font-weight: 600; color: #262626; display: flex; align-items: center; gap: 8px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + margin-right: 30px; - .onlineStatus { + .chatHeaderOnlineStatus { font-size: 12px; color: #52c41a; font-weight: normal; + flex-shrink: 0; // 防止在线状态被压缩 } } - .chatStatus { + .chatHeaderType { font-size: 12px; color: #8c8c8c; margin-top: 2px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } } } @@ -447,9 +462,9 @@ height: 56px; min-height: 56px; - .chatInfo { - .chatDetails { - .chatName { + .chatHeaderInfo { + .chatHeaderDetails { + .chatHeaderName { font-size: 14px; } } diff --git a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx index 6e2ead3e..b9e0ff20 100644 --- a/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx +++ b/Cunkebao/src/pages/pc/ckbox/components/ChatWindow/index.tsx @@ -263,22 +263,24 @@ const ChatWindow: React.FC = ({ {/* 聊天头部 */}
-
+
: } /> -
-
+
+
{chat.name} {chat.online && ( - 在线 + 在线 )}
-
- {chat.type === "group" ? "群聊" : "私聊"} -
diff --git a/Cunkebao/src/store/module/user.ts b/Cunkebao/src/store/module/user.ts index 07838d87..d73315c4 100644 --- a/Cunkebao/src/store/module/user.ts +++ b/Cunkebao/src/store/module/user.ts @@ -22,9 +22,11 @@ export interface User { interface UserState { user: User | null; token: string | null; + token2: string | null; isLoggedIn: boolean; setUser: (user: User) => void; setToken: (token: string) => void; + setToken2: (token2: string) => void; clearUser: () => void; login: (token: string, userInfo: User, deviceTotal: number) => void; logout: () => void; @@ -34,10 +36,12 @@ export const useUserStore = createPersistStore( set => ({ user: null, token: null, + token2: null, isLoggedIn: false, setUser: user => set({ user, isLoggedIn: true }), setToken: token => set({ token }), - clearUser: () => set({ user: null, token: null, isLoggedIn: false }), + setToken2: token2 => set({ token2 }), + clearUser: () => set({ user: null, token: null, token2: null, isLoggedIn: false }), login: (token, userInfo, deviceTotal) => { // 只将token存储到localStorage localStorage.setItem("token", token); @@ -75,7 +79,8 @@ export const useUserStore = createPersistStore( logout: () => { // 清除localStorage中的token localStorage.removeItem("token"); - set({ user: null, token: null, isLoggedIn: false }); + localStorage.removeItem("token2"); + set({ user: null, token: null, token2: null, isLoggedIn: false }); }, }), { @@ -83,6 +88,7 @@ export const useUserStore = createPersistStore( partialize: state => ({ user: state.user, token: state.token, + token2: state.token2, isLoggedIn: state.isLoggedIn, }), onRehydrateStorage: () => state => {