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 => {